From 5e04a82e5357ecff79757ab8d3380b4927c1582a Mon Sep 17 00:00:00 2001 From: Milan Broz Date: Fri, 12 Jul 2024 14:43:09 +0200 Subject: [PATCH] Fix wiping of hash struct in nss and nettle backend. --- lib/crypto_backend/crypto_nettle.c | 3 +-- lib/crypto_backend/crypto_nss.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lib/crypto_backend/crypto_nettle.c b/lib/crypto_backend/crypto_nettle.c index e31cedc66..36a9d05e1 100644 --- a/lib/crypto_backend/crypto_nettle.c +++ b/lib/crypto_backend/crypto_nettle.c @@ -284,8 +284,7 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name, h = malloc(sizeof(*h)); if (!h) return -ENOMEM; - memset(ctx, 0, sizeof(*ctx)); - + memset(h, 0, sizeof(*h)); h->hash = _get_alg(name); if (!h->hash) { diff --git a/lib/crypto_backend/crypto_nss.c b/lib/crypto_backend/crypto_nss.c index f07a1dda7..0c05da116 100644 --- a/lib/crypto_backend/crypto_nss.c +++ b/lib/crypto_backend/crypto_nss.c @@ -207,8 +207,7 @@ int crypt_hmac_init(struct crypt_hmac **ctx, const char *name, h = malloc(sizeof(*h)); if (!h) return -ENOMEM; - memset(ctx, 0, sizeof(*ctx)); - + memset(h, 0, sizeof(*h)); h->hash = _get_alg(name); if (!h->hash)