[PATCH v6 06/17] wpa_supplicant: Set the correct key_type for key installs

Jouni Malinen j at w1.fi
Fri Sep 20 06:13:02 PDT 2019


On Sun, Sep 15, 2019 at 10:08:26PM +0200, Alexander Wetzel wrote:
> diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
> @@ -200,7 +202,8 @@ int wpa_supplicant_set_wpa_none_key(struct wpa_supplicant *wpa_s,
>  	/* TODO: should actually remember the previously used seq#, both for TX
>  	 * and RX from each STA.. */
>  
> -	ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, 1, seq, 6, key, keylen, 0);
> +	ret = wpa_drv_set_key(wpa_s, alg, NULL, 0, 1, seq, 6, key, keylen,
> +			      KEY_TYPE_BROADCAST);

Is this really KEY_TYPE_BROADCAST instead of KEY_TYPE_DEFAULT? As noted
in the beginning of this function, only one key is used for both
receiving and sending unicast and multicast frames.

> diff --git a/wpa_supplicant/wpas_glue.c b/wpa_supplicant/wpas_glue.c
> @@ -341,7 +342,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, 0, NULL, 0, pmk,
> -			    pmk_len, 0)) {
> +			    pmk_len, KEY_TYPE_BROADCAST)) {

WPA_ALG_PMK is not for a cipher, it is for offloading 4-way handshake to
the driver. As such, KEY_TYPE_BROADCAST looks strange here. Maybe we
should have KEY_TYPE_OTHER (etc.) for this special case(?)

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list