aboutsummaryrefslogtreecommitdiffstats
path: root/libblake_blake2b_digest.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-01-08 10:13:28 +0100
committerMattias Andrée <maandree@kth.se>2022-01-08 10:13:28 +0100
commitfb527a8eb943bf7efdf6dc858c9fd88a3fcdbd19 (patch)
treeadb5310a9cceaf24b460db710f350671c55c8995 /libblake_blake2b_digest.c
parentm (diff)
downloadlibblake-fb527a8eb943bf7efdf6dc858c9fd88a3fcdbd19.tar.gz
libblake-fb527a8eb943bf7efdf6dc858c9fd88a3fcdbd19.tar.bz2
libblake-fb527a8eb943bf7efdf6dc858c9fd88a3fcdbd19.tar.xz
Add last_node parameter to libblake_blake2[sb]_digest
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libblake_blake2b_digest.c')
-rw-r--r--libblake_blake2b_digest.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libblake_blake2b_digest.c b/libblake_blake2b_digest.c
index f1e45a8..016282d 100644
--- a/libblake_blake2b_digest.c
+++ b/libblake_blake2b_digest.c
@@ -35,7 +35,7 @@ encode_uint64_le(unsigned char *out, uint_least64_t value, size_t bytes)
}
void
-libblake_blake2b_digest(struct libblake_blake2b_state *state, void *data_, size_t len,
+libblake_blake2b_digest(struct libblake_blake2b_state *state, void *data_, size_t len, int last_node,
size_t output_len, unsigned char output[static output_len])
{
unsigned char *data = data_;
@@ -46,6 +46,9 @@ libblake_blake2b_digest(struct libblake_blake2b_state *state, void *data_, size_
len -= r;
state->f[0] = UINT_LEAST64_C(0xFFFFffffFFFFffff);
+ if (last_node)
+ state->f[1] = UINT_LEAST64_C(0xFFFFffffFFFFffff);
+
memset(&data[len], 0, 128 - len);
state->t[0] = (state->t[0] + len) & UINT_LEAST64_C(0xFFFFffffFFFFffff);