aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/hmac
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/hmac')
-rw-r--r--crypto/hmac/hmac.c4
-rw-r--r--crypto/hmac/hmac.h8
2 files changed, 5 insertions, 7 deletions
diff --git a/crypto/hmac/hmac.c b/crypto/hmac/hmac.c
index e1ec79e0933..23b7c98f8fa 100644
--- a/crypto/hmac/hmac.c
+++ b/crypto/hmac/hmac.c
@@ -88,11 +88,9 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
else
{
memcpy(ctx->key,key,len);
+ memset(&(ctx->key[len]),0,sizeof(ctx->key)-len);
ctx->key_length=len;
}
- if(ctx->key_length != HMAC_MAX_MD_CBLOCK)
- memset(&ctx->key[ctx->key_length], 0,
- HMAC_MAX_MD_CBLOCK - ctx->key_length);
}
if (reset)
diff --git a/crypto/hmac/hmac.h b/crypto/hmac/hmac.h
index 328bad26087..223eeda7f3f 100644
--- a/crypto/hmac/hmac.h
+++ b/crypto/hmac/hmac.h
@@ -58,6 +58,10 @@
#ifndef HEADER_HMAC_H
#define HEADER_HMAC_H
+#ifdef __cplusplus
+extern "C" {
+#endif
+
#ifdef NO_HMAC
#error HMAC is disabled.
#endif
@@ -66,10 +70,6 @@
#define HMAC_MAX_MD_CBLOCK 64
-#ifdef __cplusplus
-extern "C" {
-#endif
-
typedef struct hmac_ctx_st
{
const EVP_MD *md;