From d3cba719ffc4c9e004b9b3b09e3b0f9996573b05 Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Wed, 18 Feb 2009 20:17:47 +0200 Subject: [PATCH] WPS: Use WEP key index 1..4 instead of 0..3 when configuring AP --- hostapd/wps_hostapd.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hostapd/wps_hostapd.c b/hostapd/wps_hostapd.c index 326a807d4..e0e7c0d89 100644 --- a/hostapd/wps_hostapd.c +++ b/hostapd/wps_hostapd.c @@ -326,9 +326,12 @@ static int hostapd_wps_cred_cb(void *ctx, const struct wps_credential *cred) else fprintf(nconf, "auth_algs=1\n"); - if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx < 4) { - fprintf(nconf, "wep_default_key=%d\n", cred->key_idx); - fprintf(nconf, "wep_key%d=", cred->key_idx); + if (cred->encr_type & WPS_ENCR_WEP && cred->key_idx <= 4) { + int key_idx = cred->key_idx; + if (key_idx) + key_idx--; + fprintf(nconf, "wep_default_key=%d\n", key_idx); + fprintf(nconf, "wep_key%d=", key_idx); if (cred->key_len != 10 && cred->key_len != 26) fputc('"', nconf); for (i = 0; i < cred->key_len; i++)