mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-22 14:49:24 +01:00
eapol: Use constant-time comparison
This closes the possibility of a timing attack against PMKIDs.
This commit is contained in:
parent
2a37dba4bf
commit
7436cef012
@ -1142,7 +1142,8 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
|
|||||||
goto error_unspecified;
|
goto error_unspecified;
|
||||||
|
|
||||||
for (i = 0; i < rsn_info.num_pmkids; i++)
|
for (i = 0; i < rsn_info.num_pmkids; i++)
|
||||||
if (!memcmp(rsn_info.pmkids + i * 16, pmkid, 16)) {
|
if (!l_secure_memcmp(rsn_info.pmkids + i * 16,
|
||||||
|
pmkid, 16)) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1155,7 +1156,7 @@ static void eapol_handle_ptk_1_of_4(struct eapol_sm *sm,
|
|||||||
if (!handshake_state_get_pmkid(sm->handshake, own_pmkid))
|
if (!handshake_state_get_pmkid(sm->handshake, own_pmkid))
|
||||||
goto error_unspecified;
|
goto error_unspecified;
|
||||||
|
|
||||||
if (memcmp(pmkid, own_pmkid, 16)) {
|
if (l_secure_memcmp(pmkid, own_pmkid, 16)) {
|
||||||
l_debug("Authenticator sent a PMKID that didn't match");
|
l_debug("Authenticator sent a PMKID that didn't match");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
Loading…
Reference in New Issue
Block a user