]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Clear temporary results from stack in PBKDF2-SHA1
authorJouni Malinen <quic_jouni@quicinc.com>
Sat, 26 Feb 2022 08:58:15 +0000 (10:58 +0200)
committerJouni Malinen <j@w1.fi>
Sat, 26 Feb 2022 17:12:11 +0000 (19:12 +0200)
Force stack memory to be cleared of temporary values that might contain
keying material.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/crypto/sha1-pbkdf2.c

index 8effe2fe063a865c39bb144ac79768b0d028a7db..d2bdc95e5c98fd98e5e322e242f2d2edf2488f0e 100644 (file)
@@ -50,6 +50,8 @@ static int pbkdf2_sha1_f(const char *passphrase, const u8 *ssid,
                for (j = 0; j < SHA1_MAC_LEN; j++)
                        digest[j] ^= tmp2[j];
        }
+       forced_memzero(tmp, SHA1_MAC_LEN);
+       forced_memzero(tmp2, SHA1_MAC_LEN);
 
        return 0;
 }
@@ -87,6 +89,7 @@ int pbkdf2_sha1(const char *passphrase, const u8 *ssid, size_t ssid_len,
                pos += plen;
                left -= plen;
        }
+       forced_memzero(digest, SHA1_MAC_LEN);
 
        return 0;
 }