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:
authorSamuel Neves <sneves@dei.uc.pt>2016-06-11 14:42:46 +0300
committerSamuel Neves <sneves@dei.uc.pt>2016-06-11 14:42:46 +0300
commit932be4e9f5c973a2aa49656447683fbfae4cfb39 (patch)
tree791d07b1bebe41b9567e73fed3d4cc4c6fef44a0 /ref/blake2s-ref.c
parent64cafcff1620ab778d23057e1c7559087d7bd4e6 (diff)
outlen in blake2xx_final should be the output buffer size, not the hash length
Diffstat (limited to 'ref/blake2s-ref.c')
-rw-r--r--ref/blake2s-ref.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ref/blake2s-ref.c b/ref/blake2s-ref.c
index 6dbcb2a..a278489 100644
--- a/ref/blake2s-ref.c
+++ b/ref/blake2s-ref.c
@@ -96,6 +96,7 @@ int blake2s_init_param( blake2s_state *S, const blake2s_param *P )
for( i = 0; i < 8; ++i )
S->h[i] ^= load32( &p[i * 4] );
+ S->outlen = P->digest_length;
return 0;
}
@@ -252,7 +253,7 @@ int blake2s_final( blake2s_state *S, void *out, size_t outlen )
uint8_t buffer[BLAKE2S_OUTBYTES] = {0};
size_t i;
- if( out == NULL || outlen == 0 || outlen > BLAKE2S_OUTBYTES )
+ if( out == NULL || outlen < S->outlen )
return -1;
if( blake2s_is_lastblock( S ) )