} while (len % 16);
/* Generate IV, and encrypt */
- if (!TEST_true(RAND_bytes(iv, sizeof(iv)))
+ if (!TEST_int_gt(RAND_bytes(iv, sizeof(iv)), 0)
|| !TEST_ptr(enc_ctx = EVP_CIPHER_CTX_new())
|| !TEST_true(EVP_CipherInit_ex(enc_ctx, EVP_aes_128_cbc(), NULL,
enc_key, iv, 1))
success = 0;
/* request a single byte from each of the DRBGs before the next run */
- if (!TEST_true(RAND_bytes(random, 1) && RAND_priv_bytes(random, 1)))
+ if (!TEST_int_gt(RAND_bytes(random, 1), 0) || !TEST_int_gt(RAND_priv_bytes(random, 1), 0))
success = 0;
return success;
if (!TEST_ptr(mctx = EVP_MD_CTX_new())
/* get some random message data */
- || !TEST_true(RAND_bytes(tbs, sizeof(tbs)))
+ || !TEST_int_gt(RAND_bytes(tbs, sizeof(tbs)), 0)
/* real key */
|| !TEST_ptr(eckey = EC_KEY_new_by_curve_name(nid))
|| !TEST_true(EC_KEY_generate_key(eckey))
|| !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,
return cleanup(&pkt);
/* Generate random packet data for test */
- if (!TEST_true(RAND_bytes(&testdata2[3], sizeof(testdata2) - 3)))
+ if (!TEST_int_gt(RAND_bytes(&testdata2[3], sizeof(testdata2) - 3), 0))
return 0;
/*
PACKET read_pkt = {0};
for (i = 0; i < 10000; ++i) {
- if (!TEST_true(RAND_bytes(rand_data, sizeof(rand_data))))
+ if (!TEST_int_gt(RAND_bytes(rand_data, sizeof(rand_data)), 0))
return cleanup(&pkt);
expected = *(uint64_t*)rand_data;