STORE was created 2003, darnit!
[oweals/openssl.git] / crypto / hmac / hmac.c
index da363b795070cab0a56b5c84cf919bea6e9507de..4c91f919d56d9ac619c6dd2b7572bcb93bc63f65 100644 (file)
@@ -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;
                        }