diff options
author | JP Aumasson <jeanphilippe.aumasson@gmail.com> | 2015-10-15 00:03:14 +0300 |
---|---|---|
committer | JP Aumasson <jeanphilippe.aumasson@gmail.com> | 2015-10-15 00:03:14 +0300 |
commit | a18d2b03fb0df1458c447d488816b51b1164c006 (patch) | |
tree | aa030f2a137db4c51ccc83f0aa0b2aeb606a2eb9 /sse/blake2bp.c | |
parent | 7d657211ab04ff404e050e12aa01db43a3773e66 (diff) |
consistent checks
Diffstat (limited to 'sse/blake2bp.c')
-rw-r--r-- | sse/blake2bp.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sse/blake2bp.c b/sse/blake2bp.c index d93784c..5734515 100644 --- a/sse/blake2bp.c +++ b/sse/blake2bp.c @@ -191,11 +191,15 @@ int blake2bp( uint8_t *out, const void *in, const void *key, uint8_t outlen, uin blake2b_state FS[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; for( size_t i = 0; i < PARALLELISM_DEGREE; ++i ) if( blake2bp_init_leaf( S[i], outlen, keylen, i ) < 0 ) return -1; |