diff mbox series

[v2,2/2] sae: Allow ability to force Group 19 / Hunt and Peck

Message ID 20240922210040.1073989-2-denkenz@gmail.com (mailing list archive)
State New
Headers show
Series [v2,1/2] netdev: external auth support | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Denis Kenzior Sept. 22, 2024, 9 p.m. UTC
---
 src/netdev.c |  5 ++++-
 src/sae.c    | 20 ++++++++++++++++++++
 src/sae.h    |  3 +++
 3 files changed, 27 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/src/netdev.c b/src/netdev.c
index 1b50a540d8ca..d298977a1964 100644
--- a/src/netdev.c
+++ b/src/netdev.c
@@ -4033,11 +4033,14 @@  static void netdev_connect_common(struct netdev *netdev,
 		netdev->ap = sae_sm_new(hs, netdev_sae_tx_authenticate,
 					netdev_sae_tx_associate,
 					netdev);
-	else
+	else {
 		netdev->ap =
 			sae_sm_new(hs, netdev_external_auth_sae_tx_authenticate,
 					netdev_external_auth_sae_tx_associate,
 					netdev);
+		sae_sm_force_default_group(netdev->ap);
+		sae_sm_force_hunt_and_peck(netdev->ap);
+	}
 
 	if (sae_sm_is_h2e(netdev->ap)) {
 		uint8_t own_rsnxe[20];
diff --git a/src/sae.c b/src/sae.c
index 97c0af052f14..eb4634848afa 100644
--- a/src/sae.c
+++ b/src/sae.c
@@ -1550,6 +1550,26 @@  struct auth_proto *sae_sm_new(struct handshake_state *hs,
 	return &sm->ap;
 }
 
+bool sae_sm_force_hunt_and_peck(struct auth_proto *ap)
+{
+	struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap);
+
+	sae_debug("Forcing SAE Hunting and Pecking");
+	sm->sae_type = CRYPTO_SAE_LOOPING;
+
+	return true;
+}
+
+bool sae_sm_force_default_group(struct auth_proto *ap)
+{
+	struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap);
+
+	sae_debug("Forcing Default Group");
+	sm->force_default_group = true;
+
+	return true;
+}
+
 static int sae_init(void)
 {
 	if (getenv("IWD_SAE_DEBUG"))
diff --git a/src/sae.h b/src/sae.h
index 668d084f3402..4a59999bfba0 100644
--- a/src/sae.h
+++ b/src/sae.h
@@ -34,3 +34,6 @@  struct auth_proto *sae_sm_new(struct handshake_state *hs,
 				sae_tx_authenticate_func_t tx_auth,
 				sae_tx_associate_func_t tx_assoc,
 				void *user_data);
+
+bool sae_sm_force_hunt_and_peck(struct auth_proto *ap);
+bool sae_sm_force_default_group(struct auth_proto *ap);