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.
This commit is contained in:
Andriy Tkachuk 2009-02-18 19:58:44 +02:00 committed by Jouni Malinen
parent ab61c4fc36
commit 522b5b6ed3

View file

@ -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],