diff options
Diffstat (limited to 'src/lib/libcrypto/hmac/hmac.c')
-rw-r--r-- | src/lib/libcrypto/hmac/hmac.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/lib/libcrypto/hmac/hmac.c b/src/lib/libcrypto/hmac/hmac.c index da363b7950..4c91f919d5 100644 --- a/src/lib/libcrypto/hmac/hmac.c +++ b/src/lib/libcrypto/hmac/hmac.c | |||
@@ -59,6 +59,7 @@ | |||
59 | #include <stdlib.h> | 59 | #include <stdlib.h> |
60 | #include <string.h> | 60 | #include <string.h> |
61 | #include <openssl/hmac.h> | 61 | #include <openssl/hmac.h> |
62 | #include "cryptlib.h" | ||
62 | 63 | ||
63 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | 64 | void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, |
64 | const EVP_MD *md, ENGINE *impl) | 65 | const EVP_MD *md, ENGINE *impl) |
@@ -78,6 +79,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
78 | { | 79 | { |
79 | reset=1; | 80 | reset=1; |
80 | j=EVP_MD_block_size(md); | 81 | j=EVP_MD_block_size(md); |
82 | OPENSSL_assert(j <= sizeof ctx->key); | ||
81 | if (j < len) | 83 | if (j < len) |
82 | { | 84 | { |
83 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); | 85 | EVP_DigestInit_ex(&ctx->md_ctx,md, impl); |
@@ -87,6 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len, | |||
87 | } | 89 | } |
88 | else | 90 | else |
89 | { | 91 | { |
92 | OPENSSL_assert(len <= sizeof ctx->key); | ||
90 | memcpy(ctx->key,key,len); | 93 | memcpy(ctx->key,key,len); |
91 | ctx->key_length=len; | 94 | ctx->key_length=len; |
92 | } | 95 | } |