mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 09:39:25 +01:00
ie: Move AKM suite converter from netdev
It is more logical to host this function inside ie.c than netdev.c. Particularly since ie_rsn_cipher_suite_to_cipher is already present in ie.c.
This commit is contained in:
parent
44e9816dcb
commit
5a4fc931e7
46
src/ie.c
46
src/ie.c
@ -481,6 +481,52 @@ const char *ie_rsn_cipher_suite_to_string(enum ie_rsn_cipher_suite suite)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
uint32_t ie_rsn_akm_suite_to_akm(enum ie_rsn_akm_suite akm)
|
||||
{
|
||||
switch (akm) {
|
||||
case IE_RSN_AKM_SUITE_8021X:
|
||||
return CRYPTO_AKM_8021X;
|
||||
case IE_RSN_AKM_SUITE_PSK:
|
||||
return CRYPTO_AKM_PSK;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_8021X:
|
||||
return CRYPTO_AKM_FT_OVER_8021X;
|
||||
case IE_RSN_AKM_SUITE_FT_USING_PSK:
|
||||
return CRYPTO_AKM_FT_USING_PSK;
|
||||
case IE_RSN_AKM_SUITE_8021X_SHA256:
|
||||
return CRYPTO_AKM_8021X_SHA256;
|
||||
case IE_RSN_AKM_SUITE_PSK_SHA256:
|
||||
return CRYPTO_AKM_PSK_SHA256;
|
||||
case IE_RSN_AKM_SUITE_TDLS:
|
||||
return CRYPTO_AKM_TDLS;
|
||||
case IE_RSN_AKM_SUITE_SAE_SHA256:
|
||||
return CRYPTO_AKM_SAE_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
|
||||
return CRYPTO_AKM_FT_OVER_SAE_SHA256;
|
||||
case IE_RSN_AKM_SUITE_AP_PEER_KEY_SHA256:
|
||||
return CRYPTO_AKM_AP_PEER_KEY_SHA256;
|
||||
case IE_RSN_AKM_SUITE_8021X_SUITE_B_SHA256:
|
||||
return CRYPTO_AKM_8021X_SUITE_B_SHA256;
|
||||
case IE_RSN_AKM_SUITE_8021X_SUITE_B_SHA384:
|
||||
return CRYPTO_AKM_8021X_SUITE_B_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384:
|
||||
return CRYPTO_AKM_FT_OVER_8021X_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FILS_SHA256:
|
||||
return CRYPTO_AKM_FILS_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FILS_SHA384:
|
||||
return CRYPTO_AKM_FILS_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
|
||||
return CRYPTO_AKM_FT_OVER_FILS_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
|
||||
return CRYPTO_AKM_FT_OVER_FILS_SHA384;
|
||||
case IE_RSN_AKM_SUITE_OWE:
|
||||
return CRYPTO_AKM_OWE;
|
||||
case IE_RSN_AKM_SUITE_OSEN:
|
||||
return CRYPTO_AKM_OSEN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* 802.11, Section 8.4.2.27.2 */
|
||||
static bool ie_parse_cipher_suite(const uint8_t *data,
|
||||
enum ie_rsn_cipher_suite *out)
|
||||
|
2
src/ie.h
2
src/ie.h
@ -621,6 +621,8 @@ unsigned char *ie_tlv_builder_finalize(struct ie_tlv_builder *builder,
|
||||
uint32_t ie_rsn_cipher_suite_to_cipher(enum ie_rsn_cipher_suite suite);
|
||||
const char *ie_rsn_cipher_suite_to_string(enum ie_rsn_cipher_suite suite);
|
||||
|
||||
uint32_t ie_rsn_akm_suite_to_akm(enum ie_rsn_akm_suite akm);
|
||||
|
||||
int ie_parse_rsne(struct ie_tlv_iter *iter, struct ie_rsn_info *info);
|
||||
int ie_parse_rsne_from_data(const uint8_t *data, size_t len,
|
||||
struct ie_rsn_info *info);
|
||||
|
47
src/netdev.c
47
src/netdev.c
@ -2445,51 +2445,6 @@ static void netdev_driver_connected(struct netdev *netdev)
|
||||
eapol_register(netdev->sm);
|
||||
}
|
||||
|
||||
static unsigned int ie_rsn_akm_suite_to_nl80211(enum ie_rsn_akm_suite akm)
|
||||
{
|
||||
switch (akm) {
|
||||
case IE_RSN_AKM_SUITE_8021X:
|
||||
return CRYPTO_AKM_8021X;
|
||||
case IE_RSN_AKM_SUITE_PSK:
|
||||
return CRYPTO_AKM_PSK;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_8021X:
|
||||
return CRYPTO_AKM_FT_OVER_8021X;
|
||||
case IE_RSN_AKM_SUITE_FT_USING_PSK:
|
||||
return CRYPTO_AKM_FT_USING_PSK;
|
||||
case IE_RSN_AKM_SUITE_8021X_SHA256:
|
||||
return CRYPTO_AKM_8021X_SHA256;
|
||||
case IE_RSN_AKM_SUITE_PSK_SHA256:
|
||||
return CRYPTO_AKM_PSK_SHA256;
|
||||
case IE_RSN_AKM_SUITE_TDLS:
|
||||
return CRYPTO_AKM_TDLS;
|
||||
case IE_RSN_AKM_SUITE_SAE_SHA256:
|
||||
return CRYPTO_AKM_SAE_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_SAE_SHA256:
|
||||
return CRYPTO_AKM_FT_OVER_SAE_SHA256;
|
||||
case IE_RSN_AKM_SUITE_AP_PEER_KEY_SHA256:
|
||||
return CRYPTO_AKM_AP_PEER_KEY_SHA256;
|
||||
case IE_RSN_AKM_SUITE_8021X_SUITE_B_SHA256:
|
||||
return CRYPTO_AKM_8021X_SUITE_B_SHA256;
|
||||
case IE_RSN_AKM_SUITE_8021X_SUITE_B_SHA384:
|
||||
return CRYPTO_AKM_8021X_SUITE_B_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_8021X_SHA384:
|
||||
return CRYPTO_AKM_FT_OVER_8021X_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FILS_SHA256:
|
||||
return CRYPTO_AKM_FILS_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FILS_SHA384:
|
||||
return CRYPTO_AKM_FILS_SHA384;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA256:
|
||||
return CRYPTO_AKM_FT_OVER_FILS_SHA256;
|
||||
case IE_RSN_AKM_SUITE_FT_OVER_FILS_SHA384:
|
||||
return CRYPTO_AKM_FT_OVER_FILS_SHA384;
|
||||
case IE_RSN_AKM_SUITE_OWE:
|
||||
return CRYPTO_AKM_OWE;
|
||||
case IE_RSN_AKM_SUITE_OSEN:
|
||||
return CRYPTO_AKM_OSEN;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void netdev_append_nl80211_rsn_attributes(struct l_genl_msg *msg,
|
||||
struct handshake_state *hs)
|
||||
@ -2514,7 +2469,7 @@ static void netdev_append_nl80211_rsn_attributes(struct l_genl_msg *msg,
|
||||
l_genl_msg_append_attr(msg, NL80211_ATTR_USE_MFP, 4, &use_mfp);
|
||||
}
|
||||
|
||||
nl_akm = ie_rsn_akm_suite_to_nl80211(hs->akm_suite);
|
||||
nl_akm = ie_rsn_akm_suite_to_akm(hs->akm_suite);
|
||||
L_WARN_ON(!nl_akm);
|
||||
l_genl_msg_append_attr(msg, NL80211_ATTR_AKM_SUITES, 4, &nl_akm);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user