[PATCH 04/29] 11bi: Rename FILS nonce element and related constants to generic 'nonce'

Sai Pratyusha Magam smagam at qti.qualcomm.com
Thu Dec 11 05:14:18 PST 2025


From: Ainy Kumari <ainy.kumari at oss.qualcomm.com>

Previously, the nonce element and related constants were used
exclusively in FILS authentication frames.

Rename the nonce element and related constants to reflect their
broader usage beyond FILS authentication frames, as specified in
P802.11bi/D2.1,9.4.2.188.

Signed-off-by: Ainy Kumari <ainy.kumari at oss.qualcomm.com>
---
 src/ap/ieee802_11.c            | 32 +++++++++++++++---------------
 src/ap/sta_info.h              |  2 +-
 src/ap/wpa_auth.c              | 12 ++++++------
 src/common/ieee802_11_common.c | 10 +++++-----
 src/common/ieee802_11_common.h |  2 +-
 src/common/ieee802_11_defs.h   |  4 ++--
 src/common/wpa_common.c        | 36 +++++++++++++++++-----------------
 src/drivers/driver_atheros.c   |  8 ++++----
 src/pasn/pasn_common.h         |  4 ++--
 src/pasn/pasn_initiator.c      | 20 +++++++++----------
 src/pasn/pasn_responder.c      |  6 +++---
 src/rsn_supp/wpa.c             | 20 +++++++++----------
 src/rsn_supp/wpa_i.h           |  4 ++--
 wlantest/rx_mgmt.c             | 14 ++++++-------
 wpa_supplicant/sme.c           |  6 +++---
 15 files changed, 90 insertions(+), 90 deletions(-)

diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index df315a3a5..b7271012d 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -2292,14 +2292,14 @@ void handle_auth_fils(struct hostapd_data *hapd, struct sta_info *sta,
 	if (resp != WLAN_STATUS_SUCCESS)
 		goto fail;
 
-	if (!elems.fils_nonce) {
+	if (!elems.nonce) {
 		wpa_printf(MSG_DEBUG, "FILS: No FILS Nonce field");
 		resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
 		goto fail;
 	}
-	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", elems.fils_nonce,
-		    FILS_NONCE_LEN);
-	os_memcpy(sta->fils_snonce, elems.fils_nonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", elems.nonce,
+		    NONCE_LEN);
+	os_memcpy(sta->fils_snonce, elems.nonce, NONCE_LEN);
 
 	/* PMKID List */
 	if (rsn.pmkid && rsn.num_pmkid > 0) {
@@ -2407,7 +2407,7 @@ prepare_auth_resp_fils(struct hostapd_data *hapd,
 		       const u8 *msk, size_t msk_len,
 		       int *is_pub)
 {
-	u8 fils_nonce[FILS_NONCE_LEN];
+	u8 fils_nonce[NONCE_LEN];
 	size_t ielen;
 	struct wpabuf *data = NULL;
 	const u8 *ie;
@@ -2442,12 +2442,12 @@ prepare_auth_resp_fils(struct hostapd_data *hapd,
 		ie = ie_buf;
 	}
 
-	if (random_get_bytes(fils_nonce, FILS_NONCE_LEN) < 0) {
+	if (random_get_bytes(fils_nonce, NONCE_LEN) < 0) {
 		*resp = WLAN_STATUS_UNSPECIFIED_FAILURE;
 		goto fail;
 	}
 	wpa_hexdump(MSG_DEBUG, "RSN: Generated FILS Nonce",
-		    fils_nonce, FILS_NONCE_LEN);
+		    fils_nonce, NONCE_LEN);
 
 #ifdef CONFIG_FILS_SK_PFS
 	if (sta->fils_dh_ss && sta->fils_ecdh) {
@@ -2499,10 +2499,10 @@ prepare_auth_resp_fils(struct hostapd_data *hapd,
 
 	/* FILS Nonce */
 	wpabuf_put_u8(data, WLAN_EID_EXTENSION); /* Element ID */
-	wpabuf_put_u8(data, 1 + FILS_NONCE_LEN); /* Length */
+	wpabuf_put_u8(data, 1 + NONCE_LEN); /* Length */
 	/* Element ID Extension */
-	wpabuf_put_u8(data, WLAN_EID_EXT_FILS_NONCE);
-	wpabuf_put_data(data, fils_nonce, FILS_NONCE_LEN);
+	wpabuf_put_u8(data, WLAN_EID_EXT_NONCE);
+	wpabuf_put_data(data, fils_nonce, NONCE_LEN);
 
 	/* FILS Session */
 	wpabuf_put_u8(data, WLAN_EID_EXTENSION); /* Element ID */
@@ -2788,13 +2788,13 @@ static void pasn_fils_auth_resp(struct hostapd_data *hapd,
 		goto fail;
 	}
 
-	if (random_get_bytes(fils->anonce, FILS_NONCE_LEN) < 0) {
+	if (random_get_bytes(fils->anonce, NONCE_LEN) < 0) {
 		wpa_printf(MSG_DEBUG, "PASN: FILS: Failed to get ANonce");
 		goto fail;
 	}
 
 	wpa_hexdump(MSG_DEBUG, "RSN: Generated FILS ANonce",
-		    fils->anonce, FILS_NONCE_LEN);
+		    fils->anonce, NONCE_LEN);
 
 	ret = fils_rmsk_to_pmk(pasn_get_akmp(pasn), msk, msk_len, fils->nonce,
 			       fils->anonce, NULL, 0, pmk, &pmk_len);
@@ -2906,7 +2906,7 @@ static int pasn_wd_handle_fils(struct hostapd_data *hapd, struct sta_info *sta,
 		return -1;
 	}
 
-	if (!elems.rsn_ie || !elems.fils_nonce || !elems.fils_nonce ||
+	if (!elems.rsn_ie || !elems.nonce || !elems.nonce ||
 	    !elems.wrapped_data || !elems.fils_session) {
 		wpa_printf(MSG_DEBUG, "PASN: FILS: Missing IEs");
 		return -1;
@@ -2931,9 +2931,9 @@ static int pasn_wd_handle_fils(struct hostapd_data *hapd, struct sta_info *sta,
 		return -1;
 	}
 
-	wpa_hexdump(MSG_DEBUG, "PASN: FILS: Nonce", elems.fils_nonce,
-		    FILS_NONCE_LEN);
-	os_memcpy(fils->nonce, elems.fils_nonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "PASN: FILS: Nonce", elems.nonce,
+		    NONCE_LEN);
+	os_memcpy(fils->nonce, elems.nonce, NONCE_LEN);
 
 	wpa_hexdump(MSG_DEBUG, "PASN: FILS: Session", elems.fils_session,
 		    FILS_SESSION_LEN);
diff --git a/src/ap/sta_info.h b/src/ap/sta_info.h
index 4f41f7028..3fb97edd5 100644
--- a/src/ap/sta_info.h
+++ b/src/ap/sta_info.h
@@ -262,7 +262,7 @@ struct sta_info {
 #endif /* CONFIG_TAXONOMY */
 
 #ifdef CONFIG_FILS
-	u8 fils_snonce[FILS_NONCE_LEN];
+	u8 fils_snonce[NONCE_LEN];
 	u8 fils_session[FILS_SESSION_LEN];
 	u8 fils_erp_pmkid[PMKID_LEN];
 	u8 *fils_pending_assoc_req;
diff --git a/src/ap/wpa_auth.c b/src/ap/wpa_auth.c
index 49268b21e..620e55387 100644
--- a/src/ap/wpa_auth.c
+++ b/src/ap/wpa_auth.c
@@ -3131,8 +3131,8 @@ int fils_auth_pmk_to_ptk(struct wpa_state_machine *sm, const u8 *pmk,
 	forced_memzero(ick, sizeof(ick));
 
 	/* Store nonces for (Re)Association Request/Response frame processing */
-	os_memcpy(sm->SNonce, snonce, FILS_NONCE_LEN);
-	os_memcpy(sm->ANonce, anonce, FILS_NONCE_LEN);
+	os_memcpy(sm->SNonce, snonce, NONCE_LEN);
+	os_memcpy(sm->ANonce, anonce, NONCE_LEN);
 
 	return res;
 }
@@ -3349,10 +3349,10 @@ int fils_decrypt_assoc(struct wpa_state_machine *sm, const u8 *fils_session,
 	aad_len[1] = ETH_ALEN;
 	/* The STA's nonce */
 	aad[2] = sm->SNonce;
-	aad_len[2] = FILS_NONCE_LEN;
+	aad_len[2] = NONCE_LEN;
 	/* The AP's nonce */
 	aad[3] = sm->ANonce;
-	aad_len[3] = FILS_NONCE_LEN;
+	aad_len[3] = NONCE_LEN;
 	/*
 	 * The (Re)Association Request frame from the Capability Information
 	 * field to the FILS Session element (both inclusive).
@@ -3408,10 +3408,10 @@ int fils_encrypt_assoc(struct wpa_state_machine *sm, u8 *buf,
 	aad_len[1] = ETH_ALEN;
 	/* The AP's nonce */
 	aad[2] = sm->ANonce;
-	aad_len[2] = FILS_NONCE_LEN;
+	aad_len[2] = NONCE_LEN;
 	/* The STA's nonce */
 	aad[3] = sm->SNonce;
-	aad_len[3] = FILS_NONCE_LEN;
+	aad_len[3] = NONCE_LEN;
 	/*
 	 * The (Re)Association Response frame from the Capability Information
 	 * field (the same offset in both Association and Reassociation
diff --git a/src/common/ieee802_11_common.c b/src/common/ieee802_11_common.c
index a0b51c014..5e0141b63 100644
--- a/src/common/ieee802_11_common.c
+++ b/src/common/ieee802_11_common.c
@@ -362,10 +362,10 @@ static int ieee802_11_parse_extension(const u8 *pos, size_t elen,
 		elems->fils_pk = pos;
 		elems->fils_pk_len = elen;
 		break;
-	case WLAN_EID_EXT_FILS_NONCE:
-		if (elen != FILS_NONCE_LEN)
+	case WLAN_EID_EXT_NONCE:
+		if (elen != NONCE_LEN)
 			break;
-		elems->fils_nonce = pos;
+		elems->nonce = pos;
 		break;
 	case WLAN_EID_EXT_OWE_DH_PARAM:
 		if (elen < 2)
@@ -933,8 +933,8 @@ void ieee802_11_elems_clear_ext_ids(struct ieee802_11_elems *elems,
 			elems->fils_pk = NULL;
 			elems->fils_pk_len = 0;
 			break;
-		case WLAN_EID_EXT_FILS_NONCE:
-			elems->fils_nonce = NULL;
+		case WLAN_EID_EXT_NONCE:
+			elems->nonce = NULL;
 			break;
 		case WLAN_EID_EXT_OWE_DH_PARAM:
 			elems->owe_dh = NULL;
diff --git a/src/common/ieee802_11_common.h b/src/common/ieee802_11_common.h
index af011a357..42f61a018 100644
--- a/src/common/ieee802_11_common.h
+++ b/src/common/ieee802_11_common.h
@@ -94,7 +94,7 @@ struct ieee802_11_elems {
 	const u8 *key_delivery;
 	const u8 *wrapped_data;
 	const u8 *fils_pk;
-	const u8 *fils_nonce;
+	const u8 *nonce;
 	const u8 *owe_dh;
 	const u8 *power_capab;
 	const u8 *roaming_cons_sel;
diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h
index d969f0503..09666304a 100644
--- a/src/common/ieee802_11_defs.h
+++ b/src/common/ieee802_11_defs.h
@@ -496,7 +496,7 @@
 #define WLAN_EID_EXT_EXTENDED_REQUEST 10
 #define WLAN_EID_EXT_ESTIMATED_SERVICE_PARAMS 11
 #define WLAN_EID_EXT_FILS_PUBLIC_KEY 12
-#define WLAN_EID_EXT_FILS_NONCE 13
+#define WLAN_EID_EXT_NONCE 13
 #define WLAN_EID_EXT_FUTURE_CHANNEL_GUIDANCE 14
 #define WLAN_EID_EXT_OWE_DH_PARAM 32
 #define WLAN_EID_EXT_PASSWORD_IDENTIFIER 33
@@ -966,7 +966,7 @@ enum lci_req_subelem {
 	LCI_REQ_SUBELEM_MAX_AGE = 4,
 };
 
-#define FILS_NONCE_LEN 16
+#define NONCE_LEN 16
 #define FILS_SESSION_LEN 8
 #define FILS_CACHE_ID_LEN 2
 #define FILS_MAX_KEY_AUTH_LEN 48
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 80c33ca87..171f0736c 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -726,7 +726,7 @@ int fils_rmsk_to_pmk(int akmp, const u8 *rmsk, size_t rmsk_len,
 		     const u8 *snonce, const u8 *anonce, const u8 *dh_ss,
 		     size_t dh_ss_len, u8 *pmk, size_t *pmk_len)
 {
-	u8 nonces[2 * FILS_NONCE_LEN];
+	u8 nonces[2 * NONCE_LEN];
 	const u8 *addr[2];
 	size_t len[2];
 	size_t num_elem;
@@ -743,12 +743,12 @@ int fils_rmsk_to_pmk(int akmp, const u8 *rmsk, size_t rmsk_len,
 		return -1;
 
 	wpa_hexdump_key(MSG_DEBUG, "FILS: rMSK", rmsk, rmsk_len);
-	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, FILS_NONCE_LEN);
-	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, NONCE_LEN);
 	wpa_hexdump(MSG_DEBUG, "FILS: DHss", dh_ss, dh_ss_len);
 
-	os_memcpy(nonces, snonce, FILS_NONCE_LEN);
-	os_memcpy(&nonces[FILS_NONCE_LEN], anonce, FILS_NONCE_LEN);
+	os_memcpy(nonces, snonce, NONCE_LEN);
+	os_memcpy(&nonces[NONCE_LEN], anonce, NONCE_LEN);
 	addr[0] = rmsk;
 	len[0] = rmsk_len;
 	num_elem = 1;
@@ -758,10 +758,10 @@ int fils_rmsk_to_pmk(int akmp, const u8 *rmsk, size_t rmsk_len,
 		num_elem++;
 	}
 	if (wpa_key_mgmt_sha384(akmp))
-		res = hmac_sha384_vector(nonces, 2 * FILS_NONCE_LEN, num_elem,
+		res = hmac_sha384_vector(nonces, 2 * NONCE_LEN, num_elem,
 					 addr, len, pmk);
 	else
-		res = hmac_sha256_vector(nonces, 2 * FILS_NONCE_LEN, num_elem,
+		res = hmac_sha256_vector(nonces, 2 * NONCE_LEN, num_elem,
 					 addr, len, pmk);
 	if (res == 0)
 		wpa_hexdump_key(MSG_DEBUG, "FILS: PMK", pmk, *pmk_len);
@@ -824,7 +824,7 @@ int fils_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const u8 *spa, const u8 *aa,
 	 * KDK = L(FILS-Key-Data, ICK_bits + KEK_bits + TK_bits + FILS-FT_bits,
 	 *	   KDK_bits)
 	 */
-	data_len = 2 * ETH_ALEN + 2 * FILS_NONCE_LEN + dhss_len;
+	data_len = 2 * ETH_ALEN + 2 * NONCE_LEN + dhss_len;
 	data = os_malloc(data_len);
 	if (!data)
 		goto err;
@@ -833,10 +833,10 @@ int fils_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const u8 *spa, const u8 *aa,
 	pos += ETH_ALEN;
 	os_memcpy(pos, aa, ETH_ALEN);
 	pos += ETH_ALEN;
-	os_memcpy(pos, snonce, FILS_NONCE_LEN);
-	pos += FILS_NONCE_LEN;
-	os_memcpy(pos, anonce, FILS_NONCE_LEN);
-	pos += FILS_NONCE_LEN;
+	os_memcpy(pos, snonce, NONCE_LEN);
+	pos += NONCE_LEN;
+	os_memcpy(pos, anonce, NONCE_LEN);
+	pos += NONCE_LEN;
 	if (dhss)
 		os_memcpy(pos, dhss, dhss_len);
 
@@ -890,8 +890,8 @@ int fils_pmk_to_ptk(const u8 *pmk, size_t pmk_len, const u8 *spa, const u8 *aa,
 
 	wpa_printf(MSG_DEBUG, "FILS: PTK derivation - SPA=" MACSTR
 		   " AA=" MACSTR, MAC2STR(spa), MAC2STR(aa));
-	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, FILS_NONCE_LEN);
-	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, NONCE_LEN);
 	if (dhss)
 		wpa_hexdump_key(MSG_DEBUG, "FILS: DHss", dhss, dhss_len);
 	wpa_hexdump_key(MSG_DEBUG, "FILS: PMK", pmk, pmk_len);
@@ -947,8 +947,8 @@ int fils_key_auth_sk(const u8 *ick, size_t ick_len, const u8 *snonce,
 	wpa_printf(MSG_DEBUG, "FILS: Key-Auth derivation: STA-MAC=" MACSTR
 		   " AP-BSSID=" MACSTR, MAC2STR(sta_addr), MAC2STR(bssid));
 	wpa_hexdump_key(MSG_DEBUG, "FILS: ICK", ick, ick_len);
-	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, FILS_NONCE_LEN);
-	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: SNonce", snonce, NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", anonce, NONCE_LEN);
 	wpa_hexdump(MSG_DEBUG, "FILS: gSTA", g_sta, g_sta_len);
 	wpa_hexdump(MSG_DEBUG, "FILS: gAP", g_ap, g_ap_len);
 
@@ -958,9 +958,9 @@ int fils_key_auth_sk(const u8 *ick, size_t ick_len, const u8 *snonce,
 	 *                      [ || gSTA || gAP ])
 	 */
 	addr[0] = snonce;
-	len[0] = FILS_NONCE_LEN;
+	len[0] = NONCE_LEN;
 	addr[1] = anonce;
-	len[1] = FILS_NONCE_LEN;
+	len[1] = NONCE_LEN;
 	addr[2] = sta_addr;
 	len[2] = ETH_ALEN;
 	addr[3] = bssid;
diff --git a/src/drivers/driver_atheros.c b/src/drivers/driver_atheros.c
index 94db413eb..eec0adc70 100644
--- a/src/drivers/driver_atheros.c
+++ b/src/drivers/driver_atheros.c
@@ -1083,17 +1083,17 @@ atheros_sta_auth(void *priv, struct wpa_driver_sta_auth_params *params)
 		wpa_printf(MSG_DEBUG, "%s: im_op IEEE80211_MLME_AUTH_FILS",
 			   __func__);
 		os_memcpy(mlme.fils_aad.ANonce, params->fils_anonce,
-			  IEEE80211_FILS_NONCE_LEN);
+			  IEEE80211_NONCE_LEN);
 		os_memcpy(mlme.fils_aad.SNonce, params->fils_snonce,
-			  IEEE80211_FILS_NONCE_LEN);
+			  IEEE80211_NONCE_LEN);
 		os_memcpy(mlme.fils_aad.kek, params->fils_kek,
 			  IEEE80211_MAX_WPA_KEK_LEN);
 		mlme.fils_aad.kek_len = params->fils_kek_len;
 		mlme.im_op = IEEE80211_MLME_AUTH_FILS;
 		wpa_hexdump(MSG_DEBUG, "FILS: ANonce",
-			    mlme.fils_aad.ANonce, FILS_NONCE_LEN);
+			    mlme.fils_aad.ANonce, NONCE_LEN);
 		wpa_hexdump(MSG_DEBUG, "FILS: SNonce",
-			    mlme.fils_aad.SNonce, FILS_NONCE_LEN);
+			    mlme.fils_aad.SNonce, NONCE_LEN);
 		wpa_hexdump_key(MSG_DEBUG, "FILS: KEK",
 				mlme.fils_aad.kek, mlme.fils_aad.kek_len);
 	} else {
diff --git a/src/pasn/pasn_common.h b/src/pasn/pasn_common.h
index e0bd682fa..4b300604b 100644
--- a/src/pasn/pasn_common.h
+++ b/src/pasn/pasn_common.h
@@ -31,8 +31,8 @@ enum pasn_fils_state {
 
 struct pasn_fils {
 	u8 state;
-	u8 nonce[FILS_NONCE_LEN];
-	u8 anonce[FILS_NONCE_LEN];
+	u8 nonce[NONCE_LEN];
+	u8 anonce[NONCE_LEN];
 	u8 session[FILS_SESSION_LEN];
 	u8 erp_pmkid[PMKID_LEN];
 	bool completed;
diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c
index 2166060df..ee72d21b6 100644
--- a/src/pasn/pasn_initiator.c
+++ b/src/pasn/pasn_initiator.c
@@ -272,12 +272,12 @@ static struct wpabuf * wpas_pasn_fils_build_auth(struct pasn_data *pasn)
 		return NULL;
 	}
 
-	if (random_get_bytes(pasn->fils.nonce, FILS_NONCE_LEN) < 0 ||
+	if (random_get_bytes(pasn->fils.nonce, NONCE_LEN) < 0 ||
 	    random_get_bytes(pasn->fils.session, FILS_SESSION_LEN) < 0)
 		goto fail;
 
 	wpa_hexdump(MSG_DEBUG, "PASN: FILS: Nonce", pasn->fils.nonce,
-		    FILS_NONCE_LEN);
+		    NONCE_LEN);
 
 	wpa_hexdump(MSG_DEBUG, "PASN: FILS: Session", pasn->fils.session,
 		    FILS_SESSION_LEN);
@@ -300,9 +300,9 @@ static struct wpabuf * wpas_pasn_fils_build_auth(struct pasn_data *pasn)
 
 	/* FILS Nonce */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION);
-	wpabuf_put_u8(buf, 1 + FILS_NONCE_LEN);
-	wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_NONCE);
-	wpabuf_put_data(buf, pasn->fils.nonce, FILS_NONCE_LEN);
+	wpabuf_put_u8(buf, 1 + NONCE_LEN);
+	wpabuf_put_u8(buf, WLAN_EID_EXT_NONCE);
+	wpabuf_put_data(buf, pasn->fils.nonce, NONCE_LEN);
 
 	/* FILS Session */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION);
@@ -365,7 +365,7 @@ static int wpas_pasn_wd_fils_rx(struct pasn_data *pasn, struct wpabuf *wd)
 	struct wpa_ie_data rsne_data;
 	u8 rmsk[ERP_MAX_KEY_LEN];
 	size_t rmsk_len;
-	u8 anonce[FILS_NONCE_LEN];
+	u8 anonce[NONCE_LEN];
 	const u8 *data;
 	size_t buf_len;
 	struct wpabuf *fils_wd = NULL;
@@ -409,7 +409,7 @@ static int wpas_pasn_wd_fils_rx(struct pasn_data *pasn, struct wpabuf *wd)
 		return -1;
 	}
 
