forked from wolfSSL/wolfssl
Added unit tests for Random.c
This commit is contained in:
54
tests/api.c
54
tests/api.c
@@ -33358,6 +33358,58 @@ static int test_wc_RNG_GenerateBlock(void)
|
|||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Testing wc_InitRngNonce
|
||||||
|
*/
|
||||||
|
static int test_wc_InitRngNonce(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
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()");
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
|
||||||
|
if (ret == 0){
|
||||||
|
ret = wc_InitRngNonce(&rng, nonce, nonceSz);
|
||||||
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
|
|
||||||
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}/* End test_wc_InitRngNonce*/
|
||||||
|
/*
|
||||||
|
* Testing wc_InitRngNonce_ex
|
||||||
|
*/
|
||||||
|
static int test_wc_InitRngNonce_ex(void)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
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()");
|
||||||
|
|
||||||
|
ret = wc_InitRng(&rng);
|
||||||
|
if (ret == 0){
|
||||||
|
ret = wc_InitRngNonce_ex(&rng, nonce, nonceSz, HEAP_HINT, devId);
|
||||||
|
}
|
||||||
|
|
||||||
|
wc_FreeRng(&rng);
|
||||||
|
|
||||||
|
printf(resultFmt, ret == 0 ? passed : failed);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}/*End test_wc_InitRngNonce_ex*/
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void test_wolfSSL_X509_CRL(void)
|
static void test_wolfSSL_X509_CRL(void)
|
||||||
@@ -35228,6 +35280,8 @@ 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);
|
||||||
|
AssertIntEQ(test_wc_InitRngNonce(), 0);
|
||||||
|
AssertIntEQ(test_wc_InitRngNonce_ex(), 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
AssertIntEQ(test_wc_ed25519_make_key(), 0);
|
AssertIntEQ(test_wc_ed25519_make_key(), 0);
|
||||||
|
Reference in New Issue
Block a user