]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-PAX: Use os_memcmp_const() for hash/password comparisons
authorJouni Malinen <j@w1.fi>
Sun, 29 Jun 2014 17:21:31 +0000 (20:21 +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_pax.c
src/eap_server/eap_server_pax.c

index 7f870520712b23c60025d1c294c4c4a9e11e504a..f10a15b5aabd0667b59b49dd239031ef61bf5482 100644 (file)
@@ -278,7 +278,7 @@ static struct wpabuf * eap_pax_process_std_3(struct eap_pax_data *data,
        eap_pax_mac(data->mac_id, data->ck, EAP_PAX_CK_LEN,
                    data->rand.r.y, EAP_PAX_RAND_LEN,
                    (u8 *) data->cid, data->cid_len, NULL, 0, mac);
-       if (os_memcmp(pos, mac, EAP_PAX_MAC_LEN) != 0) {
+       if (os_memcmp_const(pos, mac, EAP_PAX_MAC_LEN) != 0) {
                wpa_printf(MSG_INFO, "EAP-PAX: Invalid MAC_CK(B, CID) "
                           "received");
                wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: expected MAC_CK(B, CID)",
@@ -415,7 +415,7 @@ static struct wpabuf * eap_pax_process(struct eap_sm *sm, void *priv,
                            wpabuf_head(reqData), mlen, NULL, 0, NULL, 0,
                            icvbuf);
        }
-       if (os_memcmp(icv, icvbuf, EAP_PAX_ICV_LEN) != 0) {
+       if (os_memcmp_const(icv, icvbuf, EAP_PAX_ICV_LEN) != 0) {
                wpa_printf(MSG_DEBUG, "EAP-PAX: invalid ICV - ignoring the "
                           "message");
                wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: expected ICV",
index 35a42ad107487a5b8618f3be6801efc624018e7a..d923cd7311686b8c3d8c1df14f2441a03596239a 100644 (file)
@@ -268,7 +268,7 @@ static Boolean eap_pax_check(struct eap_sm *sm, void *priv,
                            wpabuf_mhead(respData),
                            wpabuf_len(respData) - EAP_PAX_ICV_LEN,
                            NULL, 0, NULL, 0, icvbuf);
-               if (os_memcmp(icvbuf, icv, EAP_PAX_ICV_LEN) != 0) {
+               if (os_memcmp_const(icvbuf, icv, EAP_PAX_ICV_LEN) != 0) {
                        wpa_printf(MSG_INFO, "EAP-PAX: Invalid ICV");
                        wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: Expected ICV",
                                    icvbuf, EAP_PAX_ICV_LEN);
@@ -395,7 +395,7 @@ static void eap_pax_process_std_2(struct eap_sm *sm,
                    data->rand.r.x, EAP_PAX_RAND_LEN,
                    data->rand.r.y, EAP_PAX_RAND_LEN,
                    (u8 *) data->cid, data->cid_len, mac);
-       if (os_memcmp(mac, pos, EAP_PAX_MAC_LEN) != 0) {
+       if (os_memcmp_const(mac, pos, EAP_PAX_MAC_LEN) != 0) {
                wpa_printf(MSG_INFO, "EAP-PAX: Invalid MAC_CK(A, B, CID) in "
                           "PAX_STD-2");
                wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: Expected MAC_CK(A, B, CID)",
@@ -417,7 +417,7 @@ static void eap_pax_process_std_2(struct eap_sm *sm,
                    wpabuf_head(respData),
                    wpabuf_len(respData) - EAP_PAX_ICV_LEN, NULL, 0, NULL, 0,
                    icvbuf);
-       if (os_memcmp(icvbuf, pos, EAP_PAX_ICV_LEN) != 0) {
+       if (os_memcmp_const(icvbuf, pos, EAP_PAX_ICV_LEN) != 0) {
                wpa_printf(MSG_INFO, "EAP-PAX: Invalid ICV in PAX_STD-2");
                wpa_hexdump(MSG_MSGDUMP, "EAP-PAX: Expected ICV",
                            icvbuf, EAP_PAX_ICV_LEN);