add LTC_ARGCHK for blake2b_process.

This commit is contained in:
Kelvin Sherlock 2017-04-08 17:00:39 -04:00
parent b412ab539a
commit 268c87e33d
2 changed files with 9 additions and 2 deletions

View File

@ -292,6 +292,13 @@ static int blake2b_compress(hash_state *md, const unsigned char *buf)
int blake2b_process(hash_state *md, const unsigned char *in, unsigned long inlen)
{
LTC_ARGCHK(md != NULL);
LTC_ARGCHK(in != NULL);
if (md->blake2b.curlen > sizeof(md->blake2b.buf)) {
return CRYPT_INVALID_ARG;
}
if (inlen > 0) {
unsigned long left = md->blake2b.curlen;
unsigned long fill = BLAKE2B_BLOCKBYTES - left;

View File

@ -179,11 +179,11 @@ int blake2s_init(hash_state *md, unsigned long outlen)
struct blake2s_param P;
LTC_ARGCHK(md != NULL);
XMEMSET(&P, 0, sizeof(P));
if ((!outlen) || (outlen > BLAKE2S_OUTBYTES))
return CRYPT_INVALID_ARG;
XMEMSET(&P, 0, sizeof(P));
P.digest_length = (unsigned char)outlen;
P.fanout = 1;