Blake2b: refuse a NULL key with a length > 0

This commit is contained in:
Frank Denis 2015-10-18 00:27:03 +02:00
parent eeb31af578
commit f01c303631
2 changed files with 7 additions and 3 deletions

View File

@ -418,11 +418,15 @@ int blake2b( uint8_t *out, const void *in, const void *key, const uint8_t outlen
blake2b_state S[1];
/* Verify parameters */
if ( NULL == in ) return -1;
if ( NULL == in && inlen > 0 ) return -1;
if ( NULL == out ) return -1;
if( NULL == key ) keylen = 0;
if( NULL == key && keylen > 0 ) return -1;
if( !outlen || outlen > BLAKE2B_OUTBYTES ) return -1;
if( keylen > BLAKE2B_KEYBYTES ) return -1;
if( keylen > 0 )
{

View File

@ -63,4 +63,4 @@ cc66a891768e95a2717b040c111996f14942f10f2475c33aa5f1c97476e6f8386733d6b21c16102d
bdd3d0fafe8ba2b29d1ac0b79aa46e249cc9d3a82d0f772d690637bbdd353722356658d00436ff5dd5239ab747979329345eb8c7ed11b7331456ae87350fcf
bd965bf31e87d70327536f2a341cebc4768eca275fa05ef98f7f1b71a0351298de006fba73fe6733ed01d75801b4a928e54231b38e38c562b2e33ea1284992fa
2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052
2fc6e69fa26a89a5ed269092cb9b2a449a4409a7a44011eecad13d7c4b0456602d402fa5844f1a7a758136ce3d5d8d0e8b86921ffff4f692dd95bdc8e5ff0052
00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000