crypto: aead,cipher - zeroize key buffer after use

[ Upstream commit 23e4099bdc3c8381992f9eb975c79196d6755210 ]

I.G 9.7.B for FIPS 140-3 specifies that variables temporarily holding
cryptographic information should be zeroized once they are no longer
needed. Accomplish this by using kfree_sensitive for buffers that
previously held the private key.

BUG=b/356586505
TEST=presubmit
RELEASE_NOTE=Fixed CVE-2024-42229 in linux-kernel.

cos-patch: security-high
Signed-off-by: Hailey Mothershead <hailmo@amazon.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Change-Id: I9af38a30e571aaa9f631d95781114d59ed5daed7
Reviewed-on: https://cos-review.googlesource.com/c/third_party/kernel/+/78122
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Oleksandr Tymoshenko <ovt@google.com>
Reviewed-by: Kevin Berry <kpberry@google.com>
2 files changed