-	if (!elems.rsn_ie || !elems.fils_nonce || !elems.fils_nonce ||
+	if (!elems.rsn_ie || !elems.nonce || !elems.nonce ||
 	    !elems.wrapped_data) {
 		wpa_printf(MSG_DEBUG, "PASN: FILS: Missing IEs");
 		return -1;
@@ -434,9 +434,9 @@ static int wpas_pasn_wd_fils_rx(struct pasn_data *pasn, struct wpabuf *wd)
 		return -1;
 	}
 
-	wpa_hexdump(MSG_DEBUG, "PASN: FILS: ANonce", elems.fils_nonce,
-		    FILS_NONCE_LEN);
-	os_memcpy(anonce, elems.fils_nonce, FILS_NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "PASN: FILS: ANonce", elems.nonce,
+		    NONCE_LEN);
+	os_memcpy(anonce, elems.nonce, NONCE_LEN);
 
 	wpa_hexdump(MSG_DEBUG, "PASN: FILS: FILS Session", elems.fils_session,
 		    FILS_SESSION_LEN);
diff --git a/src/pasn/pasn_responder.c b/src/pasn/pasn_responder.c
index 813fc572d..9104f45d1 100644
--- a/src/pasn/pasn_responder.c
+++ b/src/pasn/pasn_responder.c
@@ -304,9 +304,9 @@ static struct wpabuf * pasn_get_fils_wd(struct pasn_data *pasn)
 
 	/* FILS Nonce */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION);
