aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant
diff options
context:
space:
mode:
authorAndriy Tkachuk <andriy.v.tkachuk@globallogic.com>2009-02-18 17:58:44 (GMT)
committerJouni Malinen <j@w1.fi>2009-02-27 10:33:31 (GMT)
commite17fc73d2331cb7d528645c8b5fce4cb839615ad (patch)
tree3c1c8e19799e1e432ba265b255bde16b3c445928 /wpa_supplicant
parente26a5ddfb68243b50aaf6e4a636733b531124e10 (diff)
downloadhostap-06-e17fc73d2331cb7d528645c8b5fce4cb839615ad.zip
hostap-06-e17fc73d2331cb7d528645c8b5fce4cb839615ad.tar.gz
hostap-06-e17fc73d2331cb7d528645c8b5fce4cb839615ad.tar.bz2
WPS: Fix WEP key index to use 1..4 instead of 0..3
It seems that WFA WPS spec says that default key index should be 1 (not 0). I think this meas that WEP key indexes region is not from 0 to 3, but from 1 to 4 in WPS. At least WRT610N implemented it this way. (cherry picked from commit 522b5b6ed344ae40755f2d4e42fdc0409371884f)
Diffstat (limited to 'wpa_supplicant')
-rw-r--r--wpa_supplicant/wps_supplicant.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/wpa_supplicant/wps_supplicant.c b/wpa_supplicant/wps_supplicant.c
index 8ca684f..c2c1dd0 100644
--- a/wpa_supplicant/wps_supplicant.c
+++ b/wpa_supplicant/wps_supplicant.c
@@ -88,7 +88,7 @@ static int wpa_supplicant_wps_cred(void *ctx,
{
struct wpa_supplicant *wpa_s = ctx;
struct wpa_ssid *ssid = wpa_s->current_ssid;
- u8 key_idx;
+ u8 key_idx = 0;
if ((wpa_s->conf->wps_cred_processing == 1 ||
wpa_s->conf->wps_cred_processing == 2) && cred->cred_attr) {
@@ -160,12 +160,13 @@ static int wpa_supplicant_wps_cred(void *ctx,
"%lu", (unsigned long) cred->key_len);
return -1;
}
- if (cred->key_idx >= NUM_WEP_KEYS) {
+ if (cred->key_idx > NUM_WEP_KEYS) {
wpa_printf(MSG_ERROR, "WPS: Invalid WEP Key index %d",
cred->key_idx);
return -1;
}
- key_idx = cred->key_idx;
+ if (cred->key_idx)
+ key_idx = cred->key_idx - 1;
if (cred->key_len == 10 || cred->key_len == 26) {
if (hexstr2bin((char *) cred->key,
ssid->wep_key[key_idx],