mirror of
https://github.com/openssl/openssl.git
synced 2025-03-19 19:50:42 +08:00
test: fix coverity 1414451: unchecked return value
Reviewed-by: Tomas Mraz <tomas@openssl.org> (Merged from https://github.com/openssl/openssl/pull/14615)
This commit is contained in:
parent
a02d70dd51
commit
0d2b8bd261
@ -144,17 +144,26 @@ static int test_mod_exp(int round)
|
||||
|| !TEST_ptr(m = BN_new()))
|
||||
goto err;
|
||||
|
||||
RAND_bytes(&c, 1);
|
||||
if (!TEST_true(RAND_bytes(&c, 1)))
|
||||
goto err;
|
||||
c = (c % BN_BITS) - BN_BITS2;
|
||||
BN_rand(a, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY);
|
||||
if (!TEST_true(BN_rand(a, NUM_BITS + c, BN_RAND_TOP_ONE,
|
||||
BN_RAND_BOTTOM_ANY)))
|
||||
goto err;
|
||||
|
||||
RAND_bytes(&c, 1);
|
||||
if (!TEST_true(RAND_bytes(&c, 1)))
|
||||
goto err;
|
||||
c = (c % BN_BITS) - BN_BITS2;
|
||||
BN_rand(b, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY);
|
||||
if (!TEST_true(BN_rand(b, NUM_BITS + c, BN_RAND_TOP_ONE,
|
||||
BN_RAND_BOTTOM_ANY)))
|
||||
goto err;
|
||||
|
||||
RAND_bytes(&c, 1);
|
||||
if (!TEST_true(RAND_bytes(&c, 1)))
|
||||
goto err;
|
||||
c = (c % BN_BITS) - BN_BITS2;
|
||||
BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ODD);
|
||||
if (!TEST_true(BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE,
|
||||
BN_RAND_BOTTOM_ODD)))
|
||||
goto err;
|
||||
|
||||
if (!TEST_true(BN_mod(a, a, m, ctx))
|
||||
|| !TEST_true(BN_mod(b, b, m, ctx))
|
||||
|
Loading…
x
Reference in New Issue
Block a user