]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
EAP-MD5: Verify that CHAP operation succeeds
authorJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 15:49:02 +0000 (18:49 +0300)
committerJouni Malinen <j@w1.fi>
Thu, 16 Aug 2012 15:49:02 +0000 (18:49 +0300)
The MD5 operation may be disabled in the security policy so chap_md5()
call can fail.

Signed-hostap: Jouni Malinen <j@w1.fi>

src/eap_peer/eap_md5.c
src/eap_server/eap_server_md5.c

index e3484151c3bf578b6bcb01246273ed7bea43af57..d06befaeb1df5b9cdcccf69693dcb01dbcd22025 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * EAP peer method: EAP-MD5 (RFC 3748 and RFC 1994)
- * Copyright (c) 2004-2006, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -86,7 +86,13 @@ static struct wpabuf * eap_md5_process(struct eap_sm *sm, void *priv,
 
        id = eap_get_id(resp);
        rpos = wpabuf_put(resp, CHAP_MD5_LEN);
-       chap_md5(id, password, password_len, challenge, challenge_len, rpos);
+       if (chap_md5(id, password, password_len, challenge, challenge_len,
+                    rpos)) {
+               wpa_printf(MSG_INFO, "EAP-MD5: CHAP MD5 operation failed");
+               ret->ignore = TRUE;
+               wpabuf_free(resp);
+               return NULL;
+       }
        wpa_hexdump(MSG_MSGDUMP, "EAP-MD5: Response", rpos, CHAP_MD5_LEN);
 
        return resp;
index f4bb2610108e55a6966b7b9a61d29e4d1bdfa4c7..5a5e2907efd629d9aa8cf603e088aa76cfc50442 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * hostapd / EAP-MD5 server
- * Copyright (c) 2004-2007, Jouni Malinen <j@w1.fi>
+ * Copyright (c) 2004-2012, Jouni Malinen <j@w1.fi>
  *
  * This software may be distributed under the terms of the BSD license.
  * See README for more details.
@@ -119,8 +119,12 @@ static void eap_md5_process(struct eap_sm *sm, void *priv,
        wpa_hexdump(MSG_MSGDUMP, "EAP-MD5: Response", pos, CHAP_MD5_LEN);
 
        id = eap_get_id(respData);
-       chap_md5(id, sm->user->password, sm->user->password_len,
-                data->challenge, CHALLENGE_LEN, hash);
+       if (chap_md5(id, sm->user->password, sm->user->password_len,
+                    data->challenge, CHALLENGE_LEN, hash)) {
+               wpa_printf(MSG_INFO, "EAP-MD5: CHAP MD5 operation failed");
+               data->state = FAILURE;
+               return;
+       }
 
        if (os_memcmp(hash, pos, CHAP_MD5_LEN) == 0) {
                wpa_printf(MSG_DEBUG, "EAP-MD5: Done - Success");