mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2026-01-27 03:02:19 +01:00
wolfcrypt/test/test.c: in _rng_test(), inhibit the WC_RESEED_INTERVAL subtest if an rng callback is installed.
This commit is contained in:
@@ -19748,14 +19748,23 @@ static wc_test_ret_t _rng_test(WC_RNG* rng)
|
||||
!defined(HAVE_SELFTEST) && (!defined(HAVE_FIPS) || FIPS_VERSION3_GE(5,0,0))
|
||||
/* Test periodic reseed dynamics. */
|
||||
|
||||
((struct DRBG_internal *)rng->drbg)->reseedCtr = WC_RESEED_INTERVAL;
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
if (wc_CryptoCb_RandomBlock(rng, block, sizeof(block)) ==
|
||||
WC_NO_ERR_TRACE(CRYPTOCB_UNAVAILABLE))
|
||||
{
|
||||
#endif
|
||||
((struct DRBG_internal *)rng->drbg)->reseedCtr = WC_RESEED_INTERVAL;
|
||||
|
||||
ret = wc_RNG_GenerateBlock(rng, block, sizeof(block));
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
ret = wc_RNG_GenerateBlock(rng, block, sizeof(block));
|
||||
if (ret != 0)
|
||||
return WC_TEST_RET_ENC_EC(ret);
|
||||
|
||||
if (((struct DRBG_internal *)rng->drbg)->reseedCtr == WC_RESEED_INTERVAL)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((struct DRBG_internal *)rng->drbg)->reseedCtr == WC_RESEED_INTERVAL)
|
||||
return WC_TEST_RET_ENC_NC;
|
||||
#endif /* HAVE_HASHDRBG && !CUSTOM_RAND_GENERATE_BLOCK && !HAVE_SELFTEST */
|
||||
|
||||
#if defined(WOLFSSL_TRACK_MEMORY) && defined(WOLFSSL_SMALL_STACK_CACHE)
|
||||
|
||||
@@ -737,7 +737,7 @@ WOLFSSL_LOCAL int wc_CryptoCb_Kdf_TwostepCmac(const byte * salt, word32 saltSz,
|
||||
#endif /* HAVE_CMAC_KDF */
|
||||
|
||||
#ifndef WC_NO_RNG
|
||||
WOLFSSL_LOCAL int wc_CryptoCb_RandomBlock(WC_RNG* rng, byte* out, word32 sz);
|
||||
WOLFSSL_TEST_VIS int wc_CryptoCb_RandomBlock(WC_RNG* rng, byte* out, word32 sz);
|
||||
WOLFSSL_LOCAL int wc_CryptoCb_RandomSeed(OS_Seed* os, byte* seed, word32 sz);
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user