forked from wolfSSL/wolfssl
Merge pull request #3134 from ethanlooney/14th_branch
Added unit tests for Random.c
This commit is contained in:
57
tests/api.c
57
tests/api.c
@@ -33378,6 +33378,59 @@ static int test_wc_RNG_GenerateBlock(void)
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/*
|
||||||
|
* Testing wc_InitRngNonce
|
||||||
|
*/
|
||||||
|
static int test_wc_InitRngNonce(void)
|
||||||
|
{
|
||||||
|
int ret=0;
|
||||||
|
#if !defined(WC_NO_RNG) && !defined(HAVE_SELFTEST) && \
|
||||||
|
(!defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 2))
|
||||||
|
WC_RNG rng;
|
||||||
|
byte nonce[] = "\x0D\x74\xDB\x42\xA9\x10\x77\xDE"
|
||||||
|
"\x45\xAC\x13\x7A\xE1\x48\xAF\x16";
|
||||||
|
word32 nonceSz = sizeof(nonce);
|
||||||
|
|
||||||
|
|
||||||
|
printf(testingFmt, "wc_InitRngNonce()");
|
||||||
|
|
||||||
|
if (ret == 0){
|
||||||
|
ret = wc_InitRngNonce(&rng, nonce, nonceSz);
|
||||||
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
|
|
||||||
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}/* End test_wc_InitRngNonce*/
|
||||||
|
/*
|
||||||
|
* Testing wc_InitRngNonce_ex
|
||||||
|
*/
|
||||||
|
static int test_wc_InitRngNonce_ex(void)
|
||||||
|
{
|
||||||
|
int ret=0;
|
||||||
|
#if !defined(WC_NO_RNG) && !defined(HAVE_SELFTEST) && \
|
||||||
|
(!defined(HAVE_FIPS) || (defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION >= 2))
|
||||||
|
WC_RNG rng;
|
||||||
|
byte nonce[] = "\x0D\x74\xDB\x42\xA9\x10\x77\xDE"
|
||||||
|
"\x45\xAC\x13\x7A\xE1\x48\xAF\x16";
|
||||||
|
word32 nonceSz = sizeof(nonce);
|
||||||
|
|
||||||
|
printf(testingFmt, "wc_InitRngNonce_ex()");
|
||||||
|
|
||||||
|
if (ret == 0){
|
||||||
|
ret = wc_InitRngNonce_ex(&rng, nonce, nonceSz, HEAP_HINT, devId);
|
||||||
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
|
|
||||||
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
|
#endif
|
||||||
|
return ret;
|
||||||
|
}/*End test_wc_InitRngNonce_ex*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static void test_wolfSSL_X509_CRL(void)
|
static void test_wolfSSL_X509_CRL(void)
|
||||||
{
|
{
|
||||||
@@ -35248,8 +35301,10 @@ void ApiTest(void)
|
|||||||
AssertIntEQ(test_wc_RNG_GenerateBlock_Reseed(), 0);
|
AssertIntEQ(test_wc_RNG_GenerateBlock_Reseed(), 0);
|
||||||
#endif
|
#endif
|
||||||
AssertIntEQ(test_wc_RNG_GenerateBlock(), 0);
|
AssertIntEQ(test_wc_RNG_GenerateBlock(), 0);
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#endif
|
||||||
|
AssertIntEQ(test_wc_InitRngNonce(), 0);
|
||||||
|
AssertIntEQ(test_wc_InitRngNonce_ex(), 0);
|
||||||
AssertIntEQ(test_wc_ed25519_make_key(), 0);
|
AssertIntEQ(test_wc_ed25519_make_key(), 0);
|
||||||
AssertIntEQ(test_wc_ed25519_init(), 0);
|
AssertIntEQ(test_wc_ed25519_init(), 0);
|
||||||
AssertIntEQ(test_wc_ed25519_sign_msg(), 0);
|
AssertIntEQ(test_wc_ed25519_sign_msg(), 0);
|
||||||
|
Reference in New Issue
Block a user