From eac674402ff6d4b6de33495c94a597634abdd11e Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Sat, 15 Feb 2014 12:08:50 +0200 Subject: [PATCH] tests: Verify NtPasswordHash with different UTF-8 cases This adds a password that uses one, two, and three octet encoding for UTF-8 characters. The value is tested against a pre-configured hash to verify that utf8_to_ucs2() function works correctly. Signed-off-by: Jouni Malinen --- tests/hwsim/auth_serv/eap_user.conf | 2 ++ tests/hwsim/test_ap_eap.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/tests/hwsim/auth_serv/eap_user.conf b/tests/hwsim/auth_serv/eap_user.conf index 19bfe6523..edc111b7b 100644 --- a/tests/hwsim/auth_serv/eap_user.conf +++ b/tests/hwsim/auth_serv/eap_user.conf @@ -33,6 +33,8 @@ "mschap user" TTLS-MSCHAP "password" [2] "DOMAIN\mschapv2 user" TTLS-MSCHAPV2 hash:8846f7eaee8fb117ad06bdd830b7586c [2] "hs20-test" TTLS-MSCHAPV2 "password" [2] +"utf8-user" TTLS-MSCHAPV2 "secret-åäö-€-password" [2] +"utf8-user-hash" TTLS-MSCHAPV2 hash:bd5844fad2489992da7fe8c5a01559cf [2] "user" MSCHAPV2,MD5,GTC "password" [2] "cert user" TLS [2] diff --git a/tests/hwsim/test_ap_eap.py b/tests/hwsim/test_ap_eap.py index 563cb7f48..640e526a4 100644 --- a/tests/hwsim/test_ap_eap.py +++ b/tests/hwsim/test_ap_eap.py @@ -1,4 +1,5 @@ #!/usr/bin/python +# -*- coding: utf-8 -*- # # WPA2-Enterprise tests # Copyright (c) 2013-2014, Jouni Malinen @@ -231,6 +232,19 @@ def test_ap_wpa2_eap_ttls_mschapv2(dev, apdev): ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2", expect_failure=True) +def test_ap_wpa2_eap_ttls_mschapv2_utf8(dev, apdev): + """WPA2-Enterprise connection using EAP-TTLS/MSCHAPv2 and UTF-8 password""" + params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap") + hostapd.add_ap(apdev[0]['ifname'], params) + hapd = hostapd.Hostapd(apdev[0]['ifname']) + eap_connect(dev[0], apdev[0], "TTLS", "utf8-user-hash", + anonymous_identity="ttls", password="secret-åäö-€-password", + ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2") + eap_connect(dev[1], apdev[0], "TTLS", "utf8-user", + anonymous_identity="ttls", + password_hex="hash:bd5844fad2489992da7fe8c5a01559cf", + ca_cert="auth_serv/ca.pem", phase2="auth=MSCHAPV2") + def test_ap_wpa2_eap_ttls_eap_gtc(dev, apdev): """WPA2-Enterprise connection using EAP-TTLS/EAP-GTC""" params = hostapd.wpa2_eap_params(ssid="test-wpa2-eap")