diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2016-07-19 18:57:15 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2016-07-20 14:02:54 +0100 |
commit | 8cc44d970ced1004db0727d7a7b3e2709c442e55 (patch) | |
tree | 02912af41ffa73021c9389112886b35026370f6e /crypto/ec/ecdsa_ossl.c | |
parent | 36b53720eb4cd23eb7e6c0b3a3fed94f757f27ef (diff) |
Don't allocate r/s in DSA_SIG and ECDSA_SIG
To avoid having to immediately free up r/s when setting them
don't allocate them automatically in DSA_SIG_new() and ECDSA_SIG_new().
RT#4590
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/ec/ecdsa_ossl.c')
-rw-r--r-- | crypto/ec/ecdsa_ossl.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/crypto/ec/ecdsa_ossl.c b/crypto/ec/ecdsa_ossl.c index 6ff5a462d3..d67c48524a 100644 --- a/crypto/ec/ecdsa_ossl.c +++ b/crypto/ec/ecdsa_ossl.c @@ -221,6 +221,12 @@ ECDSA_SIG *ossl_ecdsa_sign_sig(const unsigned char *dgst, int dgst_len, ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_MALLOC_FAILURE); return NULL; } + ret->r = BN_new(); + ret->s = BN_new(); + if (ret->r == NULL || ret->s == NULL) { + ECerr(EC_F_OSSL_ECDSA_SIGN_SIG, ERR_R_MALLOC_FAILURE); + goto err; + } s = ret->s; if ((ctx = BN_CTX_new()) == NULL || |