diff options
Diffstat (limited to 'src/lib/libcrypto/ec/ec_lib.c')
-rw-r--r-- | src/lib/libcrypto/ec/ec_lib.c | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/src/lib/libcrypto/ec/ec_lib.c b/src/lib/libcrypto/ec/ec_lib.c index 47ccc614d1..8cf0f2241e 100644 --- a/src/lib/libcrypto/ec/ec_lib.c +++ b/src/lib/libcrypto/ec/ec_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ec_lib.c,v 1.15 2014/07/12 16:03:37 miod Exp $ */ | 1 | /* $OpenBSD: ec_lib.c,v 1.16 2015/02/09 15:49:22 jsing Exp $ */ |
2 | /* | 2 | /* |
3 | * Originally written by Bodo Moeller for the OpenSSL project. | 3 | * Originally written by Bodo Moeller for the OpenSSL project. |
4 | */ | 4 | */ |
@@ -497,18 +497,19 @@ EC_GROUP_cmp(const EC_GROUP * a, const EC_GROUP * b, BN_CTX * ctx) | |||
497 | return -1; | 497 | return -1; |
498 | 498 | ||
499 | BN_CTX_start(ctx); | 499 | BN_CTX_start(ctx); |
500 | a1 = BN_CTX_get(ctx); | 500 | if ((a1 = BN_CTX_get(ctx)) == NULL) |
501 | a2 = BN_CTX_get(ctx); | 501 | goto err; |
502 | a3 = BN_CTX_get(ctx); | 502 | if ((a2 = BN_CTX_get(ctx)) == NULL) |
503 | b1 = BN_CTX_get(ctx); | 503 | goto err; |
504 | b2 = BN_CTX_get(ctx); | 504 | if ((a3 = BN_CTX_get(ctx)) == NULL) |
505 | b3 = BN_CTX_get(ctx); | 505 | goto err; |
506 | if (!b3) { | 506 | if ((b1 = BN_CTX_get(ctx)) == NULL) |
507 | BN_CTX_end(ctx); | 507 | goto err; |
508 | if (ctx_new) | 508 | if ((b2 = BN_CTX_get(ctx)) == NULL) |
509 | BN_CTX_free(ctx); | 509 | goto err; |
510 | return -1; | 510 | if ((b3 = BN_CTX_get(ctx)) == NULL) |
511 | } | 511 | goto err; |
512 | |||
512 | /* | 513 | /* |
513 | * XXX This approach assumes that the external representation of | 514 | * XXX This approach assumes that the external representation of |
514 | * curves over the same field type is the same. | 515 | * curves over the same field type is the same. |
@@ -544,6 +545,12 @@ EC_GROUP_cmp(const EC_GROUP * a, const EC_GROUP * b, BN_CTX * ctx) | |||
544 | BN_CTX_free(ctx); | 545 | BN_CTX_free(ctx); |
545 | 546 | ||
546 | return r; | 547 | return r; |
548 | |||
549 | err: | ||
550 | BN_CTX_end(ctx); | ||
551 | if (ctx_new) | ||
552 | BN_CTX_free(ctx); | ||
553 | return -1; | ||
547 | } | 554 | } |
548 | 555 | ||
549 | 556 | ||