aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2009-01-24 10:50:00 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-08 10:19:43 (GMT)
commit5425ff49176cf75b0fa980e2eb3f630a49753751 (patch)
treecb3cdfd5ce147ac6fa8aa7f65d6d5ba5ef020813 /src
parent63dd43ac94f4ae2513c17d9a9fbe9bd2b9510d27 (diff)
downloadhostap-06-5425ff49176cf75b0fa980e2eb3f630a49753751.zip
hostap-06-5425ff49176cf75b0fa980e2eb3f630a49753751.tar.gz
hostap-06-5425ff49176cf75b0fa980e2eb3f630a49753751.tar.bz2
WPS: Add a workaround for incorrect passphrase encoding in Network Key
External Registrar in Vista may include NULL termination in the Network Key when encoding an ASCII passphrase for WPA/WPA2-PSK. As a workaround, remove this extra octet if present. (cherry picked from commit 1a5a04c3de054dab90d0604256e540778ddbf099)
Diffstat (limited to 'src')
-rw-r--r--src/wps/wps_attr_process.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/wps/wps_attr_process.c b/src/wps/wps_attr_process.c
index c1b59f7..ae6e906 100644
--- a/src/wps/wps_attr_process.c
+++ b/src/wps/wps_attr_process.c
@@ -257,6 +257,23 @@ static int wps_process_cred_802_1x_enabled(struct wps_credential *cred,
}
+static void wps_workaround_cred_key(struct wps_credential *cred)
+{
+ if (cred->auth_type & (WPS_AUTH_WPAPSK | WPS_AUTH_WPA2PSK) &&
+ cred->key_len > 8 && cred->key_len < 64 &&
+ cred->key[cred->key_len - 1] == 0) {
+ /*
+ * A deployed external registrar is known to encode ASCII
+ * passphrases incorrectly. Remove the extra NULL termination
+ * to fix the encoding.
+ */
+ wpa_printf(MSG_DEBUG, "WPS: Workaround - remove NULL "
+ "termination from ASCII passphrase");
+ cred->key_len--;
+ }
+}
+
+
int wps_process_cred(struct wps_parse_attr *attr,
struct wps_credential *cred)
{
@@ -279,6 +296,8 @@ int wps_process_cred(struct wps_parse_attr *attr,
wps_process_cred_802_1x_enabled(cred, attr->dot1x_enabled))
return -1;
+ wps_workaround_cred_key(cred);
+
return 0;
}
@@ -298,5 +317,7 @@ int wps_process_ap_settings(struct wps_parse_attr *attr,
wps_process_cred_mac_addr(cred, attr->mac_addr))
return -1;
+ wps_workaround_cred_key(cred);
+
return 0;
}