Call wc_SetSeed_Cb and wolfCrypt_SetPrivateKeyReadEnable_fips in wolfSSL_Init.

Additionally, remove wc_SetSeed_Cb calls applications (e.g. example client and
server), since they are now redundant.
This commit is contained in:
Hayden Roche
2021-12-22 14:21:06 -08:00
parent 8670e33baf
commit 52754123d9
8 changed files with 8 additions and 25 deletions

View File

@ -1754,9 +1754,6 @@ int bench_tls(void* args)
/* Initialize wolfSSL */
wolfSSL_Init();
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
/* Parse command line arguments */
while ((ch = mygetopt(argc, argv, "?" "udeil:p:t:vT:sch:P:mS:g")) != -1) {

View File

@ -4224,9 +4224,6 @@ exit:
wolfSSL_Debugging_ON();
#endif
wolfSSL_Init();
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
ChangeToWolfRoot();
#ifndef NO_WOLFSSL_CLIENT

View File

@ -385,9 +385,6 @@ void echoclient_test(void* args)
#if defined(DEBUG_CYASSL) && !defined(WOLFSSL_MDK_SHELL)
CyaSSL_Debugging_ON();
#endif
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
#ifndef CYASSL_TIRTOS
ChangeToWolfRoot();
#endif

View File

@ -546,9 +546,6 @@ THREAD_RETURN CYASSL_THREAD echoserver_test(void* args)
CyaSSL_Init();
#if defined(DEBUG_CYASSL) && !defined(CYASSL_MDK_SHELL)
CyaSSL_Debugging_ON();
#endif
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
ChangeToWolfRoot();
#ifndef NO_WOLFSSL_SERVER

View File

@ -70,9 +70,6 @@ int main()
const char* response = "hello there";
char buffer[80];
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
WOLFSSL_CTX* ctx = wolfSSL_CTX_new(wolfDTLSv1_2_client_method());
if (ctx == NULL)
err_sys("ctx new dtls client failed");

View File

@ -76,9 +76,6 @@ int main()
const char* response = "well hello to you";
char buffer[80];
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
WOLFSSL_CTX* ctx = wolfSSL_CTX_new(wolfDTLSv1_2_server_method());
if (ctx == NULL)
err_sys("ctx new dtls server failed");

View File

@ -5194,6 +5194,14 @@ int wolfSSL_Init(void)
}
#endif
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
#if defined(HAVE_FIPS_VERSION) && HAVE_FIPS_VERSION == 5
wolfCrypt_SetPrivateKeyReadEnable_fips(1, WC_KEYTYPE_ALL);
#endif
#ifdef OPENSSL_EXTRA
#ifndef WOLFSSL_NO_OPENSSL_RAND_CB
if ((ret == WOLFSSL_SUCCESS) && (wolfSSL_RAND_InitMutex() != 0)) {

View File

@ -133,9 +133,6 @@ int testsuite_test(int argc, char** argv)
#if defined(DEBUG_WOLFSSL) && !defined(HAVE_VALGRIND)
wolfSSL_Debugging_ON();
#endif
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
#if !defined(WOLFSSL_TIRTOS)
ChangeToWolfRoot();
@ -603,10 +600,6 @@ int main(int argc, char** argv)
wolfcrypt_test_args.argc = argc;
wolfcrypt_test_args.argv = argv;
#ifdef WC_RNG_SEED_CB
wc_SetSeed_Cb(wc_GenerateSeed);
#endif
wolfSSL_Init();
ChangeToWolfRoot();