[PATCH v6a 2/7] Fixes for wpa_supplicant: Set the correct key_type for key installs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a correction on top of:
 [PATCH v6 06/17] wpa_supplicant: Set the correct key_type for key
 installs

Changes:
 - Changes some wrong key_types to the correct ones

Signed-off-by: Alexander Wetzel <alexander@xxxxxxxxxxxxxx>
---

I found another wrong key type we have not yet discussed.
But since we already agreed for hostapd to use KEY_TYPE_PAIRWISE instead
of KEY_TYPE_DEFAULT when using "unicast" keys we also have to use
KEY_TYPE_PAIRWISE in wpa_eapol_set_wep_key() when installing a unicast
WEP key.

(Actually the new code blocking default keys to be used for pairwise
keys found that for me)

I'm also still using "0" as key_type when it's not applicable, like for
PMK keys. This is of course identical to KEY_TYPE_BROADCAST for the
code. I don't see any real down sides here, but we could of course just
add KEY_TYPE_UNUSED for 0 and shift all other types up by one.
(Just adding KEY_TYPE_UNUSED to the enum should do the trick.)

 wpa_supplicant/wpa_supplicant.c | 2 +-
 wpa_supplicant/wpas_glue.c      | 5 +++--
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index ab1064445..d3684fa1b 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -203,7 +203,7 @@ int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
 	 * and RX from each STA.. */
 
 	ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, seq, 6, key, keylen,
-			      KEY_TYPE_BROADCAST);
+			      KEY_TYPE_DEFAULT);
 	os_memset(key, 0, sizeof(key));
 	return ret;
 }
diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
index 7b8254ff7..81f5bdb0b 100644
--- a/wpa_supplicant/wpas_glue.c
+++ b/wpa_supplicant/wpas_glue.c
@@ -243,7 +243,8 @@ static int wpa_eapol_set_wep_key(void *ctx, int unicast, int keyidx,
 	return wpa_drv_set_key(wpa_s, WPA_ALG_WEP,
 			       unicast ? wpa_s->bssid : NULL,
 			       keyidx, NULL, 0, key, keylen,
-			       unicast ? KEY_TYPE_DEFAULT : KEY_TYPE_BROADCAST);
+			       unicast ? KEY_TYPE_PAIRWISE :
+					 KEY_TYPE_BROADCAST);
 }
 
 
@@ -342,7 +343,7 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
 			"handshake", pmk, pmk_len);
 
 	if (wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, NULL, 0, pmk,
-			    pmk_len, KEY_TYPE_BROADCAST)) {
+			    pmk_len, 0)) {
 		wpa_printf(MSG_DEBUG, "Failed to set PMK to the driver");
 	}
 
-- 
2.23.0


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux