cleanse stack variable in blake2[b|s] finalization
authorNeil Horman <nhorman@openssl.org>
Mon, 1 Jan 2024 14:25:03 +0000 (09:25 -0500)
committerNeil Horman <nhorman@openssl.org>
Wed, 3 Jan 2024 17:56:28 +0000 (12:56 -0500)
commit58013938ff0ffc2df1c5d89e7b28a25bd4f741b4
treeb5e2763be042d496406cbe1138267d7a504d991f
parent0b36386633b8b875de74313abe91ac1c48a06a8e
cleanse stack variable in blake2[b|s] finalization

If the output of a blake2[b|s] digest isn't a multipl of 8, then a stack
buffer is used to compute the final output, which is left un-zeroed
prior to return, allowing the potential leak of key data.  Ensure that,
if the stack variable is used, it gets cleared prior to return.

Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/23173)

(cherry picked from commit 8b9cf1bc2c3085b6e9493a057209ffd0bddf48a6)
providers/implementations/digests/blake2b_prov.c
providers/implementations/digests/blake2s_prov.c