Skip to content

Commit

Permalink
Fix a missing NULL check in dsa_builtin_paramgen
Browse files Browse the repository at this point in the history
We should check the last BN_CTX_get() call to ensure that it isn't NULL
before we try and use any of the allocated BIGNUMs.

Issue reported by Shi Lei.

Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit 1ff7425)
  • Loading branch information
mattcaswell committed Sep 21, 2016
1 parent cade326 commit 6bdd263
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crypto/dsa/dsa_gen.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ int dsa_builtin_paramgen(DSA *ret, size_t bits, size_t qbits,
p = BN_CTX_get(ctx);
test = BN_CTX_get(ctx);

if (test == NULL)
goto err;

if (!BN_lshift(test, BN_value_one(), bits - 1))
goto err;

Expand Down

0 comments on commit 6bdd263

Please sign in to comment.