.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" 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 C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . 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\} .el\{\ . 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. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" 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'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . 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 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . 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 .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "ECDSA_SIG_NEW 3ossl" .TH ECDSA_SIG_NEW 3ossl "2023-09-19" "3.0.11" "OpenSSL" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ECDSA_SIG_new, ECDSA_SIG_free, ECDSA_SIG_get0, ECDSA_SIG_get0_r, ECDSA_SIG_get0_s, ECDSA_SIG_set0 \&\- Functions for creating, destroying and manipulating ECDSA_SIG objects .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 1 \& #include \& \& ECDSA_SIG *ECDSA_SIG_new(void); \& void ECDSA_SIG_free(ECDSA_SIG *sig); \& void ECDSA_SIG_get0(const ECDSA_SIG *sig, const BIGNUM **pr, const BIGNUM **ps); \& const BIGNUM *ECDSA_SIG_get0_r(const ECDSA_SIG *sig); \& const BIGNUM *ECDSA_SIG_get0_s(const ECDSA_SIG *sig); \& int ECDSA_SIG_set0(ECDSA_SIG *sig, BIGNUM *r, BIGNUM *s); .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fB\s-1ECDSA_SIG\s0\fR is an opaque structure consisting of two BIGNUMs for the \&\fIr\fR and \fIs\fR value of an Elliptic Curve Digital Signature Algorithm (\s-1ECDSA\s0) signature (see \s-1FIPS186\-4\s0 or X9.62). The \fB\s-1ECDSA_SIG\s0\fR object was mainly used by the deprecated low level functions described in \&\fBECDSA_sign\fR\|(3), it is still required in order to be able to set or get the values of \&\fIr\fR and \fIs\fR into or from a signature. This is mainly used for testing purposes as shown in the \*(L"\s-1EXAMPLES\*(R"\s0. .PP \&\fBECDSA_SIG_new()\fR allocates an empty \fB\s-1ECDSA_SIG\s0\fR structure. Note: before OpenSSL 1.1.0, the \fIr\fR and \fIs\fR components were initialised. .PP \&\fBECDSA_SIG_free()\fR frees the \fB\s-1ECDSA_SIG\s0\fR structure \fIsig\fR. .PP \&\fBECDSA_SIG_get0()\fR returns internal pointers the \fIr\fR and \fIs\fR values contained in \fIsig\fR and stores them in \fI*pr\fR and \fI*ps\fR, respectively. The pointer \fIpr\fR or \fIps\fR can be \s-1NULL,\s0 in which case the corresponding value is not returned. .PP The values \fIr\fR, \fIs\fR can also be retrieved separately by the corresponding function \fBECDSA_SIG_get0_r()\fR and \fBECDSA_SIG_get0_s()\fR, respectively. .PP Non-NULL \fIr\fR and \fIs\fR values can be set on the \fIsig\fR by calling \&\fBECDSA_SIG_set0()\fR. Calling this function transfers the memory management of the values to the \fB\s-1ECDSA_SIG\s0\fR object, and therefore the values that have been passed in should not be freed by the caller. .PP See \fBi2d_ECDSA_SIG\fR\|(3) and \fBd2i_ECDSA_SIG\fR\|(3) for information about encoding and decoding \s-1ECDSA\s0 signatures to/from \s-1DER.\s0 .SH "RETURN VALUES" .IX Header "RETURN VALUES" \&\fBECDSA_SIG_new()\fR returns \s-1NULL\s0 if the allocation fails. .PP \&\fBECDSA_SIG_set0()\fR returns 1 on success or 0 on failure. .PP \&\fBECDSA_SIG_get0_r()\fR and \fBECDSA_SIG_get0_s()\fR return the corresponding value, or \s-1NULL\s0 if it is unset. .SH "EXAMPLES" .IX Header "EXAMPLES" Extract signature \fIr\fR and \fIs\fR values from a \s-1ECDSA\s0 \fIsignature\fR of size \fIsignaturelen\fR: .PP .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 or I after calling ECDSA_SIG_free(), \& * as they are both freed by this call. \& */ \& ECDSA_SIG_free(obj); .Ve .PP Convert \fIr\fR and \fIs\fR byte arrays into an \s-1ECDSA_SIG\s0 \fIsignature\fR of size \fIsignaturelen\fR: .PP .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 \& * or L \& */ \& \& BN_free(rbn); \& BN_free(sbn); \& OPENSSL_free(signature); \& ECDSA_SIG_free(obj); .Ve .SH "CONFORMING TO" .IX Header "CONFORMING TO" \&\s-1ANSI X9.62, US\s0 Federal Information Processing Standard \s-1FIPS186\-4\s0 (Digital Signature Standard, \s-1DSS\s0) .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBEC_KEY_new\fR\|(3), \&\fBEVP_DigestSignInit\fR\|(3), \&\fBEVP_DigestVerifyInit\fR\|(3), \&\fBEVP_PKEY_sign\fR\|(3) \&\fBi2d_ECDSA_SIG\fR\|(3), \&\fBd2i_ECDSA_SIG\fR\|(3), \&\fBECDSA_sign\fR\|(3) .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright 2004\-2022 The OpenSSL Project Authors. All Rights Reserved. .PP 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 .