diff --git a/src/ssl.c b/src/ssl.c index 900e96dec..acd744f60 100644 --- a/src/ssl.c +++ b/src/ssl.c @@ -24751,67 +24751,6 @@ int wolfSSL_HMAC_CTX_copy(WOLFSSL_HMAC_CTX* des, WOLFSSL_HMAC_CTX* src) return SSL_SUCCESS; } -/* duplicate from wolfcrypt/src/hmac.c needs refactored */ -static int _InitHmac(Hmac* hmac, int type, void* heap) -{ - int ret = 0; - - switch (type) { - #ifndef NO_MD5 - case MD5: - ret = wc_InitMd5(&hmac->hash.md5); - break; - #endif /* !NO_MD5 */ - - #ifndef NO_SHA - case SHA: - ret = wc_InitSha(&hmac->hash.sha); - break; - #endif /* !NO_SHA */ - - #ifdef WOLFSSL_SHA224 - case SHA224: - ret = wc_InitSha224(&hmac->hash.sha224); - break; - #endif /* WOLFSSL_SHA224 */ - - #ifndef NO_SHA256 - case SHA256: - ret = wc_InitSha256(&hmac->hash.sha256); - break; - #endif /* !NO_SHA256 */ - - #ifdef WOLFSSL_SHA512 - #ifdef WOLFSSL_SHA384 - case SHA384: - ret = wc_InitSha384(&hmac->hash.sha384); - break; - #endif /* WOLFSSL_SHA384 */ - case SHA512: - ret = wc_InitSha512(&hmac->hash.sha512); - break; - #endif /* WOLFSSL_SHA512 */ - - #ifdef HAVE_BLAKE2 - case BLAKE2B_ID: - ret = wc_InitBlake2b(&hmac->hash.blake2b, BLAKE2B_256); - break; - #endif /* HAVE_BLAKE2 */ - - default: - ret = BAD_FUNC_ARG; - break; - } - - /* default to NULL heap hint or test value */ -#ifdef WOLFSSL_HEAP_TEST - hmac->heap = (void)WOLFSSL_HEAP_TEST; -#else - hmac->heap = heap; -#endif /* WOLFSSL_HEAP_TEST */ - - return ret; -} int wolfSSL_HMAC_Init(WOLFSSL_HMAC_CTX* ctx, const void* key, int keylen, const EVP_MD* type) { diff --git a/wolfcrypt/src/hmac.c b/wolfcrypt/src/hmac.c index f4c1e89f3..f9a75b32c 100644 --- a/wolfcrypt/src/hmac.c +++ b/wolfcrypt/src/hmac.c @@ -166,9 +166,13 @@ int wc_HmacSizeByType(int type) return ret; } +#ifdef OPENSSL_EXTRA + WOLFSSL_LOCAL +#else + static +#endif -/* software implementation */ -static int _InitHmac(Hmac* hmac, int type, void* heap) +int _InitHmac(Hmac* hmac, int type, void* heap) { int ret = 0; diff --git a/wolfssl/wolfcrypt/hmac.h b/wolfssl/wolfcrypt/hmac.h index e21ec6205..0e835388f 100644 --- a/wolfssl/wolfcrypt/hmac.h +++ b/wolfssl/wolfcrypt/hmac.h @@ -156,6 +156,10 @@ WOLFSSL_API void wc_HmacFree(Hmac*); WOLFSSL_API int wolfSSL_GetHmacMaxSize(void); +#ifdef OPENSSL_EXTRA + WOLFSSL_LOCAL int _InitHmac(Hmac* hmac, int type, void* heap); +#endif + #ifdef HAVE_HKDF WOLFSSL_API int wc_HKDF_Extract(int type, const byte* salt, word32 saltSz,