-	wpabuf_put_u8(buf, 1 + FILS_NONCE_LEN);
-	wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_NONCE);
-	wpabuf_put_data(buf, fils->anonce, FILS_NONCE_LEN);
+	wpabuf_put_u8(buf, 1 + NONCE_LEN);
+	wpabuf_put_u8(buf, WLAN_EID_EXT_NONCE);
+	wpabuf_put_data(buf, fils->anonce, NONCE_LEN);
 
 	/* FILS Session */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION);
diff --git a/src/rsn_supp/wpa.c b/src/rsn_supp/wpa.c
index 70812f4b1..01ca1679d 100644
--- a/src/rsn_supp/wpa.c
+++ b/src/rsn_supp/wpa.c
@@ -6059,12 +6059,12 @@ struct wpabuf * fils_build_auth(struct wpa_sm *sm, int dh_group, const u8 *md)
 		goto fail;
 	}
 
-	if (random_get_bytes(sm->fils_nonce, FILS_NONCE_LEN) < 0 ||
+	if (random_get_bytes(sm->fils_nonce, NONCE_LEN) < 0 ||
 	    random_get_bytes(sm->fils_session, FILS_SESSION_LEN) < 0)
 		goto fail;
 
 	wpa_hexdump(MSG_DEBUG, "FILS: Generated FILS Nonce",
-		    sm->fils_nonce, FILS_NONCE_LEN);
+		    sm->fils_nonce, NONCE_LEN);
 	wpa_hexdump(MSG_DEBUG, "FILS: Generated FILS Session",
 		    sm->fils_session, FILS_SESSION_LEN);
 
