3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-10-04 02:18:49 +02:00

eapol,handshake: Memzero copies of secrets

This commit is contained in:
Andrew Zaborowski 2019-03-19 01:25:28 +01:00 committed by Denis Kenzior
parent c682847249
commit f76e10799f
2 changed files with 12 additions and 4 deletions

View File

@ -1247,9 +1247,10 @@ static void eapol_send_ptk_3_of_4(struct eapol_sm *sm)
}
kek = handshake_state_get_kek(sm->handshake);
key_data_len = eapol_encrypt_key_data(kek, key_data_buf,
key_data_len, ek, sm->mic_len);
key_data_len, ek, sm->mic_len);
explicit_bzero(key_data_buf, sizeof(key_data_buf));
if (key_data_len < 0)
return;
@ -1900,6 +1901,9 @@ static void eapol_key_handle(struct eapol_sm *sm,
}
done:
if (decrypted_key_data)
explicit_bzero(decrypted_key_data, key_data_len);
l_free(decrypted_key_data);
}

View File

@ -79,9 +79,13 @@ void handshake_state_free(struct handshake_state *s)
l_free(s->supplicant_ie);
l_free(s->mde);
l_free(s->fte);
l_free(s->passphrase);
memset(s, 0, sizeof(*s));
if (s->passphrase) {
explicit_bzero(s->passphrase, strlen(s->passphrase));
l_free(s->passphrase);
}
explicit_bzero(s, sizeof(*s));
if (destroy)
destroy(s);