memzero() the state if we call generichash_final() twice

This commit is contained in:
Frank Denis 2017-07-18 19:19:04 +02:00
parent 6768d82ea2
commit 1090fcfd4d

View File

@ -359,6 +359,7 @@ blake2b_final(blake2b_state *S, uint8_t *out, uint8_t outlen)
sodium_misuse("blake2b_final(): unsupported output length"); sodium_misuse("blake2b_final(): unsupported output length");
} }
if (blake2b_is_lastblock(S)) { if (blake2b_is_lastblock(S)) {
sodium_memzero(S, sizeof *S);
return -1; return -1;
} }
if (S->buflen > BLAKE2B_BLOCKBYTES) { if (S->buflen > BLAKE2B_BLOCKBYTES) {