@@ -6129,10 +6129,10 @@ struct wpabuf * fils_build_auth(struct wpa_sm *sm, int dh_group, const u8 *md)
 
 	/* FILS Nonce */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION); /* Element ID */
-	wpabuf_put_u8(buf, 1 + FILS_NONCE_LEN); /* Length */
+	wpabuf_put_u8(buf, 1 + NONCE_LEN); /* Length */
 	/* Element ID Extension */
-	wpabuf_put_u8(buf, WLAN_EID_EXT_FILS_NONCE);
-	wpabuf_put_data(buf, sm->fils_nonce, FILS_NONCE_LEN);
+	wpabuf_put_u8(buf, WLAN_EID_EXT_NONCE);
+	wpabuf_put_data(buf, sm->fils_nonce, NONCE_LEN);
 
 	/* FILS Session */
 	wpabuf_put_u8(buf, WLAN_EID_EXTENSION); /* Element ID */
@@ -6257,12 +6257,12 @@ int fils_process_auth(struct wpa_sm *sm, const u8 *bssid, const u8 *data,
 		goto fail;
 	}
 
-	if (!elems.fils_nonce) {
+	if (!elems.nonce) {
 		wpa_printf(MSG_DEBUG, "FILS: No FILS Nonce field");
 		goto fail;
 	}
-	os_memcpy(sm->fils_anonce, elems.fils_nonce, FILS_NONCE_LEN);
-	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", sm->fils_anonce, FILS_NONCE_LEN);
+	os_memcpy(sm->fils_anonce, elems.nonce, NONCE_LEN);
+	wpa_hexdump(MSG_DEBUG, "FILS: ANonce", sm->fils_anonce, NONCE_LEN);
 
 #ifdef CONFIG_IEEE80211R
 	if (wpa_key_mgmt_ft(sm->key_mgmt)) {
@@ -6722,10 +6722,10 @@ struct wpabuf * fils_build_assoc_req(struct wpa_sm *sm, const u8 **kek,
 	wpa_hexdump_key(MSG_DEBUG, "FILS: KEK for AEAD", *kek, *kek_len);
 	*snonce = sm->fils_nonce;
 	wpa_hexdump(MSG_DEBUG, "FILS: SNonce for AEAD AAD",
-		    *snonce, FILS_NONCE_LEN);
+		    *snonce, NONCE_LEN);
 	*anonce = sm->fils_anonce;
 	wpa_hexdump(MSG_DEBUG, "FILS: ANonce for AEAD AAD",
-		    *anonce, FILS_NONCE_LEN);
+		    *anonce, NONCE_LEN);
 
 	return buf;
 }
