From: Dr. Stephen Henson Date: Tue, 27 Oct 2015 18:51:04 +0000 (+0000) Subject: Add ECDSA_SIG accessor. X-Git-Tag: OpenSSL_1_1_0-pre1~50 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=7236e3c8f78fbad0eedf8a78d783ee5d034f1661;p=oweals%2Fopenssl.git Add ECDSA_SIG accessor. Reviewed-by: Richard Levitte --- diff --git a/crypto/ec/ec_asn1.c b/crypto/ec/ec_asn1.c index 504fa3e7a5..8bd2de4e14 100644 --- a/crypto/ec/ec_asn1.c +++ b/crypto/ec/ec_asn1.c @@ -1303,8 +1303,6 @@ int i2o_ECPublicKey(EC_KEY *a, unsigned char **out) return buf_len; } -#include - ASN1_SEQUENCE(ECDSA_SIG) = { ASN1_SIMPLE(ECDSA_SIG, r, CBIGNUM), ASN1_SIMPLE(ECDSA_SIG, s, CBIGNUM) @@ -1313,3 +1311,11 @@ ASN1_SEQUENCE(ECDSA_SIG) = { DECLARE_ASN1_FUNCTIONS_const(ECDSA_SIG) DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECDSA_SIG, ECDSA_SIG) IMPLEMENT_ASN1_FUNCTIONS_const(ECDSA_SIG) + +void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, ECDSA_SIG *sig) +{ + if (pr) + *pr = sig->r; + if (ps) + *ps = sig->s; +} diff --git a/include/openssl/ec.h b/include/openssl/ec.h index 5810e36ef8..c2a4175607 100644 --- a/include/openssl/ec.h +++ b/include/openssl/ec.h @@ -1028,6 +1028,14 @@ int i2d_ECDSA_SIG(const ECDSA_SIG *sig, unsigned char **pp); */ ECDSA_SIG *d2i_ECDSA_SIG(ECDSA_SIG **sig, const unsigned char **pp, long len); +/** Accessor for r and s fields of ECDSA_SIG + * \param sig pointer to ECDSA_SIG pointer + * \param pr pointer to BIGNUM pointer for r (may be NULL) + * \param ps pointer to BIGNUM pointer for s (may be NULL) + */ +void ECDSA_SIG_get0(BIGNUM **pr, BIGNUM **ps, ECDSA_SIG *sig); + + # define ECParameters_dup(x) ASN1_dup_of(EC_KEY,i2d_ECParameters,d2i_ECParameters,x) # ifndef __cplusplus