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
path: root/ref
diff options
context:
space:
mode:
authorJP Aumasson <jeanphilippe.aumasson@gmail.com>2016-10-12 19:05:37 +0300
committerJP Aumasson <jeanphilippe.aumasson@gmail.com>2016-10-12 19:05:37 +0300
commit2a22fad50080c133aa41b3a54290d80d01f54cd1 (patch)
tree44f199ac8f87f91a7fd7c7ece828f48251790aaf /ref
parentc19dd2bd835ae98d8f40e7d712042476b4ad1ccf (diff)
check final return value
Diffstat (limited to 'ref')
-rw-r--r--ref/blake2xb-ref.c8
-rw-r--r--ref/blake2xs-ref.c8
2 files changed, 8 insertions, 8 deletions
diff --git a/ref/blake2xb-ref.c b/ref/blake2xb-ref.c
index 9fc8860..640daf0 100644
--- a/ref/blake2xb-ref.c
+++ b/ref/blake2xb-ref.c
@@ -116,7 +116,9 @@ int blake2xb_final( blake2xb_state *S, void *out, size_t outlen) {
blake2b_init_param(C, P);
/* Process key if needed */
blake2b_update(C, root, BLAKE2B_OUTBYTES);
- blake2b_final(C, (uint8_t *)out + i * BLAKE2B_OUTBYTES, block_size);
+ if (blake2b_final(C, (uint8_t *)out + i * BLAKE2B_OUTBYTES, block_size) < 0 ) {
+ return -1;
+ }
outlen -= block_size;
}
secure_zero_memory(root, sizeof(root));
@@ -153,9 +155,7 @@ int blake2xb(void *out, size_t outlen, const void *in, size_t inlen, const void
}
/* Absorb the input message */
- if (blake2xb_update(S, in, inlen) < 0) {
- return -1;
- }
+ blake2xb_update(S, in, inlen);
/* Compute the root node of the tree and the final hash using the counter construction */
return blake2xb_final(S, out, outlen);
diff --git a/ref/blake2xs-ref.c b/ref/blake2xs-ref.c
index bcb56ed..b0799d0 100644
--- a/ref/blake2xs-ref.c
+++ b/ref/blake2xs-ref.c
@@ -115,7 +115,9 @@ int blake2xs_final(blake2xs_state *S, void *out, size_t outlen) {
blake2s_init_param(C, P);
/* Process key if needed */
blake2s_update(C, root, BLAKE2S_OUTBYTES);
- blake2s_final(C, (uint8_t *)out + i * BLAKE2S_OUTBYTES, block_size);
+ if (blake2s_final(C, (uint8_t *)out + i * BLAKE2S_OUTBYTES, block_size) < 0) {
+ return -1;
+ }
outlen -= block_size;
}
secure_zero_memory(root, sizeof(root));
@@ -151,9 +153,7 @@ int blake2xs(void *out, size_t outlen, const void *in, size_t inlen, const void
}
/* Absorb the input message */
- if (blake2xs_update(S, in, inlen) < 0) {
- return -1;
- }
+ blake2xs_update(S, in, inlen);
/* Compute the root node of the tree and the final hash using the counter construction */
return blake2xs_final(S, out, outlen);