diff options
Diffstat (limited to 'src/lib/libcrypto/hmac')
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 12 | ||||
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.h | 4 |
2 files changed, 7 insertions, 9 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index 06ee80761f..6c110bd52b 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -61,6 +61,8 @@ | |||
61 | #include <openssl/hmac.h> | 61 | #include <openssl/hmac.h> |
62 | #include "cryptlib.h" | 62 | #include "cryptlib.h" |
63 | 63 | ||
64 | #ifndef OPENSSL_FIPS | ||
65 | |||
64 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 66 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
65 | const EVP_MD *md, ENGINE *impl) | 67 | const EVP_MD *md, ENGINE *impl) |
66 | { | 68 | { |
@@ -77,15 +79,6 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
77 | 79 | ||
78 | if (key != NULL) | 80 | if (key != NULL) |
79 | { | 81 | { |
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 | |||
89 | reset=1; | 82 | reset=1; |
90 | j=EVP_MD_block_size(md); | 83 | j=EVP_MD_block_size(md); |
91 | OPENSSL_assert(j <= sizeof ctx->key); | 84 | OPENSSL_assert(j <= sizeof ctx->key); |
@@ -187,3 +180,4 @@ void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags) | |||
187 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); | 180 | EVP_MD_CTX_set_flags(&ctx->md_ctx, flags); |
188 | } | 181 | } |
189 | 182 | ||
183 | #endif | ||
diff --git a/src/lib/libcrypto/hmac/hmac.h b/src/lib/libcrypto/hmac/hmac.h index 294ab3b36a..c6489c04c8 100644 --- a/src/lib/libcrypto/hmac/hmac.h +++ b/src/lib/libcrypto/hmac/hmac.h | |||
@@ -64,7 +64,11 @@ | |||
64 | 64 | ||
65 | #include <openssl/evp.h> | 65 | #include <openssl/evp.h> |
66 | 66 | ||
67 | #ifdef OPENSSL_FIPS | ||
68 | #define HMAC_MAX_MD_CBLOCK 128 | ||
69 | #else | ||
67 | #define HMAC_MAX_MD_CBLOCK 64 | 70 | #define HMAC_MAX_MD_CBLOCK 64 |
71 | #endif | ||
68 | 72 | ||
69 | #ifdef __cplusplus | 73 | #ifdef __cplusplus |
70 | extern "C" { | 74 | extern "C" { |