diff options
Diffstat (limited to 'src/lib/libcrypto/hmac/hmac.c')
| -rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 4c91f919d5..06ee80761f 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
| @@ -77,6 +77,15 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
| 77 | 77 | ||
| 78 | if (key != NULL) | 78 | if (key != NULL) |
| 79 | { | 79 | { |
| 80 | #ifdef OPENSSL_FIPS | ||
| 81 | if (FIPS_mode() && !(md->flags & EVP_MD_FLAG_FIPS) | ||
| 82 | && (!(ctx->md_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
| 83 | || !(ctx->i_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW) | ||
| 84 | || !(ctx->o_ctx.flags & EVP_MD_CTX_FLAG_NON_FIPS_ALLOW))) | ||
| 85 | OpenSSLDie(__FILE__,__LINE__, | ||
| 86 | "HMAC: digest not allowed in FIPS mode"); | ||
| 87 | #endif | ||
| 88 | |||
| 80 | reset=1; | 89 | reset=1; |
| 81 | j=EVP_MD_block_size(md); | 90 | j=EVP_MD_block_size(md); |
| 82 | OPENSSL_assert(j <= sizeof ctx->key); | 91 | OPENSSL_assert(j <= sizeof ctx->key); |
| @@ -171,3 +180,10 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len, | |||
| 171 | return(md); | 180 | return(md); |
| 172 | } | 181 | } |
| 173 | 182 | ||
| 183 | void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | ||
| 184 | { | ||
| 185 | EVP_MD_CTX_set_flags(&ctx->i_ctx, flags); | ||
| 186 | EVP_MD_CTX_set_flags(&ctx->o_ctx, flags); | ||
| 187 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | ||
| 188 | } | ||
| 189 | |||
