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:
Diffstat (limited to 'sse/blake2b.c')
-rw-r--r--sse/blake2b.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/sse/blake2b.c b/sse/blake2b.c
index 2d4a17b..1eba735 100644
--- a/sse/blake2b.c
+++ b/sse/blake2b.c
@@ -79,6 +79,11 @@ static inline int blake2b_clear_lastnode( blake2b_state *S )
return 0;
}
+static inline int blake2b_is_lastblock( const blake2b_state *S )
+{
+ return S->f[0] != 0;
+}
+
static inline int blake2b_set_lastblock( blake2b_state *S )
{
if( S->last_node ) blake2b_set_lastnode( S );
@@ -355,6 +360,9 @@ int blake2b_final( blake2b_state *S, uint8_t *out, uint8_t outlen )
if( outlen > BLAKE2B_OUTBYTES )
return -1;
+ if( blake2b_is_lastblock( S ) )
+ return -1;
+
if( S->buflen > BLAKE2B_BLOCKBYTES )
{
blake2b_increment_counter( S, BLAKE2B_BLOCKBYTES );