diff options
author | Pauli <paul.dale@oracle.com> | 2018-09-03 07:37:38 +1000 |
---|---|---|
committer | Pauli <paul.dale@oracle.com> | 2018-09-03 10:43:01 +1000 |
commit | f2ce14d6cfa83c16b36319d71b245a388ddcc1ce (patch) | |
tree | 4fd9c0f442010f806755ee39d6c09fe13394bbec /crypto | |
parent | dfbc526e30b2e30cb574a727b3319e4a6125c9e3 (diff) |
Check the return from BN_sub() in BN_X931_generate_Xpq().
Reviewed-by: Tim Hudson <tjh@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/7088)
(cherry picked from commit 6bcfcf16bf6aef4f9ec267d8b86ae1bffd8deab9)
Diffstat (limited to 'crypto')
-rw-r--r-- | crypto/bn/bn_x931p.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crypto/bn/bn_x931p.c b/crypto/bn/bn_x931p.c index 8bfbcac6a4..24f6a85bef 100644 --- a/crypto/bn/bn_x931p.c +++ b/crypto/bn/bn_x931p.c @@ -184,8 +184,10 @@ int BN_X931_generate_Xpq(BIGNUM *Xp, BIGNUM *Xq, int nbits, BN_CTX *ctx) for (i = 0; i < 1000; i++) { if (!BN_rand(Xq, nbits, BN_RAND_TOP_TWO, BN_RAND_BOTTOM_ANY)) goto err; + /* Check that |Xp - Xq| > 2^(nbits - 100) */ - BN_sub(t, Xp, Xq); + if (!BN_sub(t, Xp, Xq)) + goto err; if (BN_num_bits(t) > (nbits - 100)) break; } |