[PATCH 08/10] PASN: SMD: Include SMD Identifier in PASN PTK derivation
Pooventhiran G
pooventhiran.g at oss.qualcomm.com
Sat Nov 21 12:34:17 PST 2026
From: Sidhanta Sahu <sidhanta.sahu at oss.qualcomm.com>
If the non-AP MLD has negotiated SMD with the AP MLD and PASN PTK is to
be derived, derive the PTK for this association including the SMD
identifier.
Signed-off-by: Sidhanta Sahu <sidhanta.sahu at oss.qualcomm.com>
Co-developed-by: Pooventhiran G <pooventhiran.g at oss.qualcomm.com>
Signed-off-by: Pooventhiran G <pooventhiran.g at oss.qualcomm.com>
---
src/ap/ieee802_11.c | 15 ++++++++++++++-
src/common/common_module_tests.c | 2 +-
src/common/wpa_common.c | 17 +++++++++++++++--
src/common/wpa_common.h | 2 +-
src/pasn/pasn_common.h | 2 ++
src/pasn/pasn_initiator.c | 3 ++-
src/pasn/pasn_responder.c | 3 ++-
7 files changed, 37 insertions(+), 7 deletions(-)
diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c
index 9d35c2e393b3..da04cd713678 100644
--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -4759,6 +4759,7 @@ static void pasn_fils_auth_resp(struct hostapd_data *hapd,
struct pasn_fils *fils = &pasn->fils;
u8 pmk[PMK_LEN_MAX];
size_t pmk_len;
+ const u8 *smd_identifier = NULL;
int ret;
wpa_printf(MSG_DEBUG, "PASN: FILS: Handle AS response - status=%u",
@@ -4787,13 +4788,20 @@ static void pasn_fils_auth_resp(struct hostapd_data *hapd,
goto fail;
}
+#ifdef CONFIG_IEEE80211BN
+ /* TODO: Fix PASN FILS */
+ if (hapd->conf->smd.enabled)
+ smd_identifier = hapd->conf->smd.identifier;
+#endif /* CONFIG_IEEE80211BN */
+
ret = pasn_pmk_to_ptk(pmk, pmk_len, sta->addr, hapd->own_addr,
wpabuf_head(pasn->secret),
wpabuf_len(pasn->secret),
pasn_get_ptk(sta->pasn), pasn_get_akmp(sta->pasn),
pasn_get_cipher(sta->pasn), sta->pasn->kdk_len,
sta->pasn->kek_len, &sta->pasn->hash_alg,
- pasn->auth_alg == WLAN_AUTH_EPPKE);
+ pasn->auth_alg == WLAN_AUTH_EPPKE,
+ smd_identifier);
if (ret) {
wpa_printf(MSG_DEBUG, "PASN: FILS: Failed to derive PTK");
goto fail;
@@ -5442,6 +5450,11 @@ static void handle_auth_pasn(struct hostapd_data *hapd, struct sta_info *sta,
if (sta->sec_prof_used)
sta->pasn->sec_prof_used = true;
+#ifdef CONFIG_IEEE80211BN
+ if (ap_sta_is_smd(hapd, sta))
+ sta->pasn->smd_identifier = hapd->conf->smd.identifier;
+#endif /* CONFIG_IEEE80211BN */
+
hapd_pasn_update_params(hapd, sta, mgmt, len);
ret = handle_auth_pasn_1(sta->pasn, hapd->own_addr, sta->addr,
mgmt, len, false);
diff --git a/src/common/common_module_tests.c b/src/common/common_module_tests.c
index 928c67c83ea2..9be034a99295 100644
--- a/src/common/common_module_tests.c
+++ b/src/common/common_module_tests.c
@@ -656,7 +656,7 @@ static int pasn_test_pasn_auth(void)
spa_addr, bssid,
dhss, sizeof(dhss),
&ptk, WPA_KEY_MGMT_PASN, WPA_CIPHER_CCMP,
- WPA_KDK_MAX_LEN, 0, &hash_alg, false);
+ WPA_KDK_MAX_LEN, 0, &hash_alg, false, NULL);
if (ret)
return ret;
diff --git a/src/common/wpa_common.c b/src/common/wpa_common.c
index 01f511ec710a..3c654d5a6d47 100644
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -1746,6 +1746,7 @@ static enum rsn_hash_alg pasn_select_hash_alg(int akmp, int cipher,
* @kek_len: The length in octets that should be derived for KEK. Can be zero.
* @alg: Output variable for indicating the selected hash algorithm
* @is_eppke: EPPKE authentication
+ * @smd_identifier: SMD Identifier
* Returns: 0 on success, -1 on failure
*/
int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
@@ -1753,7 +1754,7 @@ int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
const u8 *dhss, size_t dhss_len,
struct wpa_ptk *ptk, int akmp, int cipher,
size_t kdk_len, size_t kek_len, enum rsn_hash_alg *alg,
- bool is_eppke)
+ bool is_eppke, const u8 *smd_identifier)
{
u8 tmp[WPA_KCK_MAX_LEN + WPA_KEK_MAX_LEN + WPA_TK_MAX_LEN +
WPA_KDK_MAX_LEN];
@@ -1781,13 +1782,19 @@ int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
* MLO, the non-AP MLD MAC address is used instead of the SPA and the
* AP MLD MAC address instead of the BSSID.
*
- * PASN-PTK = KDF(PMK, “PASN PTK Derivation”, SPA || BSSID || DHss)
+ * PASN-PTK = KDF(PMK, “PASN PTK Derivation”, SPA || BSSID || DHss ||
+ * SMD Identifier)
*
* KCK = L(PASN-PTK, 0, 256)
* TK = L(PASN-PTK, 256, TK_bits)
* KDK = L(PASN-PTK, 256 + TK_bits, kdk_len * 8)
+ * SMD_Identifier = L(ETH_ALEN)
*/
data_len = 2 * ETH_ALEN + dhss_len;
+
+ if (smd_identifier && !is_zero_ether_addr(smd_identifier))
+ data_len += ETH_ALEN;
+
data = os_zalloc(data_len);
if (!data)
return -1;
@@ -1795,6 +1802,12 @@ int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
os_memcpy(data, spa, ETH_ALEN);
os_memcpy(data + ETH_ALEN, bssid, ETH_ALEN);
os_memcpy(data + 2 * ETH_ALEN, dhss, dhss_len);
+ if (smd_identifier && !is_zero_ether_addr(smd_identifier)) {
+ os_memcpy(data + 2 * ETH_ALEN + dhss_len, smd_identifier, ETH_ALEN);
+ wpa_hexdump(MSG_DEBUG,
+ "PASN: SMD Identifier in PTK derivation",
+ smd_identifier, ETH_ALEN);
+ }
ptk->kck_len = WPA_PASN_KCK_LEN;
ptk->tk_len = wpa_cipher_key_len(cipher);
diff --git a/src/common/wpa_common.h b/src/common/wpa_common.h
index 7a9e16c75fd7..920faa807dad 100644
--- a/src/common/wpa_common.h
+++ b/src/common/wpa_common.h
@@ -816,7 +816,7 @@ int pasn_pmk_to_ptk(const u8 *pmk, size_t pmk_len,
const u8 *dhss, size_t dhss_len,
struct wpa_ptk *ptk, int akmp, int cipher,
size_t kdk_len, size_t kek_len, enum rsn_hash_alg *alg,
- bool is_eppke);
+ bool is_eppke, const u8 *smd_identifier);
size_t pasn_mic_len(enum rsn_hash_alg alg);
diff --git a/src/pasn/pasn_common.h b/src/pasn/pasn_common.h
index 7dbcfef8a9d3..27fd053a3a5e 100644
--- a/src/pasn/pasn_common.h
+++ b/src/pasn/pasn_common.h
@@ -189,6 +189,8 @@ struct pasn_data {
bool sec_prof_enabled;
bool sec_prof_used;
+ u8 *smd_identifier;
+
/**
* send_mgmt - Function handler to transmit a Management frame
* @ctx: Callback context from cb_ctx
diff --git a/src/pasn/pasn_initiator.c b/src/pasn/pasn_initiator.c
index b109c0e9ced4..8b838759e0c5 100644
--- a/src/pasn/pasn_initiator.c
+++ b/src/pasn/pasn_initiator.c
@@ -1563,7 +1563,8 @@ int wpas_parse_pasn_frame(struct pasn_data *pasn, u16 auth_type,
wpabuf_head(secret), wpabuf_len(secret),
&pasn->ptk, pasn->akmp, pasn->cipher,
pasn->kdk_len, pasn->kek_len, &pasn->hash_alg,
- pasn->auth_alg == WLAN_AUTH_EPPKE);
+ pasn->auth_alg == WLAN_AUTH_EPPKE,
+ NULL);
if (ret) {
wpa_printf(MSG_DEBUG, "PASN: Failed to derive PTK");
goto fail;
diff --git a/src/pasn/pasn_responder.c b/src/pasn/pasn_responder.c
index b03f4205cc28..aecedbb86a80 100644
--- a/src/pasn/pasn_responder.c
+++ b/src/pasn/pasn_responder.c
@@ -501,7 +501,8 @@ pasn_derive_keys(struct pasn_data *pasn,
&pasn->ptk, pasn->akmp,
pasn->cipher, pasn->kdk_len, pasn->kek_len,
&pasn->hash_alg,
- pasn->auth_alg == WLAN_AUTH_EPPKE);
+ pasn->auth_alg == WLAN_AUTH_EPPKE,
+ pasn->smd_identifier);
if (ret) {
wpa_printf(MSG_DEBUG, "PASN: Failed to derive PTK");
return -1;
--
2.34.1
More information about the Hostap
mailing list