From: Denis Kenzior <denkenz@gmail.com>
To: iwd@lists.linux.dev
Cc: Denis Kenzior <denkenz@gmail.com>
Subject: [PATCH 1/6] ie: Move AKM suite converter from netdev
Date: Sun, 26 Nov 2023 20:52:58 -0600 [thread overview]
Message-ID: <20231127025320.1310543-1-denkenz@gmail.com> (raw)
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.
---
src/ie.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
src/ie.h | 2 ++
src/netdev.c | 47 +----------------------------------------------
3 files changed, 49 insertions(+), 46 deletions(-)
diff --git a/src/ie.c b/src/ie.c
index 6b08ce180a87..a51724aa74c8 100644
--- a/src/ie.c
+++ b/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)
diff --git a/src/ie.h b/src/ie.h
index c9a6c78324d6..9ada64bf3bd7 100644
--- a/src/ie.h
+++ b/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);
diff --git a/src/netdev.c b/src/netdev.c
index f23ca59ea1cb..7b951a6a4797 100644
--- a/src/netdev.c
+++ b/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);
--
2.42.0
next reply other threads:[~2023-11-27 2:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-27 2:52 Denis Kenzior [this message]
2023-11-27 2:52 ` [PATCH 2/6] nl80211util: Move nl80211_append_rsn_attributes Denis Kenzior
2023-11-27 2:53 ` [PATCH 3/6] netdev: Don't duplicate vendor_ies Denis Kenzior
2023-11-27 2:53 ` [PATCH 4/6] netdev: Do not leak l_genl_msg on error Denis Kenzior
2023-11-27 4:41 ` Denis Kenzior
2023-11-27 2:53 ` [PATCH 5/6] netdev: Fix buffer overflow with 32 character ssids Denis Kenzior
2023-11-27 2:53 ` [PATCH 6/6] erp: Fix buffer overflow for 32 byte SSIDs Denis Kenzior
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231127025320.1310543-1-denkenz@gmail.com \
--to=denkenz@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).