diff options
author | Jung-uk Kim <jkim@FreeBSD.org> | 2015-10-23 19:46:02 +0000 |
---|---|---|
committer | Jung-uk Kim <jkim@FreeBSD.org> | 2015-10-23 19:46:02 +0000 |
commit | e9fcefce9bb70f20c272a996443928c5f6ab8cd8 (patch) | |
tree | ae816a5a768ec78af3610e509ca39507b33aa9f7 /crypto/hmac/hmac.c | |
parent | c07d7b3a386974c338492659291008bed07948e6 (diff) |
Diffstat (limited to 'crypto/hmac/hmac.c')
-rw-r--r-- | crypto/hmac/hmac.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index 33d88be1179b4..51a0a3efcd672 100644 --- a/crypto/hmac/hmac.c +++ b/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) |