Check outlen in blake2b_final

Not required in Sodium since the check is already performed in
higher-level functions, but it doesn't hurt either.
This commit is contained in:
Frank Denis
2014-09-13 13:09:25 -07:00
parent 8994dc340f
commit a7d38ef15d
@@ -387,6 +387,9 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
uint8_t buffer[BLAKE2B_OUTBYTES];
int i;
if( outlen > BLAKE2B_OUTBYTES ) {
return -1;
}
if( S->buflen > BLAKE2B_BLOCKBYTES )
{
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );