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-10-11 18:18:48 +0300
committerSamuel Neves <sneves@dei.uc.pt>2016-10-11 18:18:48 +0300
commit73bd0dc6529657b972cdd00b16bfe7d788d73f8c (patch)
tree1fd58091c143d10ac6b69a89543fa8378f613cc6
parent1dd635899748e2c28cba606fe0841cf36ab8bbed (diff)
length bug
-rw-r--r--ref/blake2xs-ref.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ref/blake2xs-ref.c b/ref/blake2xs-ref.c
index bd6ad2b..33708d2 100644
--- a/ref/blake2xs-ref.c
+++ b/ref/blake2xs-ref.c
@@ -93,11 +93,12 @@ int blake2xs_final(blake2xs_state *S, void *out, size_t outlen)
for (i = 0; outlen > 0; ++i) {
const size_t block_size = (outlen < BLAKE2S_OUTBYTES) ? outlen : BLAKE2S_OUTBYTES;
/* Initialize state */
+ P->digest_length = block_size;
store32(&P->node_offset, i);
blake2s_init_param(C, P);
/* Process key if needed */
blake2s_update(C, root, BLAKE2S_OUTBYTES);
- blake2s_final(C, (uint8_t *)out + i * BLAKE2S_OUTBYTES, BLAKE2S_OUTBYTES);
+ blake2s_final(C, (uint8_t *)out + i * BLAKE2S_OUTBYTES, block_size);
outlen -= block_size;
}
secure_zero_memory(root, sizeof(root));
@@ -132,12 +133,12 @@ int blake2xs(void *out, size_t outlen, const void *in, size_t inlen, const void
return -1;
}
- /* Compute the root of the tree */
+ /* Absorb the input message */
if (blake2xs_update(S, in, inlen) < 0) {
return -1;
}
- /* Compute the final hash using the counter construction */
+ /* Compute the root node of the tree and the final hash using the counter construction */
return blake2xs_final(S, out, outlen);
}