[PATCH 40/92] NAN: Parse NAN Identity Resolution attribute from SDFs
Andrei Otcheretianski
andrei.otcheretianski at intel.com
Wed Apr 22 05:23:31 PDT 2026
From: Avraham Stern <avraham.stern at intel.com>
Parse NAN Identity Resolution attribute from SDF and save the peer's
nonce and tag. The nonce and tag can later be used to determine the
peer's NIK for pairing verification.
Signed-off-by: Avraham Stern <avraham.stern at intel.com>
---
src/nan/nan.c | 19 +++++++++++++++++++
src/nan/nan_i.h | 6 ++++++
2 files changed, 25 insertions(+)
diff --git a/src/nan/nan.c b/src/nan/nan.c
index 9602f0553d..d81a5568a2 100644
--- a/src/nan/nan.c
+++ b/src/nan/nan.c
@@ -1009,6 +1009,24 @@ static void nan_parse_npba(struct nan_data *nan, struct nan_peer *peer,
}
+static void nan_parse_nira(struct nan_data *nan, struct nan_peer *peer,
+ struct nan_attrs *attrs)
+{
+ const u8 *pos;
+
+ if (!attrs->nira)
+ return;
+
+ peer->pairing.pairing_cfg.pairing_verification = true;
+
+ pos = attrs->nira + 1;
+ os_memcpy(peer->pairing.nonce, pos, NAN_NIRA_NONCE_LEN);
+ pos += NAN_NIRA_NONCE_LEN;
+ os_memcpy(peer->pairing.tag, pos, NAN_NIRA_TAG_LEN);
+ peer->pairing.nonce_tag_valid = true;
+}
+
+
/*
* nan_parse_device_attrs - Parse device attributes and build availability info
*
@@ -1046,6 +1064,7 @@ int nan_parse_device_attrs(struct nan_data *nan, struct nan_peer *peer,
nan_parse_peer_elem_container(nan, peer, &attrs);
nan_parse_peer_dev_capa_ext(nan, peer, &attrs);
nan_parse_npba(nan, peer, &attrs);
+ nan_parse_nira(nan, peer, &attrs);
nan_peer_dump(nan, peer);
ret = 0;
diff --git a/src/nan/nan_i.h b/src/nan/nan_i.h
index b032d88fe4..926eea2a9f 100644
--- a/src/nan/nan_i.h
+++ b/src/nan/nan_i.h
@@ -478,6 +478,9 @@ enum nan_pairing_role {
* @pasn: Pointer to PASN data
* @handle: Handle of the local service instance
* @peer_instance_id: Instance ID of the peer service
+ * @nonce_tag_valid: Indicates if the nonce and tag fields are valid
+ * @nonce: Nonce from peer's NIRA attribute
+ * @tag: Tag from peer's NIRA attribute
*/
struct nan_pairing_peer_data {
struct nan_pairing_cfg pairing_cfg;
@@ -485,6 +488,9 @@ struct nan_pairing_peer_data {
struct pasn_data *pasn;
int handle;
int peer_instance_id;
+ bool nonce_tag_valid;
+ u8 nonce[NAN_NIRA_NONCE_LEN];
+ u8 tag[NAN_NIRA_TAG_LEN];
};
/**
--
2.53.0
More information about the Hostap
mailing list