diff options
Diffstat (limited to 'crypto/hmac/hmac.c')
-rw-r--r-- | crypto/hmac/hmac.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c index be2dccec..bccc5c02 100644 --- a/crypto/hmac/hmac.c +++ b/crypto/hmac/hmac.c @@ -59,6 +59,7 @@ #include <assert.h> #include <string.h> +#include <openssl/digest.h> #include <openssl/mem.h> @@ -115,8 +116,8 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t key_len, * case. Fix to API to avoid this. */ if (md != ctx->md || key != NULL) { size_t i; - uint8_t pad[HMAC_MAX_MD_CBLOCK]; - uint8_t key_block[HMAC_MAX_MD_CBLOCK]; + uint8_t pad[EVP_MAX_MD_BLOCK_SIZE]; + uint8_t key_block[EVP_MAX_MD_BLOCK_SIZE]; unsigned key_block_len; size_t block_size = EVP_MD_block_size(md); @@ -134,11 +135,11 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t key_len, key_block_len = (unsigned)key_len; } /* Keys are then padded with zeros. */ - if (key_block_len != HMAC_MAX_MD_CBLOCK) { + if (key_block_len != EVP_MAX_MD_BLOCK_SIZE) { memset(&key_block[key_block_len], 0, sizeof(key_block) - key_block_len); } - for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) { + for (i = 0; i < EVP_MAX_MD_BLOCK_SIZE; i++) { pad[i] = 0x36 ^ key_block[i]; } if (!EVP_DigestInit_ex(&ctx->i_ctx, md, impl) || @@ -146,7 +147,7 @@ int HMAC_Init_ex(HMAC_CTX *ctx, const void *key, size_t key_len, return 0; } - for (i = 0; i < HMAC_MAX_MD_CBLOCK; i++) { + for (i = 0; i < EVP_MAX_MD_BLOCK_SIZE; i++) { pad[i] = 0x5c ^ key_block[i]; } if (!EVP_DigestInit_ex(&ctx->o_ctx, md, impl) || |