SAE: Use a shared data structure for AP and station
This makes it easier to share common functions for both roles. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
05a8d4221d
commit
98efcc4176
6 changed files with 47 additions and 19 deletions
|
@ -17,6 +17,7 @@
|
|||
#include "common/ieee802_11_defs.h"
|
||||
#include "common/ieee802_11_common.h"
|
||||
#include "common/wpa_ctrl.h"
|
||||
#include "common/sae.h"
|
||||
#include "radius/radius.h"
|
||||
#include "radius/radius_client.h"
|
||||
#include "p2p/p2p.h"
|
||||
|
@ -344,8 +345,8 @@ static struct wpabuf * auth_build_sae_confirm(struct hostapd_data *hapd,
|
|||
if (buf == NULL)
|
||||
return NULL;
|
||||
|
||||
wpabuf_put_le16(buf, sta->sae_send_confirm);
|
||||
sta->sae_send_confirm++;
|
||||
wpabuf_put_le16(buf, sta->sae->send_confirm);
|
||||
sta->sae->send_confirm++;
|
||||
/* TODO: Confirm */
|
||||
|
||||
return buf;
|
||||
|
@ -393,6 +394,12 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
u16 resp = WLAN_STATUS_SUCCESS;
|
||||
struct wpabuf *data;
|
||||
|
||||
if (!sta->sae) {
|
||||
sta->sae = os_zalloc(sizeof(*sta->sae));
|
||||
if (sta->sae == NULL)
|
||||
return;
|
||||
}
|
||||
|
||||
if (auth_transaction == 1) {
|
||||
hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
|
||||
HOSTAPD_LEVEL_DEBUG,
|
||||
|
@ -401,9 +408,9 @@ static void handle_auth_sae(struct hostapd_data *hapd, struct sta_info *sta,
|
|||
((u8 *) mgmt) + len -
|
||||
mgmt->u.auth.variable);
|
||||
if (resp == WLAN_STATUS_SUCCESS)
|
||||
sta->sae_state = SAE_COMMIT;
|
||||
sta->sae->state = SAE_COMMIT;
|
||||
} else if (auth_transaction == 2) {
|
||||
if (sta->sae_state != SAE_COMMIT) {
|
||||
if (sta->sae->state != SAE_COMMIT) {
|
||||
hostapd_logger(hapd, sta->addr,
|
||||
HOSTAPD_MODULE_IEEE80211,
|
||||
HOSTAPD_LEVEL_DEBUG,
|
||||
|
|
|
@ -240,6 +240,10 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
|
|||
os_free(sta->identity);
|
||||
os_free(sta->radius_cui);
|
||||
|
||||
#ifdef CONFIG_SAE
|
||||
os_free(sta->sae);
|
||||
#endif /* CONFIG_SAE */
|
||||
|
||||
os_free(sta);
|
||||
}
|
||||
|
||||
|
|
|
@ -127,8 +127,7 @@ struct sta_info {
|
|||
struct os_time connected_time;
|
||||
|
||||
#ifdef CONFIG_SAE
|
||||
enum { SAE_INIT, SAE_COMMIT, SAE_CONFIRM } sae_state;
|
||||
u16 sae_send_confirm;
|
||||
struct sae_data *sae;
|
||||
#endif /* CONFIG_SAE */
|
||||
};
|
||||
|
||||
|
|
17
src/common/sae.h
Normal file
17
src/common/sae.h
Normal file
|
@ -0,0 +1,17 @@
|
|||
/*
|
||||
* Simultaneous authentication of equals
|
||||
* Copyright (c) 2012, Jouni Malinen <j@w1.fi>
|
||||
*
|
||||
* This software may be distributed under the terms of the BSD license.
|
||||
* See README for more details.
|
||||
*/
|
||||
|
||||
#ifndef SAE_H
|
||||
#define SAE_H
|
||||
|
||||
struct sae_data {
|
||||
enum { SAE_INIT, SAE_COMMIT, SAE_CONFIRM } state;
|
||||
u16 send_confirm;
|
||||
};
|
||||
|
||||
#endif /* SAE_H */
|
Loading…
Add table
Add a link
Reference in a new issue