]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
PASN: Common wpas_pasn structure for initiator and responder
authorVinay Gannevaram <quic_vganneva@quicinc.com>
Mon, 19 Sep 2022 10:42:49 +0000 (16:12 +0530)
committerJouni Malinen <j@w1.fi>
Thu, 3 Nov 2022 22:52:17 +0000 (00:52 +0200)
Make struct wpas_pasn common for both the initiator and the responder by
adding required parameters for responder to the existing struct
wpas_pasn. This makes both hostapd and wpa_supplicant share the same
structure definitions in preparation for allowing PASN functionality to
be built into a separate library.

Signed-off-by: Jouni Malinen <quic_jouni@quicinc.com>
src/ap/ieee802_11.c
src/ap/sta_info.h
src/pasn/pasn_common.h

index 761abd7ce1cc2267d2abc656874aad88d0efef80..f392daef8bad0fbf576c110c015e2a31d4ae23d5 100644 (file)
@@ -55,6 +55,7 @@
 #include "fils_hlp.h"
 #include "dpp_hostapd.h"
 #include "gas_query_ap.h"
+#include "pasn/pasn_common.h"
 
 
 #ifdef CONFIG_FILS
@@ -2394,7 +2395,7 @@ static int pasn_wd_handle_sae_commit(struct hostapd_data *hapd,
                                     struct sta_info *sta,
                                     struct wpabuf *wd)
 {
-       struct pasn_data *pasn = sta->pasn;
+       struct wpas_pasn *pasn = sta->pasn;
        const char *password;
        const u8 *data;
        size_t buf_len;
@@ -2474,7 +2475,7 @@ static int pasn_wd_handle_sae_confirm(struct hostapd_data *hapd,
                                      struct sta_info *sta,
                                      struct wpabuf *wd)
 {
-       struct pasn_data *pasn = sta->pasn;
+       struct wpas_pasn *pasn = sta->pasn;
        const u8 *data;
        size_t buf_len;
        u16 res, alg, seq, status;
@@ -2526,7 +2527,7 @@ static int pasn_wd_handle_sae_confirm(struct hostapd_data *hapd,
 static struct wpabuf * pasn_get_sae_wd(struct hostapd_data *hapd,
                                       struct sta_info *sta)
 {
-       struct pasn_data *pasn = sta->pasn;
+       struct wpas_pasn *pasn = sta->pasn;
        struct wpabuf *buf = NULL;
        u8 *len_ptr;
        size_t len;
@@ -2571,8 +2572,8 @@ static struct wpabuf * pasn_get_sae_wd(struct hostapd_data *hapd,
 static struct wpabuf * pasn_get_fils_wd(struct hostapd_data *hapd,
                                        struct sta_info *sta)
 {
-       struct pasn_data *pasn = sta->pasn;
-       struct pasn_fils_data *fils = &pasn->fils;
+       struct wpas_pasn *pasn = sta->pasn;
+       struct pasn_fils *fils = &pasn->fils;
        struct wpabuf *buf = NULL;
 
        if (!fils->erp_resp) {
@@ -2623,8 +2624,8 @@ static void pasn_fils_auth_resp(struct hostapd_data *hapd,
                                struct wpabuf *erp_resp,
                                const u8 *msk, size_t msk_len)
 {
-       struct pasn_data *pasn = sta->pasn;
-       struct pasn_fils_data *fils = &pasn->fils;
+       struct wpas_pasn *pasn = sta->pasn;
+       struct pasn_fils *fils = &pasn->fils;
        u8 pmk[PMK_LEN_MAX];
        size_t pmk_len;
        int ret;
@@ -2702,8 +2703,8 @@ static int pasn_wd_handle_fils(struct hostapd_data *hapd, struct sta_info *sta,
        wpa_printf(MSG_DEBUG, "PASN: FILS: RADIUS is not configured. Fail");
        return -1;
 #else /* CONFIG_NO_RADIUS */
-       struct pasn_data *pasn = sta->pasn;
-       struct pasn_fils_data *fils = &pasn->fils;
+       struct wpas_pasn *pasn = sta->pasn;
+       struct pasn_fils *fils = &pasn->fils;
        struct ieee802_11_elems elems;
        struct wpa_ie_data rsne_data;
        struct wpabuf *fils_wd;
index d2a8344ad0d28325d1efacbac642adfc6306b5f4..eef40b501e9fc434e20466cb147397ef64a7b25d 100644 (file)
@@ -16,6 +16,7 @@
 #include "common/ieee802_11_defs.h"
 #include "common/sae.h"
 #include "crypto/sha384.h"
+#include "pasn/pasn_common.h"
 
 /* STA flags */
 #define WLAN_STA_AUTH BIT(0)
@@ -68,44 +69,6 @@ struct pending_eapol_rx {
        enum frame_encryption encrypted;
 };
 
-enum pasn_fils_state {
-       PASN_FILS_STATE_NONE = 0,
-       PASN_FILS_STATE_PENDING_AS,
-       PASN_FILS_STATE_COMPLETE
-};
-
-struct pasn_fils_data {
-       u8 state;
-       u8 nonce[FILS_NONCE_LEN];
-       u8 anonce[FILS_NONCE_LEN];
-       u8 session[FILS_SESSION_LEN];
-       u8 erp_pmkid[PMKID_LEN];
-
-       struct wpabuf *erp_resp;
-};
-
-struct pasn_data {
-       int akmp;
-       int cipher;
-       u16 group;
-       bool secure_ltf;
-       u8 trans_seq;
-       u8 wrapped_data_format;
-       size_t kdk_len;
-
-       u8 hash[SHA384_MAC_LEN];
-       struct wpa_ptk ptk;
-       struct crypto_ecdh *ecdh;
-
-       struct wpabuf *secret;
-#ifdef CONFIG_SAE
-       struct sae_data sae;
-#endif /* CONFIG_SAE */
-#ifdef CONFIG_FILS
-       struct pasn_fils_data fils;
-#endif /* CONFIG_FILS */
-};
-
 struct sta_info {
        struct sta_info *next; /* next entry in sta list */
        struct sta_info *hnext; /* next entry in hash table list */
@@ -333,7 +296,7 @@ struct sta_info {
 #endif /* CONFIG_AIRTIME_POLICY */
 
 #ifdef CONFIG_PASN
-       struct pasn_data *pasn;
+       struct wpas_pasn *pasn;
 #endif /* CONFIG_PASN */
 };
 
index cefe784d5b7f633e44804f04b160dec316a833b4..f9839359f50319cfe48f3d144d93c04cc49e7f13 100644 (file)
@@ -18,12 +18,20 @@ extern "C" {
 
 #ifdef CONFIG_PASN
 
+enum pasn_fils_state {
+       PASN_FILS_STATE_NONE = 0,
+       PASN_FILS_STATE_PENDING_AS,
+       PASN_FILS_STATE_COMPLETE
+};
+
 struct pasn_fils {
+       u8 state;
        u8 nonce[FILS_NONCE_LEN];
        u8 anonce[FILS_NONCE_LEN];
        u8 session[FILS_SESSION_LEN];
        u8 erp_pmkid[PMKID_LEN];
        bool completed;
+       struct wpabuf *erp_resp;
 };
 
 struct wpas_pasn {
@@ -82,6 +90,9 @@ struct wpas_pasn {
        u16 rsnxe_capab;
        int network_id;
 
+       u8 wrapped_data_format;
+       struct wpabuf *secret;
+
        /**
         * send_mgmt - Function handler to transmit a Management frame
         * @ctx: Callback context from cb_ctx