summaryrefslogtreecommitdiffstats
path: root/crypto/bn/bn_prime.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2016-06-10 16:51:39 +0100
committerMatt Caswell <matt@openssl.org>2016-06-13 17:38:39 +0100
commitd356dc561925ec9cecc58a69e2280c18a49ec41a (patch)
tree3c6310c4182f1faf43e09f8a71c1fd0ceab36607 /crypto/bn/bn_prime.c
parentc887104f4ac27a2743c0c830d20c1e341180a48b (diff)
Add some missing return value checks
Some misc return value checks Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/bn/bn_prime.c')
-rw-r--r--crypto/bn/bn_prime.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/crypto/bn/bn_prime.c b/crypto/bn/bn_prime.c
index bdfa558a7e..81c2391ef8 100644
--- a/crypto/bn/bn_prime.c
+++ b/crypto/bn/bn_prime.c
@@ -340,7 +340,8 @@ int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx)
if ((offset_count = BN_CTX_get(ctx)) == NULL)
goto err;
- BN_add_word(offset_count, prime_offset_count);
+ if (!BN_add_word(offset_count, prime_offset_count))
+ goto err;
loop:
if (!BN_rand(rnd, bits - prime_multiplier_bits, 0, 1))
@@ -350,8 +351,9 @@ int bn_probable_prime_dh_coprime(BIGNUM *rnd, int bits, BN_CTX *ctx)
if (!BN_rand_range(offset_index, offset_count))
goto err;
- BN_mul_word(rnd, prime_multiplier);
- BN_add_word(rnd, prime_offsets[BN_get_word(offset_index)]);
+ if (!BN_mul_word(rnd, prime_multiplier)
+ || !BN_add_word(rnd, prime_offsets[BN_get_word(offset_index)]))
+ goto err;
/* we now have a random number 'rand' to test. */