mirror of
https://github.com/BLAKE2/BLAKE2
synced 2024-11-08 14:59:19 +01:00
bug in key-less b2x
This commit is contained in:
parent
c44e34b3a5
commit
1f26297f81
@ -30,7 +30,11 @@ int blake2xb_init( blake2xb_state *S, const size_t outlen, const void *key, size
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == key || keylen > BLAKE2B_KEYBYTES) {
|
if (NULL != key && keylen > BLAKE2B_KEYBYTES) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keylen > 0 && key == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,11 @@ int blake2xs_init( blake2xs_state *S, const size_t outlen, const void *key, size
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NULL == key || keylen > BLAKE2S_KEYBYTES) {
|
if (NULL != key && keylen > BLAKE2B_KEYBYTES) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (keylen > 0 && key == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,7 +185,6 @@ int main( void )
|
|||||||
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
|
uint8_t hash[BLAKE2_KAT_LENGTH] = {0};
|
||||||
blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES );
|
blake2xs( hash, outlen, buf, BLAKE2_KAT_LENGTH, key, BLAKE2S_KEYBYTES );
|
||||||
|
|
||||||
|
|
||||||
if( 0 != memcmp( hash, blake2xs_keyed_kat[outlen-1], outlen ) )
|
if( 0 != memcmp( hash, blake2xs_keyed_kat[outlen-1], outlen ) )
|
||||||
{
|
{
|
||||||
goto fail;
|
goto fail;
|
||||||
|
20174
testvectors/blake2-kat.h
20174
testvectors/blake2-kat.h
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user