1
0
Fork 0
mirror of https://github.com/BLAKE3-team/BLAKE3 synced 2024-05-13 03:16:11 +02:00

Fix expected zeroes at output

When buffer sizes are small in streaming mode the partial output
must have the rest of the buffer filled with zeroes.

Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
This commit is contained in:
Pantelis Antoniou 2023-09-12 11:08:43 +03:00
parent b8ef7c2441
commit 7973cc5a37

View File

@ -64,7 +64,9 @@ INLINE output_t make_output(const uint32_t input_cv[8],
uint8_t flags) {
output_t ret;
memcpy(ret.input_cv, input_cv, 32);
memcpy(ret.block, block, BLAKE3_BLOCK_LEN);
// copy out what's there and fill the rest with zeroes
memcpy(ret.block, block, block_len);
memset(ret.block + block_len, 0, BLAKE3_BLOCK_LEN - block_len);
ret.block_len = block_len;
ret.counter = counter;
ret.flags = flags;