diff options
| author | djm <> | 2005-04-29 05:37:34 +0000 |
|---|---|---|
| committer | djm <> | 2005-04-29 05:37:34 +0000 |
| commit | a95585a25ab25668b931a78b7543f707a3354db8 (patch) | |
| tree | f9e9febf7ac0c8f5d6df761fe70fd613aac06203 /src/lib/libcrypto/hmac/hmac.c | |
| parent | 58c08aa241f168c84ce7cc3052454ea59a44eada (diff) | |
| download | openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.gz openbsd-a95585a25ab25668b931a78b7543f707a3354db8.tar.bz2 openbsd-a95585a25ab25668b931a78b7543f707a3354db8.zip | |
import of openssl-0.9.7g; tested on platforms from alpha to zaurus, ok deraadt@
Diffstat (limited to '')
| -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 | |||
