]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
cleanse stack variable in kdf_pbkdf1_do_derive
authorNeil Horman <nhorman@openssl.org>
Wed, 3 Jan 2024 18:47:05 +0000 (13:47 -0500)
committerNeil Horman <nhorman@openssl.org>
Fri, 5 Jan 2024 19:41:04 +0000 (14:41 -0500)
kdf_pbkdf1_do_derive stores key derivation information in a stack
variable, which is left uncleansed prior to returning.  Ensure that the
stack information is zeroed prior to return to avoid potential leaks of
key information

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

(cherry picked from commit 5963aa8c196d7c5a940a979299a07418527932af)

providers/implementations/kdfs/pbkdf1.c

index b560598ded8acbfdd139a15f32acd2e1524abbab..3ed771aa8f4a93519f49413d085661d6330e45a0 100644 (file)
@@ -88,6 +88,7 @@ static int kdf_pbkdf1_do_derive(const unsigned char *pass, size_t passlen,
     memcpy(out, md_tmp, n);
     ret = 1;
 err:
+    OPENSSL_cleanse(md_tmp, EVP_MAX_MD_SIZE);
     EVP_MD_CTX_free(ctx);
     return ret;
 }