diff --git a/src/rsn_supp/wpa_i.h b/src/rsn_supp/wpa_i.h
index 9f9a032f1..d0c3541b5 100644
--- a/src/rsn_supp/wpa_i.h
+++ b/src/rsn_supp/wpa_i.h
@@ -205,9 +205,9 @@ struct wpa_sm {
 #endif /* CONFIG_TESTING_OPTIONS */
 
 #ifdef CONFIG_FILS
-	u8 fils_nonce[FILS_NONCE_LEN];
+	u8 fils_nonce[NONCE_LEN];
 	u8 fils_session[FILS_SESSION_LEN];
-	u8 fils_anonce[FILS_NONCE_LEN];
+	u8 fils_anonce[NONCE_LEN];
 	u8 fils_key_auth_ap[FILS_MAX_KEY_AUTH_LEN];
 	u8 fils_key_auth_sta[FILS_MAX_KEY_AUTH_LEN];
 	size_t fils_key_auth_len;
diff --git a/wlantest/rx_mgmt.c b/wlantest/rx_mgmt.c
index c2f2c47a0..4276a41ad 100644
--- a/wlantest/rx_mgmt.c
+++ b/wlantest/rx_mgmt.c
@@ -987,16 +987,16 @@ static void process_fils_auth(struct wlantest *wt, struct wlantest_bss *bss,
 		sta->pairwise_cipher = data.pairwise_cipher;
 	}
 
-	if (!elems.fils_nonce) {
+	if (!elems.nonce) {
 		add_note(wt, MSG_INFO,
 			 "FILS Authentication frame missing nonce");
 		return;
 	}
 
 	if (ether_addr_equal(mgmt->sa, mgmt->bssid))
-		os_memcpy(sta->anonce, elems.fils_nonce, FILS_NONCE_LEN);
+		os_memcpy(sta->anonce, elems.nonce, NONCE_LEN);
 	else
-		os_memcpy(sta->snonce, elems.fils_nonce, FILS_NONCE_LEN);
+		os_memcpy(sta->snonce, elems.nonce, NONCE_LEN);
 }
 
 
@@ -1364,10 +1364,10 @@ static int try_rmsk(struct wlantest *wt, struct wlantest_bss *bss,
 	aad_len[1] = ETH_ALEN;
 	/* The STA's nonce */
 	aad[2] = sta->snonce;
-	aad_len[2] = FILS_NONCE_LEN;
+	aad_len[2] = NONCE_LEN;
 	/* The AP's nonce */
 	aad[3] = sta->anonce;
-	aad_len[3] = FILS_NONCE_LEN;
+	aad_len[3] = NONCE_LEN;
 	/*
 	 * The (Re)Association Request frame from the Capability Information
 	 * field to the FILS Session element (both inclusive).
@@ -1585,10 +1585,10 @@ static void decrypt_fils_assoc_resp(struct wlantest *wt,
 	aad_len[1] = ETH_ALEN;
 	/* The AP's nonce */
 	aad[2] = sta->anonce;
-	aad_len[2] = FILS_NONCE_LEN;
+	aad_len[2] = NONCE_LEN;
 	/* The STA's nonce */
 	aad[3] = sta->snonce;
-	aad_len[3] = FILS_NONCE_LEN;
+	aad_len[3] = NONCE_LEN;
 	/*
 	 * The (Re)Association Response frame from the Capability Information
 	 * field to the FILS Session element (both inclusive).
diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index f9f5fd4a5..dfa71581e 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -2286,7 +2286,7 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
 	struct ieee802_11_elems elems;
 	struct wpa_ssid *ssid = wpa_s->current_ssid;
 #ifdef CONFIG_FILS
-	u8 nonces[2 * FILS_NONCE_LEN];
+	u8 nonces[2 * NONCE_LEN];
 #endif /* CONFIG_FILS */
 #ifdef CONFIG_HT_OVERRIDES
 	struct ieee80211_ht_capabilities htcaps;
@@ -2378,8 +2378,8 @@ void sme_associate(struct wpa_supplicant *wpa_s, enum wpas_mode mode,
 			    wpa_s->sme.assoc_req_ie,
 			    wpa_s->sme.assoc_req_ie_len);
 
-		os_memcpy(nonces, snonce, FILS_NONCE_LEN);
-		os_memcpy(nonces + FILS_NONCE_LEN, anonce, FILS_NONCE_LEN);
+		os_memcpy(nonces, snonce, NONCE_LEN);
+		os_memcpy(nonces + NONCE_LEN, anonce, NONCE_LEN);
 		params.fils_nonces = nonces;
 		params.fils_nonces_len = sizeof(nonces);
 	}
-- 
2.34.1




More information about the Hostap mailing list