diff options
author | Matt Caswell <matt@openssl.org> | 2016-06-10 17:51:39 +0200 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-06-13 18:38:39 +0200 |
commit | d356dc561925ec9cecc58a69e2280c18a49ec41a (patch) | |
tree | 3c6310c4182f1faf43e09f8a71c1fd0ceab36607 /crypto/bn | |
parent | Update sslapitest to use the test framework (diff) | |
download | openssl-d356dc561925ec9cecc58a69e2280c18a49ec41a.tar.xz openssl-d356dc561925ec9cecc58a69e2280c18a49ec41a.zip |
Add some missing return value checks
Some misc return value checks
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'crypto/bn')
-rw-r--r-- | crypto/bn/bn_prime.c | 8 | ||||
-rw-r--r-- | crypto/bn/bn_print.c | 5 |
2 files changed, 8 insertions, 5 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. */ diff --git a/crypto/bn/bn_print.c b/crypto/bn/bn_print.c index 78589dba5b..8672c7e3b3 100644 --- a/crypto/bn/bn_print.c +++ b/crypto/bn/bn_print.c @@ -241,8 +241,9 @@ int BN_dec2bn(BIGNUM **bn, const char *a) l += *a - '0'; a++; if (++j == BN_DEC_NUM) { - BN_mul_word(ret, BN_DEC_CONV); - BN_add_word(ret, l); + if (!BN_mul_word(ret, BN_DEC_CONV) + || !BN_add_word(ret, l)) + goto err; l = 0; j = 0; } |