diff options
author | Rich Salz <rsalz@openssl.org> | 2015-04-30 21:37:06 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2015-04-30 21:37:06 -0400 |
commit | 23a1d5e97cd543d2b8e1b01dbf0f619b2e5ce540 (patch) | |
tree | 2d9372864fc2b34939d21b3706768ec225c9548f /crypto/dsa/dsa_ossl.c | |
parent | 34166d41892643a36ad2d1f53cc0025e2edc2a39 (diff) |
free NULL cleanup 7
This gets BN_.*free:
BN_BLINDING_free BN_CTX_free BN_FLG_FREE BN_GENCB_free
BN_MONT_CTX_free BN_RECP_CTX_free BN_clear_free BN_free BUF_MEM_free
Also fix a call to DSA_SIG_free to ccgost engine and remove some #ifdef'd
dead code in engines/e_ubsec.
Reviewed-by: Richard Levitte <levitte@openssl.org>
Diffstat (limited to 'crypto/dsa/dsa_ossl.c')
-rw-r--r-- | crypto/dsa/dsa_ossl.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/crypto/dsa/dsa_ossl.c b/crypto/dsa/dsa_ossl.c index 325eac479b..cd63211c86 100644 --- a/crypto/dsa/dsa_ossl.c +++ b/crypto/dsa/dsa_ossl.c @@ -214,12 +214,10 @@ static DSA_SIG *dsa_do_sign(const unsigned char *dgst, int dlen, DSA *dsa) BN_free(r); BN_free(s); } - if (ctx != NULL) - BN_CTX_free(ctx); + BN_CTX_free(ctx); BN_clear_free(m); BN_clear_free(xr); - if (kinv != NULL) /* dsa->kinv is NULL now if we used it */ - BN_clear_free(kinv); + BN_clear_free(kinv); return (ret); } @@ -313,21 +311,18 @@ static int dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, if ((kinv = BN_mod_inverse(NULL, k, dsa->q, ctx)) == NULL) goto err; - if (*kinvp != NULL) - BN_clear_free(*kinvp); + BN_clear_free(*kinvp); *kinvp = kinv; kinv = NULL; - if (*rp != NULL) - BN_clear_free(*rp); + BN_clear_free(*rp); *rp = r; ret = 1; err: if (!ret) { DSAerr(DSA_F_DSA_SIGN_SETUP, ERR_R_BN_LIB); - if (r != NULL) - BN_clear_free(r); + BN_clear_free(r); } - if (ctx_in == NULL) + if (ctx != ctx_in) BN_CTX_free(ctx); BN_clear_free(k); BN_clear_free(kq); @@ -422,14 +417,10 @@ static int dsa_do_verify(const unsigned char *dgst, int dgst_len, err: if (ret < 0) DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_BN_LIB); - if (ctx != NULL) - BN_CTX_free(ctx); - if (u1) - BN_free(u1); - if (u2) - BN_free(u2); - if (t1) - BN_free(t1); + BN_CTX_free(ctx); + BN_free(u1); + BN_free(u2); + BN_free(t1); return (ret); } @@ -441,7 +432,6 @@ static int dsa_init(DSA *dsa) static int dsa_finish(DSA *dsa) { - if (dsa->method_mont_p) - BN_MONT_CTX_free(dsa->method_mont_p); + BN_MONT_CTX_free(dsa->method_mont_p); return (1); } |