EAP-IKEv2: Use os_memcmp_const() for hash/password comparisons
This makes the implementation less likely to provide useful timing information to potential attackers from comparisons of information received from a remote device and private material known only by the authorized devices. Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
2049a3c874
commit
675ddad1c2
4 changed files with 4 additions and 4 deletions
|
@ -100,7 +100,7 @@ int eap_ikev2_validate_icv(int integ_alg, struct ikev2_keys *keys,
|
|||
return -1;
|
||||
}
|
||||
|
||||
if (os_memcmp(icv, end - icv_len, icv_len) != 0) {
|
||||
if (os_memcmp_const(icv, end - icv_len, icv_len) != 0) {
|
||||
wpa_printf(MSG_INFO, "EAP-IKEV2: Invalid ICV");
|
||||
wpa_hexdump(MSG_DEBUG, "EAP-IKEV2: Calculated ICV",
|
||||
icv, icv_len);
|
||||
|
|
|
@ -477,7 +477,7 @@ u8 * ikev2_decrypt_payload(int encr_id, int integ_id,
|
|||
"hash");
|
||||
return NULL;
|
||||
}
|
||||
if (os_memcmp(integ, hash, integ_alg->hash_len) != 0) {
|
||||
if (os_memcmp_const(integ, hash, integ_alg->hash_len) != 0) {
|
||||
wpa_printf(MSG_INFO, "IKEV2: Incorrect Integrity Checksum "
|
||||
"Data");
|
||||
return NULL;
|
||||
|
|
|
@ -565,7 +565,7 @@ static int ikev2_process_auth_secret(struct ikev2_responder_data *data,
|
|||
return -1;
|
||||
|
||||
if (auth_len != prf->hash_len ||
|
||||
os_memcmp(auth, auth_data, auth_len) != 0) {
|
||||
os_memcmp_const(auth, auth_data, auth_len) != 0) {
|
||||
wpa_printf(MSG_INFO, "IKEV2: Invalid Authentication Data");
|
||||
wpa_hexdump(MSG_DEBUG, "IKEV2: Received Authentication Data",
|
||||
auth, auth_len);
|
||||
|
|
|
@ -633,7 +633,7 @@ static int ikev2_process_auth_secret(struct ikev2_initiator_data *data,
|
|||
return -1;
|
||||
|
||||
if (auth_len != prf->hash_len ||
|
||||
os_memcmp(auth, auth_data, auth_len) != 0) {
|
||||
os_memcmp_const(auth, auth_data, auth_len) != 0) {
|
||||
wpa_printf(MSG_INFO, "IKEV2: Invalid Authentication Data");
|
||||
wpa_hexdump(MSG_DEBUG, "IKEV2: Received Authentication Data",
|
||||
auth, auth_len);
|
||||
|
|
Loading…
Reference in a new issue