Standard preamble:
========================================================================
..
.... Set up some character translations and predefined strings. \*(-- will
give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
double quote, and \*(R" will give a right double quote. \*(C+ will
give a nicer C++. Capital omega is used to do unbreakable dashes and
therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
nothing in troff, for use with C<>.
.tr \(*W- . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\}
Escape single quotes in literal strings from groff's Unicode transform.
If the F register is >0, we'll generate index entries on stderr for
titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
entries marked with X<> in POD. Of course, you'll have to process the
output yourself in some meaningful fashion.
Avoid warning from groff about undefined register 'F'.
.. .nr rF 0 . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF
Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
Fear. Run. Save yourself. No user-serviceable parts.
. \" fudge factors for nroff and troff . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] .\} . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents . \" corrections for vroff . \" for low resolution devices (crt and lpr) \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} ========================================================================
Title "ECDSA_SIG_NEW 3"
way too many mistakes in technical documents.
\fBECDSA_SIG_new() allocates an empty \s-1ECDSA_SIG\s0 structure. Note: before OpenSSL 1.1.0, the r and s components were initialised.
\fBECDSA_SIG_free() frees the \s-1ECDSA_SIG\s0 structure sig.
\fBECDSA_SIG_get0() returns internal pointers the r and s values contained in sig and stores them in *pr and *ps, respectively. The pointer pr or ps can be \s-1NULL,\s0 in which case the corresponding value is not returned.
The values r, s can also be retrieved separately by the corresponding function ECDSA_SIG_get0_r() and ECDSA_SIG_get0_s(), respectively.
Non-NULL r and s values can be set on the sig by calling \fBECDSA_SIG_set0(). Calling this function transfers the memory management of the values to the \s-1ECDSA_SIG\s0 object, and therefore the values that have been passed in should not be freed by the caller.
See i2d_ECDSA_SIG\|(3) and d2i_ECDSA_SIG\|(3) for information about encoding and decoding \s-1ECDSA\s0 signatures to/from \s-1DER.\s0
\fBECDSA_SIG_set0() returns 1 on success or 0 on failure.
\fBECDSA_SIG_get0_r() and ECDSA_SIG_get0_s() return the corresponding value, or \s-1NULL\s0 if it is unset.
.Vb 2 ECDSA_SIG *obj; const BIGNUM *r, *s; \& /* Load a signature into the ECDSA_SIG object */ obj = d2i_ECDSA_SIG(NULL, &signature, signaturelen); if (obj == NULL) /* error */ \& r = ECDSA_SIG_get0_r(obj); s = ECDSA_SIG_get0_s(obj); if (r == NULL || s == NULL) /* error */ \& /* Use BN_bn2binpad() here to convert to r and s into byte arrays */ \& /* * Do not try to access I<r> or I<s> after calling ECDSA_SIG_free(), * as they are both freed by this call. */ ECDSA_SIG_free(obj); .Ve
Convert r and s byte arrays into an \s-1ECDSA_SIG\s0 signature of size signaturelen:
.Vb 4 ECDSA_SIG *obj = NULL; unsigned char *signature = NULL; size_t signaturelen; BIGNUM *rbn = NULL, *sbn = NULL; \& obj = ECDSA_SIG_new(); if (obj == NULL) /* error */ rbn = BN_bin2bn(r, rlen, NULL); sbn = BN_bin2bn(s, slen, NULL); if (rbn == NULL || sbn == NULL) /* error */ \& if (!ECDSA_SIG_set0(obj, rbn, sbn)) /* error */ /* Set these to NULL since they are now owned by obj */ rbn = sbn = NULL; \& signaturelen = i2d_ECDSA_SIG(obj, &signature); if (signaturelen <= 0) /* error */ \& /* * This signature could now be passed to L<EVP_DigestVerify(3)> * or L<EVP_DigestVerifyFinal(3)> */ \& BN_free(rbn); BN_free(sbn); OPENSSL_free(signature); ECDSA_SIG_free(obj); .Ve
Licensed under the Apache License 2.0 (the \*(L"License\*(R"). You may not use this file except in compliance with the License. You can obtain a copy in the file \s-1LICENSE\s0 in the source distribution or at <https://www.openssl.org/source/license.html>.