From: John Brandt <brandtwjohn@gmail.com>
To: iwd@lists.linux.dev
Cc: John Brandt <brandtwjohn@gmail.com>
Subject: [PATCH 02/11] ap: accept PSK/SAE in auth depending on config
Date: Sun, 21 Apr 2024 05:50:32 -0700 [thread overview]
Message-ID: <20240421125050.6649-3-brandtwjohn@gmail.com> (raw)
In-Reply-To: <20240421125050.6649-1-brandtwjohn@gmail.com>
On reception of an authentication frame, accept both PSK and SAE as AKM
depending on the config. Save the client's AKM for later use.
---
src/ap.c | 28 +++++++++++++++++++++-------
1 file changed, 21 insertions(+), 7 deletions(-)
diff --git a/src/ap.c b/src/ap.c
index d50f9e4f..14268551 100644
--- a/src/ap.c
+++ b/src/ap.c
@@ -132,6 +132,7 @@ struct sta_state {
uint8_t *assoc_ies;
size_t assoc_ies_len;
uint8_t *assoc_rsne;
+ enum ie_rsn_akm_suite akm_suite;
struct eapol_sm *sm;
struct handshake_state *hs;
uint32_t gtk_query_cmd_id;
@@ -2606,6 +2607,7 @@ static void ap_auth_cb(const struct mmpdu_header *hdr, const void *body,
const uint8_t *from = hdr->address_2;
const uint8_t *bssid = netdev_get_address(ap->netdev);
struct sta_state *sta;
+ enum ie_rsn_akm_suite akm_suite;
l_info("AP Authentication from %s", util_address_to_string(from));
@@ -2627,17 +2629,27 @@ static void ap_auth_cb(const struct mmpdu_header *hdr, const void *body,
}
}
- /* Only Open System authentication implemented here */
- if (L_LE16_TO_CPU(auth->algorithm) !=
- MMPDU_AUTH_ALGO_OPEN_SYSTEM) {
+ if ((ap->akm_suites & IE_RSN_AKM_SUITE_SAE_SHA256) &&
+ (L_LE16_TO_CPU(auth->algorithm) == MMPDU_AUTH_ALGO_SAE) ) {
+ /* When using SAE it must be COMMIT or CONFIRM frame */
+ if (L_LE16_TO_CPU(auth->transaction_sequence) > 2) {
+ ap_auth_reply(ap, from, MMPDU_REASON_CODE_UNSPECIFIED);
+ return;
+ }
+ akm_suite = IE_RSN_AKM_SUITE_SAE_SHA256;
+ } else if ((ap->akm_suites & IE_RSN_AKM_SUITE_PSK) &&
+ (L_LE16_TO_CPU(auth->algorithm) == MMPDU_AUTH_ALGO_OPEN_SYSTEM) ) {
+ /* When using PSK it must be Open System authentication */
+ if (L_LE16_TO_CPU(auth->transaction_sequence) != 1) {
+ ap_auth_reply(ap, from, MMPDU_REASON_CODE_UNSPECIFIED);
+ return;
+ }
+ akm_suite = IE_RSN_AKM_SUITE_PSK;
+ } else {
ap_auth_reply(ap, from, MMPDU_REASON_CODE_UNSPECIFIED);
return;
}
- if (L_LE16_TO_CPU(auth->transaction_sequence) != 1) {
- ap_auth_reply(ap, from, MMPDU_REASON_CODE_UNSPECIFIED);
- return;
- }
sta = l_queue_find(ap->sta_states, ap_sta_match_addr, from);
@@ -2666,6 +2678,8 @@ static void ap_auth_cb(const struct mmpdu_header *hdr, const void *body,
if (!ap->sta_states)
ap->sta_states = l_queue_new();
+ sta->akm_suite = akm_suite;
+
l_queue_push_tail(ap->sta_states, sta);
/*
--
2.44.0
next prev parent reply other threads:[~2024-04-21 12:52 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-21 12:50 [PATCH 00/11] Basic SAE support for AP mode John Brandt
2024-04-21 12:50 ` [PATCH 01/11] ap: ability to advertise PSK and SAE John Brandt
2024-04-21 12:50 ` John Brandt [this message]
2024-04-24 12:05 ` [PATCH 02/11] ap: accept PSK/SAE in auth depending on config James Prestwood
2024-04-21 12:50 ` [PATCH 03/11] sae: add function sae_set_group John Brandt
2024-04-24 12:05 ` James Prestwood
2024-04-21 12:50 ` [PATCH 04/11] sae: refactor and add function sae_calculate_keys John Brandt
2024-04-24 12:06 ` James Prestwood
2024-04-21 12:50 ` [PATCH 05/11] sae: make sae_process_commit callable in AP mode John Brandt
2024-04-24 12:08 ` James Prestwood
2024-04-21 12:50 ` [PATCH 06/11] sae: verify offered group " John Brandt
2024-04-21 12:50 ` [PATCH 07/11] sae: support reception of Confirm frame by AP John Brandt
2024-04-24 12:08 ` James Prestwood
2024-04-21 12:50 ` [PATCH 08/11] ap: add support to handle SAE authentication John Brandt
2024-04-24 12:06 ` James Prestwood
2024-04-21 12:50 ` [PATCH 09/11] ap: enable start of 4-way HS after SAE John Brandt
2024-04-21 12:50 ` [PATCH 10/11] eapol: support PTK derivation with SHA256 John Brandt
2024-04-21 12:50 ` [PATCH 11/11] eapol: encrypt key data for AKM-defined ciphers John Brandt
2024-04-22 13:52 ` [PATCH 00/11] Basic SAE support for AP mode James Prestwood
2024-04-24 12:07 ` James Prestwood
2024-04-29 0:04 ` John Brandt
2024-04-29 12:00 ` James Prestwood
2024-04-30 23:27 ` KeithG
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=20240421125050.6649-3-brandtwjohn@gmail.com \
--to=brandtwjohn@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