diff options
| author | miod <> | 2014-07-12 16:03:37 +0000 |
|---|---|---|
| committer | miod <> | 2014-07-12 16:03:37 +0000 |
| commit | 068bf464df6ef084067943863d776f59762bfaf0 (patch) | |
| tree | b756e0522f06b8c8ef257885370d0ada8f818fa8 /src/lib/libcrypto/dsa/dsa_ossl.c | |
| parent | 06f6ab0895a91e149f325795e99f199ad06b64c4 (diff) | |
| download | openbsd-068bf464df6ef084067943863d776f59762bfaf0.tar.gz openbsd-068bf464df6ef084067943863d776f59762bfaf0.tar.bz2 openbsd-068bf464df6ef084067943863d776f59762bfaf0.zip | |
if (x) FOO_free(x) -> FOO_free(x).
Improves readability, keeps the code smaller so that it is warmer in your
cache.
review & ok deraadt@
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_ossl.c')
| -rw-r--r-- | src/lib/libcrypto/dsa/dsa_ossl.c | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_ossl.c b/src/lib/libcrypto/dsa/dsa_ossl.c index 5bff836c50..e372853063 100644 --- a/src/lib/libcrypto/dsa/dsa_ossl.c +++ b/src/lib/libcrypto/dsa/dsa_ossl.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: dsa_ossl.c,v 1.20 2014/07/11 08:44:48 jsing Exp $ */ | 1 | /* $OpenBSD: dsa_ossl.c,v 1.21 2014/07/12 16:03:37 miod Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -212,12 +212,10 @@ err: | |||
| 212 | BN_free(r); | 212 | BN_free(r); |
| 213 | BN_free(s); | 213 | BN_free(s); |
| 214 | } | 214 | } |
| 215 | if (ctx != NULL) | 215 | BN_CTX_free(ctx); |
| 216 | BN_CTX_free(ctx); | ||
| 217 | BN_clear_free(&m); | 216 | BN_clear_free(&m); |
| 218 | BN_clear_free(&xr); | 217 | BN_clear_free(&xr); |
| 219 | if (kinv != NULL) /* dsa->kinv is NULL now if we used it */ | 218 | BN_clear_free(kinv); |
| 220 | BN_clear_free(kinv); | ||
| 221 | return ret; | 219 | return ret; |
| 222 | } | 220 | } |
| 223 | 221 | ||
| @@ -295,19 +293,16 @@ dsa_sign_setup(DSA *dsa, BN_CTX *ctx_in, BIGNUM **kinvp, BIGNUM **rp) | |||
| 295 | if ((kinv = BN_mod_inverse(NULL, &k, dsa->q, ctx)) == NULL) | 293 | if ((kinv = BN_mod_inverse(NULL, &k, dsa->q, ctx)) == NULL) |
| 296 | goto err; | 294 | goto err; |
| 297 | 295 | ||
| 298 | if (*kinvp != NULL) | 296 | BN_clear_free(*kinvp); |
| 299 | BN_clear_free(*kinvp); | ||
| 300 | *kinvp = kinv; | 297 | *kinvp = kinv; |
| 301 | kinv = NULL; | 298 | kinv = NULL; |
| 302 | if (*rp != NULL) | 299 | BN_clear_free(*rp); |
| 303 | BN_clear_free(*rp); | ||
| 304 | *rp = r; | 300 | *rp = r; |
| 305 | ret = 1; | 301 | ret = 1; |
| 306 | err: | 302 | err: |
| 307 | if (!ret) { | 303 | if (!ret) { |
| 308 | DSAerr(DSA_F_DSA_SIGN_SETUP, ERR_R_BN_LIB); | 304 | DSAerr(DSA_F_DSA_SIGN_SETUP, ERR_R_BN_LIB); |
| 309 | if (r != NULL) | 305 | BN_clear_free(r); |
| 310 | BN_clear_free(r); | ||
| 311 | } | 306 | } |
| 312 | if (ctx_in == NULL) | 307 | if (ctx_in == NULL) |
| 313 | BN_CTX_free(ctx); | 308 | BN_CTX_free(ctx); |
| @@ -406,8 +401,7 @@ err: | |||
| 406 | there is no error in BN. Test should be ret == -1 (Ben) */ | 401 | there is no error in BN. Test should be ret == -1 (Ben) */ |
| 407 | if (ret != 1) | 402 | if (ret != 1) |
| 408 | DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_BN_LIB); | 403 | DSAerr(DSA_F_DSA_DO_VERIFY, ERR_R_BN_LIB); |
| 409 | if (ctx != NULL) | 404 | BN_CTX_free(ctx); |
| 410 | BN_CTX_free(ctx); | ||
| 411 | BN_free(&u1); | 405 | BN_free(&u1); |
| 412 | BN_free(&u2); | 406 | BN_free(&u2); |
| 413 | BN_free(&t1); | 407 | BN_free(&t1); |
| @@ -424,8 +418,7 @@ dsa_init(DSA *dsa) | |||
| 424 | static int | 418 | static int |
| 425 | dsa_finish(DSA *dsa) | 419 | dsa_finish(DSA *dsa) |
| 426 | { | 420 | { |
| 427 | if (dsa->method_mont_p) | 421 | BN_MONT_CTX_free(dsa->method_mont_p); |
| 428 | BN_MONT_CTX_free(dsa->method_mont_p); | ||
| 429 | return 1; | 422 | return 1; |
| 430 | } | 423 | } |
| 431 | 424 | ||
