]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-MSCHAPv2: Use os_memcmp_const() for hash/password comparisons
authorJouni Malinen <j@w1.fi>
Sun, 29 Jun 2014 17:25:36 +0000 (20:25 +0300)
committerJouni Malinen <j@w1.fi>
Wed, 2 Jul 2014 09:38:48 +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/mschapv2.c
src/eap_server/eap_server_mschapv2.c

index 37e6735efb34dc5fd5ca2a9a4f7a7e459f1bb5d4..9bc737076b9b94105b99c6677cc0c74acad960db 100644 (file)
@@ -117,8 +117,8 @@ int mschapv2_verify_auth_response(const u8 *auth_response,
            buf[0] != 'S' || buf[1] != '=' ||
            hexstr2bin((char *) (buf + 2), recv_response,
                       MSCHAPV2_AUTH_RESPONSE_LEN) ||
-           os_memcmp(auth_response, recv_response,
-                     MSCHAPV2_AUTH_RESPONSE_LEN) != 0)
+           os_memcmp_const(auth_response, recv_response,
+                           MSCHAPV2_AUTH_RESPONSE_LEN) != 0)
                return -1;
        return 0;
 }
index 0eb7908f30f806c7b14b66de6066fa383afadadb..68e6394c51f063037f24abacfd2a02857bbc5cd6 100644 (file)
@@ -393,7 +393,7 @@ static void eap_mschapv2_process_response(struct eap_sm *sm,
                return;
        }
 
-       if (os_memcmp(nt_response, expected, 24) == 0) {
+       if (os_memcmp_const(nt_response, expected, 24) == 0) {
                const u8 *pw_hash;
                u8 pw_hash_buf[16], pw_hash_hash[16];