Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/BLAKE2/BLAKE2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJP Aumasson <jeanphilippe.aumasson@gmail.com>2015-10-15 00:03:14 +0300
committerJP Aumasson <jeanphilippe.aumasson@gmail.com>2015-10-15 00:03:14 +0300
commita18d2b03fb0df1458c447d488816b51b1164c006 (patch)
treeaa030f2a137db4c51ccc83f0aa0b2aeb606a2eb9 /sse/blake2s.c
parent7d657211ab04ff404e050e12aa01db43a3773e66 (diff)
consistent checks
Diffstat (limited to 'sse/blake2s.c')
-rw-r--r--sse/blake2s.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sse/blake2s.c b/sse/blake2s.c
index 1731b7d..acb0f5a 100644
--- a/sse/blake2s.c
+++ b/sse/blake2s.c
@@ -357,11 +357,15 @@ int blake2s( uint8_t *out, const void *in, const void *key, const uint8_t outlen
blake2s_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; /* Fail here instead if keylen != 0 and key == NULL? */
+ if ( NULL == key && keylen > 0) return -1;
+
+ if( !outlen || outlen > BLAKE2S_OUTBYTES ) return -1;
+
+ if( keylen > BLAKE2S_KEYBYTES ) return -1;
if( keylen > 0 )
{