The function `ossl_blake2b_param_init` should initialise only, and not
read the data it is initialising
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/22282)
static int ossl_blake2b512_init(void *ctx)
{
struct blake2b_md_data_st *mdctx = ctx;
+ uint8_t digest_length = mdctx->params.digest_length;
ossl_blake2b_param_init(&mdctx->params);
+ if (digest_length != 0)
+ mdctx->params.digest_length = digest_length;
return ossl_blake2b_init(&mdctx->ctx, &mdctx->params);
}
/* Initialize the parameter block with default values */
void ossl_blake2b_param_init(BLAKE2B_PARAM *P)
{
- if (P->digest_length == 0)
- P->digest_length = BLAKE2B_DIGEST_LENGTH;
+ P->digest_length = BLAKE2B_DIGEST_LENGTH;
P->key_length = 0;
P->fanout = 1;
P->depth = 1;