diff options
author | Brian Smith <brian@briansmith.org> | 2015-04-09 02:28:26 +0300 |
---|---|---|
committer | Adam Langley <agl@google.com> | 2015-04-09 03:29:14 +0300 |
commit | d6405beb2c75564edbbb7f4203252aa5edee2359 (patch) | |
tree | dea25272bc680c9b421f65d0db2fedf873f3aab2 /crypto/ec/wnaf.c | |
parent | 32fbdf2025330664bd2a977d3ef62802e0cf817d (diff) |
Avoid calling BN_CTX_end without BN_CTX_start in ec_wNAF_precompute_mult.
Prior to this change, when EC_GROUP_get0_generator fails, BN_CTX_end
would get called even though BN_CTX_start hadn't been called yet, in
the case where the caller-supplied |ctx| is not NULL.
Change-Id: I6f728e74f0167193891cdb6f122b20b0770283dc
Reviewed-on: https://boringssl-review.googlesource.com/4271
Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'crypto/ec/wnaf.c')
-rw-r--r-- | crypto/ec/wnaf.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/crypto/ec/wnaf.c b/crypto/ec/wnaf.c index 0b92b6e1..e36efe20 100644 --- a/crypto/ec/wnaf.c +++ b/crypto/ec/wnaf.c @@ -709,15 +709,15 @@ int ec_wNAF_precompute_mult(EC_GROUP *group, BN_CTX *ctx) { group->pre_comp = NULL; } - pre_comp = ec_pre_comp_new(); - if (pre_comp == NULL) { - return 0; - } - generator = EC_GROUP_get0_generator(group); if (generator == NULL) { OPENSSL_PUT_ERROR(EC, ec_wNAF_precompute_mult, EC_R_UNDEFINED_GENERATOR); - goto err; + return 0; + } + + pre_comp = ec_pre_comp_new(); + if (pre_comp == NULL) { + return 0; } if (ctx == NULL) { |