sae: Add sae_is_h2e

Allows clients to know whether H2E was used by the SAE state machine
This commit is contained in:
Denis Kenzior 2021-07-13 14:42:05 -05:00
parent f67e5ea6d8
commit c957d25dad
2 changed files with 11 additions and 1 deletions

View File

@ -32,8 +32,8 @@
#include "src/handshake.h" #include "src/handshake.h"
#include "src/crypto.h" #include "src/crypto.h"
#include "src/mpdu.h" #include "src/mpdu.h"
#include "src/sae.h"
#include "src/auth-proto.h" #include "src/auth-proto.h"
#include "src/sae.h"
/* SHA-512 is the highest supported hashing function as of 802.11-2020 */ /* SHA-512 is the highest supported hashing function as of 802.11-2020 */
#define SAE_MAX_HASH_LEN 64 #define SAE_MAX_HASH_LEN 64
@ -1291,6 +1291,13 @@ static bool sae_start(struct auth_proto *ap)
return sae_send_commit(sm, false); 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) static void sae_free(struct auth_proto *ap)
{ {
struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap); struct sae_sm *sm = l_container_of(ap, struct sae_sm, ap);

View File

@ -20,6 +20,7 @@
* *
*/ */
struct auth_proto;
struct sae_sm; struct sae_sm;
struct handshake_state; struct handshake_state;
@ -27,6 +28,8 @@ typedef void (*sae_tx_authenticate_func_t)(const uint8_t *data, size_t len,
void *user_data); void *user_data);
typedef void (*sae_tx_associate_func_t)(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, struct auth_proto *sae_sm_new(struct handshake_state *hs,
sae_tx_authenticate_func_t tx_auth, sae_tx_authenticate_func_t tx_auth,
sae_tx_associate_func_t tx_assoc, sae_tx_associate_func_t tx_assoc,