summaryrefslogtreecommitdiffstats
path: root/crypto/ecdsa/ecs_ossl.c
diff options
context:
space:
mode:
authorBodo Möller <bodo@openssl.org>2002-02-20 13:08:17 +0000
committerBodo Möller <bodo@openssl.org>2002-02-20 13:08:17 +0000
commit3613e6fc57d59d05a1b9e992879845000783bb36 (patch)
tree3cda403daa9a94afb65cdc486a4c83eb79d93746 /crypto/ecdsa/ecs_ossl.c
parentf8e21776f9351d78f836d217dda0649fdabe39f7 (diff)
simplifications
Submitted by: Nils Larsch
Diffstat (limited to 'crypto/ecdsa/ecs_ossl.c')
-rw-r--r--crypto/ecdsa/ecs_ossl.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/crypto/ecdsa/ecs_ossl.c b/crypto/ecdsa/ecs_ossl.c
index 5a36707cfb..a79b0c2fe2 100644
--- a/crypto/ecdsa/ecs_ossl.c
+++ b/crypto/ecdsa/ecs_ossl.c
@@ -285,16 +285,20 @@ static ECDSA_SIG *ecdsa_do_sign(const unsigned char *dgst, int dgst_len, ECDSA *
reason = ECDSA_R_SIGNATURE_MALLOC_FAILED;
goto err;
}
- ret->r = r;
- ret->s = s;
+ if (BN_copy(ret->r, r) == NULL || BN_copy(ret->s, s) == NULL)
+ {
+ ECDSA_SIG_free(ret);
+ ret = NULL;
+ reason = ERR_R_BN_LIB;
+ }
err:
if (!ret)
{
ECDSAerr(ECDSA_F_ECDSA_DO_SIGN,reason);
- BN_free(r);
- BN_free(s);
}
+ if (r != NULL) BN_clear_free(r);
+ if (s != NULL) BN_clear_free(s);
if (ctx != NULL) BN_CTX_free(ctx);
if (m != NULL) BN_clear_free(m);
if (tmp != NULL) BN_clear_free(tmp);