1
1
mirror of https://github.com/BLAKE2/BLAKE2 synced 2024-11-22 02:31:57 +01:00

bug in key-less b2x

This commit is contained in:
JP Aumasson 2016-10-11 22:32:53 +02:00
parent c44e34b3a5
commit 1f26297f81
4 changed files with 10609 additions and 10602 deletions

@ -30,7 +30,11 @@ int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size
return -1;
}
if (NULL == key || keylen > BLAKE2B_KEYBYTES) {
if (NULL != key && keylen > BLAKE2B_KEYBYTES) {
return -1;
}
if (keylen > 0 && key == NULL) {
return -1;
}

@ -30,7 +30,11 @@ int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size
return -1;
}
if (NULL == key || keylen > BLAKE2S_KEYBYTES) {
if (NULL != key && keylen > BLAKE2B_KEYBYTES) {
return -1;
}
if (keylen > 0 && key == NULL) {
return -1;
}
@ -181,7 +185,6 @@ int main( void )
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES );
if( 0 != memcmp( hash, blake2xs_keyed_kat[outlen-1], outlen ) )
{
goto fail;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff