From c957d25dadc55f14025c4290452791202f9315a9 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Tue, 13 Jul 2021 14:42:05 -0500 Subject: [PATCH] sae: Add sae_is_h2e Allows clients to know whether H2E was used by the SAE state machine --- src/sae.c | 9 ++++++++- src/sae.h | 3 +++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/sae.c b/src/sae.c index 413ebb27..5099473c 100644 --- a/src/sae.c +++ b/src/sae.c @@ -32,8 +32,8 @@ #include "src/handshake.h" #include "src/crypto.h" #include "src/mpdu.h" -#include "src/sae.h" #include "src/auth-proto.h" +#include "src/sae.h" /* SHA-512 is the highest supported hashing function as of 802.11-2020 */ #define SAE_MAX_HASH_LEN 64 @@ -1291,6 +1291,13 @@ static bool sae_start(struct auth_proto *ap) return sae_send_commit(sm, false); } +bool sae_sm_is_h2e(struct auth_proto *ap) +{ + struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap); + + return sm->sae_type != CRYPTO_SAE_LOOPING; +} + static void sae_free(struct auth_proto *ap) { struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap); diff --git a/src/sae.h b/src/sae.h index 4ae49795..668d084f 100644 --- a/src/sae.h +++ b/src/sae.h @@ -20,6 +20,7 @@ * */ +struct auth_proto; struct sae_sm; struct handshake_state; @@ -27,6 +28,8 @@ typedef void (*sae_tx_authenticate_func_t)(const uint8_t *data, size_t len, void *user_data); typedef void (*sae_tx_associate_func_t)(void *user_data); +bool sae_sm_is_h2e(struct auth_proto *ap); + struct auth_proto *sae_sm_new(struct handshake_state *hs, sae_tx_authenticate_func_t tx_auth, sae_tx_associate_func_t tx_assoc,