#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <openssl/hmac.h>
#include "cryptlib.h"
+#include <openssl/hmac.h>
void HMAC_Init_ex(HMAC_CTX *ctx, const void *key, int len,
const EVP_MD *md, ENGINE *impl)
}
else
{
- OPENSSL_assert(len <= (int)sizeof(ctx->key));
+ OPENSSL_assert(len>=0 && len<=(int)sizeof(ctx->key));
memcpy(ctx->key,key,len);
ctx->key_length=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);
}
}
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;