summaryrefslogtreecommitdiffstats
path: root/lib/libcrypto/hmac/hmac.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libcrypto/hmac/hmac.c')
-rw-r--r--lib/libcrypto/hmac/hmac.c20
1 files changed, 5 insertions, 15 deletions
diff --git a/lib/libcrypto/hmac/hmac.c b/lib/libcrypto/hmac/hmac.c
index 6c110bd52bb..c45e0014927 100644
--- a/lib/libcrypto/hmac/hmac.c
+++ b/lib/libcrypto/hmac/hmac.c
@@ -58,10 +58,8 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <openssl/hmac.h>
#include "cryptlib.h"
-
-#ifndef OPENSSL_FIPS
+#include <openssl/hmac.h>
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl)
@@ -81,7 +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);
+ OPENSSL_assert(j <= (int)sizeof(ctx->key));
if (j < len)
{
EVP_DigestInit_ex(&ctx->md_ctx,md, impl);
@@ -91,7 +89,7 @@ void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
}
else
{
- OPENSSL_assert(len <= sizeof ctx->key);
+ OPENSSL_assert(len>=0 && len<=(int)sizeof(ctx->key));
memcpy(ctx->key,key,len);
ctx->key_length=len;
}
@@ -123,7 +121,7 @@ void HMAC_Init(HMAC_CTX *ctx, const void *key, int len,
HMAC_Init_ex(ctx,key,len,md, NULL);
}
-void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, int len)
+void HMAC_Update(HMAC_CTX *ctx, const unsigned char *data, size_t len)
{
EVP_DigestUpdate(&ctx->md_ctx,data,len);
}
@@ -158,7 +156,7 @@ void HMAC_CTX_cleanup(HMAC_CTX *ctx)
}
unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
- const unsigned char *d, int n, unsigned char *md,
+ const unsigned char *d, size_t n, unsigned char *md,
unsigned int *md_len)
{
HMAC_CTX c;
@@ -173,11 +171,3 @@ unsigned char *HMAC(const EVP_MD *evp_md, const void *key, int key_len,
return(md);
}
-void HMAC_CTX_set_flags(HMAC_CTX *ctx, unsigned long flags)
- {
- EVP_MD_CTX_set_flags(&ctx->i_ctx, flags);
- EVP_MD_CTX_set_flags(&ctx->o_ctx, flags);
- EVP_MD_CTX_set_flags(&ctx->md_ctx, flags);
- }
-
-#endif