]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-PSK: Use os_memcmp_const() for hash/password comparisons
authorJouni Malinen <j@w1.fi>
Sun, 29 Jun 2014 17:24:10 +0000 (20:24 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 2 Jul 2014 09:38:47 +0000 (12:38 +0300)
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>
src/eap_peer/eap_psk.c
src/eap_server/eap_server_psk.c

index cd0e3f9666624cffcb47b7041177d039aca37595..fc2a1b9093d796503d5ae40629ed2e6289f82c2d 100644 (file)
@@ -237,7 +237,7 @@ static struct wpabuf * eap_psk_process_3(struct eap_psk_data *data,
                return NULL;
        }
        os_free(buf);
-       if (os_memcmp(mac, hdr3->mac_s, EAP_PSK_MAC_LEN) != 0) {
+       if (os_memcmp_const(mac, hdr3->mac_s, EAP_PSK_MAC_LEN) != 0) {
                wpa_printf(MSG_WARNING, "EAP-PSK: Invalid MAC_S in third "
                           "message");
                ret->methodState = METHOD_DONE;
index 46bedd94bb30cd5463066ebdce4cfaada6509d39..2cff49368a82018241580d2d69aa2a23d0dc59f8 100644 (file)
@@ -314,7 +314,7 @@ static void eap_psk_process_2(struct eap_sm *sm,
        }
        os_free(buf);
        wpa_hexdump(MSG_DEBUG, "EAP-PSK: MAC_P", resp->mac_p, EAP_PSK_MAC_LEN);
-       if (os_memcmp(mac, resp->mac_p, EAP_PSK_MAC_LEN) != 0) {
+       if (os_memcmp_const(mac, resp->mac_p, EAP_PSK_MAC_LEN) != 0) {
                wpa_printf(MSG_INFO, "EAP-PSK: Invalid MAC_P");
                wpa_hexdump(MSG_MSGDUMP, "EAP-PSK: Expected MAC_P",
                            mac, EAP_PSK_MAC_LEN);