Fix for HMAC.

This commit is contained in:
Dr. Stephen Henson 2000-03-27 00:53:27 +00:00
parent 617d71bc12
commit b475baffb2
2 changed files with 7 additions and 1 deletions

View File

@ -4,6 +4,10 @@
Changes between 0.9.5 and 0.9.5a [XX XXX 2000]
*) Fix for HMAC. It wasn't zeroing the rest of the block if the key length
was larger than the MD block size.
[Steve Henson, pointed out by Yost William <YostW@tce.com>]
*) Modernise PKCS12_parse() so it uses STACK_OF(X509) for its ca argument
fix a leak when the ca argument was passed as NULL. Stop X509_PUBKEY_set()
using the passed key: if the passed key was a private key the result

View File

@ -88,9 +88,11 @@ 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)