Replace WPA_ALG_PMK with KEY_FLAG_PMK
Drop the no longer needed internal alg WPA_ALG_PMK and use KEY_FLAG_PMK as replacement. Signed-off-by: Alexander Wetzel <alexander@wetzel-home.de>
This commit is contained in:
parent
11b1fcd6ca
commit
be15f33d07
6 changed files with 39 additions and 39 deletions
|
@ -200,7 +200,6 @@ enum wpa_alg {
|
|||
WPA_ALG_TKIP,
|
||||
WPA_ALG_CCMP,
|
||||
WPA_ALG_IGTK,
|
||||
WPA_ALG_PMK,
|
||||
WPA_ALG_GCMP,
|
||||
WPA_ALG_SMS4,
|
||||
WPA_ALG_KRK,
|
||||
|
|
|
@ -1546,9 +1546,8 @@ struct wpa_driver_set_key_params {
|
|||
* alg - Encryption algorithm
|
||||
*
|
||||
* (%WPA_ALG_NONE, %WPA_ALG_WEP, %WPA_ALG_TKIP, %WPA_ALG_CCMP,
|
||||
* %WPA_ALG_IGTK, %WPA_ALG_PMK, %WPA_ALG_GCMP, %WPA_ALG_GCMP_256,
|
||||
* %WPA_ALG_CCMP_256, %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256,
|
||||
* %WPA_ALG_BIP_CMAC_256);
|
||||
* %WPA_ALG_IGTK, %WPA_ALG_GCMP, %WPA_ALG_GCMP_256, %WPA_ALG_CCMP_256,
|
||||
* %WPA_ALG_BIP_GMAC_128, %WPA_ALG_BIP_GMAC_256, %WPA_ALG_BIP_CMAC_256);
|
||||
* %WPA_ALG_NONE clears the key. */
|
||||
enum wpa_alg alg;
|
||||
|
||||
|
@ -1698,7 +1697,7 @@ struct wpa_driver_capa {
|
|||
/** Driver takes care of all DFS operations */
|
||||
#define WPA_DRIVER_FLAGS_DFS_OFFLOAD 0x00000004
|
||||
/** Driver takes care of RSN 4-way handshake internally; PMK is configured with
|
||||
* struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
|
||||
* struct wpa_driver_ops::set_key using key_flag = KEY_FLAG_PMK */
|
||||
#define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X 0x00000008
|
||||
/** Driver is for a wired Ethernet interface */
|
||||
#define WPA_DRIVER_FLAGS_WIRED 0x00000010
|
||||
|
|
|
@ -2883,7 +2883,6 @@ static u32 wpa_alg_to_cipher_suite(enum wpa_alg alg, size_t key_len)
|
|||
case WPA_ALG_KRK:
|
||||
return RSN_CIPHER_SUITE_KRK;
|
||||
case WPA_ALG_NONE:
|
||||
case WPA_ALG_PMK:
|
||||
wpa_printf(MSG_ERROR, "nl80211: Unexpected encryption algorithm %d",
|
||||
alg);
|
||||
return 0;
|
||||
|
@ -3084,7 +3083,7 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
|||
}
|
||||
|
||||
#ifdef CONFIG_DRIVER_NL80211_QCA
|
||||
if (alg == WPA_ALG_PMK &&
|
||||
if ((key_flag & KEY_FLAG_PMK) &&
|
||||
(drv->capa.flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD)) {
|
||||
wpa_printf(MSG_DEBUG, "%s: calling issue_key_mgmt_set_key",
|
||||
__func__);
|
||||
|
@ -3093,10 +3092,9 @@ static int wpa_driver_nl80211_set_key(struct i802_bss *bss,
|
|||
}
|
||||
#endif /* CONFIG_DRIVER_NL80211_QCA */
|
||||
|
||||
if (alg == WPA_ALG_PMK &&
|
||||
(drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X))
|
||||
return nl80211_set_pmk(drv, key, key_len, addr);
|
||||
if (key_flag & KEY_FLAG_PMK) {
|
||||
if (drv->capa.flags & WPA_DRIVER_FLAGS_4WAY_HANDSHAKE_8021X)
|
||||
return nl80211_set_pmk(drv, key, key_len, addr);
|
||||
/* The driver does not have any offload mechanism for PMK, so
|
||||
* there is no need to configure this key. */
|
||||
return 0;
|
||||
|
|
|
@ -73,11 +73,12 @@ wpa_driver_openbsd_set_key(void *priv, struct wpa_driver_set_key_params *params)
|
|||
{
|
||||
struct openbsd_driver_data *drv = priv;
|
||||
struct ieee80211_keyavail keyavail;
|
||||
enum wpa_alg alg = params->alg;
|
||||
enum key_flag key_flag = params->key_flag;
|
||||
const u8 *key = params->key;
|
||||
size_t key_len = params->key_len;
|
||||
|
||||
if (alg != WPA_ALG_PMK || key_len > IEEE80211_PMK_LEN)
|
||||
if (key_len > IEEE80211_PMK_LEN ||
|
||||
(key_flag & KEY_FLAG_PMK_MASK) != KEY_FLAG_PMK) {
|
||||
return -1;
|
||||
|
||||
memset(&keyavail, 0, sizeof(keyavail));
|
||||
|
|
|
@ -1712,7 +1712,8 @@ static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
|
|||
const u8 *addr, int key_idx,
|
||||
int set_tx, const u8 *seq,
|
||||
size_t seq_len,
|
||||
const u8 *key, size_t key_len)
|
||||
const u8 *key, size_t key_len,
|
||||
enum key_flag key_flag)
|
||||
{
|
||||
struct wpa_driver_wext_data *drv = priv;
|
||||
struct iwreq iwr;
|
||||
|
@ -1751,6 +1752,9 @@ static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
|
|||
os_memcpy(ext + 1, key, key_len);
|
||||
ext->key_len = key_len;
|
||||
}
|
||||
if (key_flag & KEY_FLAG_PMK) {
|
||||
ext->alg = IW_ENCODE_ALG_PMK;
|
||||
} else {
|
||||
switch (alg) {
|
||||
case WPA_ALG_NONE:
|
||||
ext->alg = IW_ENCODE_ALG_NONE;
|
||||
|
@ -1764,9 +1768,6 @@ static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
|
|||
case WPA_ALG_CCMP:
|
||||
ext->alg = IW_ENCODE_ALG_CCMP;
|
||||
break;
|
||||
case WPA_ALG_PMK:
|
||||
ext->alg = IW_ENCODE_ALG_PMK;
|
||||
break;
|
||||
case WPA_ALG_IGTK:
|
||||
ext->alg = IW_ENCODE_ALG_AES_CMAC;
|
||||
break;
|
||||
|
@ -1776,6 +1777,7 @@ static int wpa_driver_wext_set_key_ext(void *priv, enum wpa_alg alg,
|
|||
os_free(ext);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (seq && seq_len) {
|
||||
ext->ext_flags |= IW_ENCODE_EXT_RX_SEQ_VALID;
|
||||
|
@ -1816,6 +1818,7 @@ static int wpa_driver_wext_set_key(void *priv,
|
|||
struct iwreq iwr;
|
||||
int ret = 0;
|
||||
enum wpa_alg alg = params->alg;
|
||||
enum key_flag key_flag = params->key_flag;
|
||||
const u8 *addr = params->addr;
|
||||
int key_idx = params->key_idx;
|
||||
int set_tx = params->set_tx;
|
||||
|
@ -1830,7 +1833,7 @@ static int wpa_driver_wext_set_key(void *priv,
|
|||
(unsigned long) seq_len, (unsigned long) key_len);
|
||||
|
||||
ret = wpa_driver_wext_set_key_ext(drv, alg, addr, key_idx, set_tx,
|
||||
seq, seq_len, key, key_len);
|
||||
seq, seq_len, key, key_len, key_flag);
|
||||
if (ret == 0)
|
||||
return 0;
|
||||
|
||||
|
|
|
@ -352,7 +352,7 @@ static void wpa_supplicant_eapol_cb(struct eapol_sm *eapol,
|
|||
wpa_hexdump_key(MSG_DEBUG, "RSN: Configure PMK for driver-based 4-way "
|
||||
"handshake", pmk, pmk_len);
|
||||
|
||||
if (wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, 0, NULL, 0, pmk,
|
||||
if (wpa_drv_set_key(wpa_s, 0, NULL, 0, 0, NULL, 0, pmk,
|
||||
pmk_len, KEY_FLAG_PMK)) {
|
||||
wpa_printf(MSG_DEBUG, "Failed to set PMK to the driver");
|
||||
}
|
||||
|
@ -1196,7 +1196,7 @@ static int wpa_supplicant_key_mgmt_set_pmk(void *ctx, const u8 *pmk,
|
|||
|
||||
if (wpa_s->conf->key_mgmt_offload &&
|
||||
(wpa_s->drv_flags & WPA_DRIVER_FLAGS_KEY_MGMT_OFFLOAD))
|
||||
return wpa_drv_set_key(wpa_s, WPA_ALG_PMK, NULL, 0, 0,
|
||||
return wpa_drv_set_key(wpa_s, 0, NULL, 0, 0,
|
||||
NULL, 0, pmk, pmk_len, KEY_FLAG_PMK);
|
||||
else
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue