From 6d5f63e57b7d7294b891b6de406d767468314dfe Mon Sep 17 00:00:00 2001 From: Peiwei Hu Date: Sat, 28 May 2022 23:46:33 +0800 Subject: Fix the checks of RAND_bytes Reviewed-by: Tomas Mraz Reviewed-by: Paul Dale Reviewed-by: Todd Short (Merged from https://github.com/openssl/openssl/pull/18424) (cherry picked from commit c2f7614fb7b93fe3792068077ff01384f42f39bc) --- test/exptest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/exptest.c') diff --git a/test/exptest.c b/test/exptest.c index 84d972afe3..c2acc40bcd 100644 --- a/test/exptest.c +++ b/test/exptest.c @@ -144,21 +144,21 @@ static int test_mod_exp(int round) || !TEST_ptr(m = BN_new())) goto err; - if (!TEST_true(RAND_bytes(&c, 1))) + if (!TEST_int_gt(RAND_bytes(&c, 1), 0)) goto err; c = (c % BN_BITS) - BN_BITS2; if (!TEST_true(BN_rand(a, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))) goto err; - if (!TEST_true(RAND_bytes(&c, 1))) + if (!TEST_int_gt(RAND_bytes(&c, 1), 0)) goto err; c = (c % BN_BITS) - BN_BITS2; if (!TEST_true(BN_rand(b, NUM_BITS + c, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY))) goto err; - if (!TEST_true(RAND_bytes(&c, 1))) + if (!TEST_int_gt(RAND_bytes(&c, 1), 0)) goto err; c = (c % BN_BITS) - BN_BITS2; if (!TEST_true(BN_rand(m, NUM_BITS + c, BN_RAND_TOP_ONE, -- cgit v1.2.3