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:
Diffstat (limited to 'sse/blake2bp.c')
-rw-r--r--sse/blake2bp.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/sse/blake2bp.c b/sse/blake2bp.c
index 489af81..1996cc4 100644
--- a/sse/blake2bp.c
+++ b/sse/blake2bp.c
@@ -1,14 +1,14 @@
/*
BLAKE2 reference source code package - optimized C implementations
-
+
Copyright 2012, Samuel Neves <sneves@dei.uc.pt>. You may use this under the
terms of the CC0, the OpenSSL Licence, or the Apache Public License 2.0, at
your option. The terms of these licenses can be found at:
-
+
- CC0 1.0 Universal : http://creativecommons.org/publicdomain/zero/1.0
- OpenSSL license : https://www.openssl.org/source/license.html
- Apache 2.0 : http://www.apache.org/licenses/LICENSE-2.0
-
+
More information about the BLAKE2 hash function can be found at
https://blake2.net.
*/
@@ -27,6 +27,20 @@
#define PARALLELISM_DEGREE 4
+/*
+ blake2b_init_param defaults to setting the expecting output length
+ from the digest_length parameter block field.
+
+ In some cases, however, we do not want this, as the output length
+ of these instances is given by inner_length instead.
+*/
+static int blake2bp_init_leaf_param( blake2b_state *S, const blake2b_param *P )
+{
+ int err = blake2b_init_param(S, P);
+ S->outlen = P->inner_length;
+ return err;
+}
+
static int blake2bp_init_leaf( blake2b_state *S, size_t outlen, size_t keylen, uint64_t offset )
{
blake2b_param P[1];
@@ -42,7 +56,7 @@ static int blake2bp_init_leaf( blake2b_state *S, size_t outlen, size_t keylen, u
memset( P->reserved, 0, sizeof( P->reserved ) );
memset( P->salt, 0, sizeof( P->salt ) );
memset( P->personal, 0, sizeof( P->personal ) );
- return blake2b_init_param( S, P );
+ return blake2bp_init_leaf_param( S, P );
}
static int blake2bp_init_root( blake2b_state *S, size_t outlen, size_t keylen )