summaryrefslogtreecommitdiffstats
path: root/crypto/hmac/hmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/hmac/hmac.c')
-rw-r--r--crypto/hmac/hmac.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index da363b7950..4c91f919d5 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -59,6 +59,7 @@
#include <stdlib.h>
#include <string.h>
#include <openssl/hmac.h>
+#include "cryptlib.h"
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl)
@@ -78,6 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
{
reset=1;
j=EVP_MD_block_size(md);
+ OPENSSL_assert(j <= sizeof ctx->key);
if (j < len)
{
EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
@@ -87,6 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
}
else
{
+ OPENSSL_assert(len <= sizeof ctx->key);
memcpy(ctx->key,key,len);
ctx->key_length=len;
}