From 7fbb209684be2fd80b7dc8915ef6dc796f07587a Mon Sep 17 00:00:00 2001 From: Daniel Pouzzner Date: Fri, 1 Mar 2024 17:51:24 -0600 Subject: [PATCH] ssl.c: in wolfSSL_Init(), fix cppcheck identicalInnerCondition warning on non-FIPS configurations. --- src/ssl.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ssl.c b/src/ssl.c index ad514d27a..52547e2db 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -6244,20 +6244,20 @@ int wolfSSL_Init(void) return BAD_MUTEX_E; } - if ((ret == WOLFSSL_SUCCESS) && (initRefCount == 0)) { - /* Initialize crypto for use with TLS connection */ - #if FIPS_VERSION_GE(5,1) + if ((ret == WOLFSSL_SUCCESS) && (initRefCount == 0)) { ret = wolfCrypt_SetPrivateKeyReadEnable_fips(1, WC_KEYTYPE_ALL); if (ret == 0) ret = WOLFSSL_SUCCESS; + } #endif - if (ret == WOLFSSL_SUCCESS) { - if (wolfCrypt_Init() != 0) { - WOLFSSL_MSG("Bad wolfCrypt Init"); - ret = WC_INIT_E; - } + if ((ret == WOLFSSL_SUCCESS) && (initRefCount == 0)) { + /* Initialize crypto for use with TLS connection */ + + if (wolfCrypt_Init() != 0) { + WOLFSSL_MSG("Bad wolfCrypt Init"); + ret = WC_INIT_E; } #if defined(HAVE_GLOBAL_RNG) && !defined(WOLFSSL_MUTEX_INITIALIZER)