aboutsummaryrefslogtreecommitdiff
path: root/deps/openssl/openssl/crypto/hmac/hmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'deps/openssl/openssl/crypto/hmac/hmac.c')
-rw-r--r--deps/openssl/openssl/crypto/hmac/hmac.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/deps/openssl/openssl/crypto/hmac/hmac.c b/deps/openssl/openssl/crypto/hmac/hmac.c
index 5477816551..1fc9e2c3fa 100644
--- a/deps/openssl/openssl/crypto/hmac/hmac.c
+++ b/deps/openssl/openssl/crypto/hmac/hmac.c
@@ -72,6 +72,16 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
unsigned char pad[HMAC_MAX_MD_CBLOCK];
#ifdef OPENSSL_FIPS
+ /* If FIPS mode switch to approved implementation if possible */
+ if (FIPS_mode()) {
+ const EVP_MD *fipsmd;
+ if (md) {
+ fipsmd = FIPS_get_digestbynid(EVP_MD_type(md));
+ if (fipsmd)
+ md = fipsmd;
+ }
+ }
+
if (FIPS_mode()) {
/* If we have an ENGINE need to allow non FIPS */
if ((impl || ctx->i_ctx.engine)