nl80211: Use RSN_CIPHER_SUITE_* instead of WLAN_CIPHER_SUITE_*

This is a step towards getting rid of the unnecessary duplication of
definitions.

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2017-01-28 14:04:44 +02:00
parent 2373a31170
commit a042e39acf
2 changed files with 43 additions and 43 deletions

View file

@ -2633,30 +2633,30 @@ static u32 wpa_alg_to_cipher_suite(enum wpa_alg alg, size_t key_len)
switch (alg) { switch (alg) {
case WPA_ALG_WEP: case WPA_ALG_WEP:
if (key_len == 5) if (key_len == 5)
return WLAN_CIPHER_SUITE_WEP40; return RSN_CIPHER_SUITE_WEP40;
return WLAN_CIPHER_SUITE_WEP104; return RSN_CIPHER_SUITE_WEP104;
case WPA_ALG_TKIP: case WPA_ALG_TKIP:
return WLAN_CIPHER_SUITE_TKIP; return RSN_CIPHER_SUITE_TKIP;
case WPA_ALG_CCMP: case WPA_ALG_CCMP:
return WLAN_CIPHER_SUITE_CCMP; return RSN_CIPHER_SUITE_CCMP;
case WPA_ALG_GCMP: case WPA_ALG_GCMP:
return WLAN_CIPHER_SUITE_GCMP; return RSN_CIPHER_SUITE_GCMP;
case WPA_ALG_CCMP_256: case WPA_ALG_CCMP_256:
return WLAN_CIPHER_SUITE_CCMP_256; return RSN_CIPHER_SUITE_CCMP_256;
case WPA_ALG_GCMP_256: case WPA_ALG_GCMP_256:
return WLAN_CIPHER_SUITE_GCMP_256; return RSN_CIPHER_SUITE_GCMP_256;
case WPA_ALG_IGTK: case WPA_ALG_IGTK:
return WLAN_CIPHER_SUITE_AES_CMAC; return RSN_CIPHER_SUITE_AES_128_CMAC;
case WPA_ALG_BIP_GMAC_128: case WPA_ALG_BIP_GMAC_128:
return WLAN_CIPHER_SUITE_BIP_GMAC_128; return RSN_CIPHER_SUITE_BIP_GMAC_128;
case WPA_ALG_BIP_GMAC_256: case WPA_ALG_BIP_GMAC_256:
return WLAN_CIPHER_SUITE_BIP_GMAC_256; return RSN_CIPHER_SUITE_BIP_GMAC_256;
case WPA_ALG_BIP_CMAC_256: case WPA_ALG_BIP_CMAC_256:
return WLAN_CIPHER_SUITE_BIP_CMAC_256; return RSN_CIPHER_SUITE_BIP_CMAC_256;
case WPA_ALG_SMS4: case WPA_ALG_SMS4:
return WLAN_CIPHER_SUITE_SMS4; return RSN_CIPHER_SUITE_SMS4;
case WPA_ALG_KRK: case WPA_ALG_KRK:
return WLAN_CIPHER_SUITE_KRK; return RSN_CIPHER_SUITE_KRK;
case WPA_ALG_NONE: case WPA_ALG_NONE:
case WPA_ALG_PMK: case WPA_ALG_PMK:
wpa_printf(MSG_ERROR, "nl80211: Unexpected encryption algorithm %d", wpa_printf(MSG_ERROR, "nl80211: Unexpected encryption algorithm %d",
@ -2674,21 +2674,21 @@ static u32 wpa_cipher_to_cipher_suite(unsigned int cipher)
{ {
switch (cipher) { switch (cipher) {
case WPA_CIPHER_CCMP_256: case WPA_CIPHER_CCMP_256:
return WLAN_CIPHER_SUITE_CCMP_256; return RSN_CIPHER_SUITE_CCMP_256;
case WPA_CIPHER_GCMP_256: case WPA_CIPHER_GCMP_256:
return WLAN_CIPHER_SUITE_GCMP_256; return RSN_CIPHER_SUITE_GCMP_256;
case WPA_CIPHER_CCMP: case WPA_CIPHER_CCMP:
return WLAN_CIPHER_SUITE_CCMP; return RSN_CIPHER_SUITE_CCMP;
case WPA_CIPHER_GCMP: case WPA_CIPHER_GCMP:
return WLAN_CIPHER_SUITE_GCMP; return RSN_CIPHER_SUITE_GCMP;
case WPA_CIPHER_TKIP: case WPA_CIPHER_TKIP:
return WLAN_CIPHER_SUITE_TKIP; return RSN_CIPHER_SUITE_TKIP;
case WPA_CIPHER_WEP104: case WPA_CIPHER_WEP104:
return WLAN_CIPHER_SUITE_WEP104; return RSN_CIPHER_SUITE_WEP104;
case WPA_CIPHER_WEP40: case WPA_CIPHER_WEP40:
return WLAN_CIPHER_SUITE_WEP40; return RSN_CIPHER_SUITE_WEP40;
case WPA_CIPHER_GTK_NOT_USED: case WPA_CIPHER_GTK_NOT_USED:
return WLAN_CIPHER_SUITE_NO_GROUP_ADDR; return RSN_CIPHER_SUITE_NO_GROUP_ADDRESSED;
} }
return 0; return 0;
@ -2701,19 +2701,19 @@ static int wpa_cipher_to_cipher_suites(unsigned int ciphers, u32 suites[],
int num_suites = 0; int num_suites = 0;
if (num_suites < max_suites && ciphers & WPA_CIPHER_CCMP_256) if (num_suites < max_suites && ciphers & WPA_CIPHER_CCMP_256)
suites[num_suites++] = WLAN_CIPHER_SUITE_CCMP_256; suites[num_suites++] = RSN_CIPHER_SUITE_CCMP_256;
if (num_suites < max_suites && ciphers & WPA_CIPHER_GCMP_256) if (num_suites < max_suites && ciphers & WPA_CIPHER_GCMP_256)
suites[num_suites++] = WLAN_CIPHER_SUITE_GCMP_256; suites[num_suites++] = RSN_CIPHER_SUITE_GCMP_256;
if (num_suites < max_suites && ciphers & WPA_CIPHER_CCMP) if (num_suites < max_suites && ciphers & WPA_CIPHER_CCMP)
suites[num_suites++] = WLAN_CIPHER_SUITE_CCMP; suites[num_suites++] = RSN_CIPHER_SUITE_CCMP;
if (num_suites < max_suites && ciphers & WPA_CIPHER_GCMP) if (num_suites < max_suites && ciphers & WPA_CIPHER_GCMP)
suites[num_suites++] = WLAN_CIPHER_SUITE_GCMP; suites[num_suites++] = RSN_CIPHER_SUITE_GCMP;
if (num_suites < max_suites && ciphers & WPA_CIPHER_TKIP) if (num_suites < max_suites && ciphers & WPA_CIPHER_TKIP)
suites[num_suites++] = WLAN_CIPHER_SUITE_TKIP; suites[num_suites++] = RSN_CIPHER_SUITE_TKIP;
if (num_suites < max_suites && ciphers & WPA_CIPHER_WEP104) if (num_suites < max_suites && ciphers & WPA_CIPHER_WEP104)
suites[num_suites++] = WLAN_CIPHER_SUITE_WEP104; suites[num_suites++] = RSN_CIPHER_SUITE_WEP104;
if (num_suites < max_suites && ciphers & WPA_CIPHER_WEP40) if (num_suites < max_suites && ciphers & WPA_CIPHER_WEP40)
suites[num_suites++] = WLAN_CIPHER_SUITE_WEP40; suites[num_suites++] = RSN_CIPHER_SUITE_WEP40;
return num_suites; return num_suites;
} }
@ -2971,8 +2971,8 @@ static int nl80211_set_conn_keys(struct wpa_driver_associate_params *params,
params->wep_key[i]) || params->wep_key[i]) ||
nla_put_u32(msg, NL80211_KEY_CIPHER, nla_put_u32(msg, NL80211_KEY_CIPHER,
params->wep_key_len[i] == 5 ? params->wep_key_len[i] == 5 ?
WLAN_CIPHER_SUITE_WEP40 : RSN_CIPHER_SUITE_WEP40 :
WLAN_CIPHER_SUITE_WEP104) || RSN_CIPHER_SUITE_WEP104) ||
nla_put_u8(msg, NL80211_KEY_IDX, i) || nla_put_u8(msg, NL80211_KEY_IDX, i) ||
(i == params->wep_tx_keyidx && (i == params->wep_tx_keyidx &&
nla_put_flag(msg, NL80211_KEY_DEFAULT))) nla_put_flag(msg, NL80211_KEY_DEFAULT)))

View file

@ -12,8 +12,8 @@
#include <netlink/genl/genl.h> #include <netlink/genl/genl.h>
#include "utils/common.h" #include "utils/common.h"
#include "common/ieee802_11_defs.h"
#include "common/ieee802_11_common.h" #include "common/ieee802_11_common.h"
#include "common/wpa_common.h"
#include "common/qca-vendor.h" #include "common/qca-vendor.h"
#include "common/qca-vendor-attr.h" #include "common/qca-vendor-attr.h"
#include "driver_nl80211.h" #include "driver_nl80211.h"
@ -266,40 +266,40 @@ static void wiphy_info_cipher_suites(struct wiphy_info_data *info,
c >> 24, (c >> 16) & 0xff, c >> 24, (c >> 16) & 0xff,
(c >> 8) & 0xff, c & 0xff); (c >> 8) & 0xff, c & 0xff);
switch (c) { switch (c) {
case WLAN_CIPHER_SUITE_CCMP_256: case RSN_CIPHER_SUITE_CCMP_256:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_CCMP_256; info->capa->enc |= WPA_DRIVER_CAPA_ENC_CCMP_256;
break; break;
case WLAN_CIPHER_SUITE_GCMP_256: case RSN_CIPHER_SUITE_GCMP_256:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_GCMP_256; info->capa->enc |= WPA_DRIVER_CAPA_ENC_GCMP_256;
break; break;
case WLAN_CIPHER_SUITE_CCMP: case RSN_CIPHER_SUITE_CCMP:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_CCMP; info->capa->enc |= WPA_DRIVER_CAPA_ENC_CCMP;
break; break;
case WLAN_CIPHER_SUITE_GCMP: case RSN_CIPHER_SUITE_GCMP:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_GCMP; info->capa->enc |= WPA_DRIVER_CAPA_ENC_GCMP;
break; break;
case WLAN_CIPHER_SUITE_TKIP: case RSN_CIPHER_SUITE_TKIP:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_TKIP; info->capa->enc |= WPA_DRIVER_CAPA_ENC_TKIP;
break; break;
case WLAN_CIPHER_SUITE_WEP104: case RSN_CIPHER_SUITE_WEP104:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_WEP104; info->capa->enc |= WPA_DRIVER_CAPA_ENC_WEP104;
break; break;
case WLAN_CIPHER_SUITE_WEP40: case RSN_CIPHER_SUITE_WEP40:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_WEP40; info->capa->enc |= WPA_DRIVER_CAPA_ENC_WEP40;
break; break;
case WLAN_CIPHER_SUITE_AES_CMAC: case RSN_CIPHER_SUITE_AES_128_CMAC:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP; info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP;
break; break;
case WLAN_CIPHER_SUITE_BIP_GMAC_128: case RSN_CIPHER_SUITE_BIP_GMAC_128:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_GMAC_128; info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_GMAC_128;
break; break;
case WLAN_CIPHER_SUITE_BIP_GMAC_256: case RSN_CIPHER_SUITE_BIP_GMAC_256:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_GMAC_256; info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_GMAC_256;
break; break;
case WLAN_CIPHER_SUITE_BIP_CMAC_256: case RSN_CIPHER_SUITE_BIP_CMAC_256:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_CMAC_256; info->capa->enc |= WPA_DRIVER_CAPA_ENC_BIP_CMAC_256;
break; break;
case WLAN_CIPHER_SUITE_NO_GROUP_ADDR: case RSN_CIPHER_SUITE_NO_GROUP_ADDRESSED:
info->capa->enc |= WPA_DRIVER_CAPA_ENC_GTK_NOT_USED; info->capa->enc |= WPA_DRIVER_CAPA_ENC_GTK_NOT_USED;
break; break;
} }