diff mbox series

NAN: Set new NIK before computing the new tag

Message ID 20260507191130.36955-4-andrei.otcheretianski@intel.com
State Accepted
Headers show
Series NAN: Set new NIK before computing the new tag | expand

Commit Message

Andrei Otcheretianski May 7, 2026, 7:11 p.m. UTC
From: Ilan Peer <ilan.peer@intel.com>

Set the new NIK before computing the new tag, as the
computation uses the stored NIK.

Signed-off-by: Ilan Peer <ilan.peer@intel.com>
---
 src/nan/nan_pairing.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jouni Malinen May 8, 2026, 9:19 p.m. UTC | #1
On Thu, May 07, 2026 at 10:11:30PM +0300, Andrei Otcheretianski wrote:
> Set the new NIK before computing the new tag, as the
> computation uses the stored NIK.

Thanks, applied.
diff mbox series

Patch

diff --git a/src/nan/nan_pairing.c b/src/nan/nan_pairing.c
index b03ca68dac..ad29c8427e 100644
--- a/src/nan/nan_pairing.c
+++ b/src/nan/nan_pairing.c
@@ -1493,6 +1493,8 @@  int nan_pairing_set_nik(struct nan_data *nan, const u8 *nik, size_t nik_len)
 		return -1;
 	}
 
+	os_memcpy(nan->cfg->nik, nik, NAN_NIK_LEN);
+
 	if (nan->cfg->pairing_cfg.pairing_verification) {
 		if (nan_nira_get_tag_nonce(nan->cfg, nonce, tag) < 0) {
 			wpa_printf(MSG_INFO,
@@ -1510,8 +1512,6 @@  int nan_pairing_set_nik(struct nan_data *nan, const u8 *nik, size_t nik_len)
 		os_memset(nan->nira_tag, 0, NAN_NIRA_TAG_LEN);
 	}
 
-	os_memcpy(nan->cfg->nik, nik, NAN_NIK_LEN);
-
 	wpa_hexdump_key(MSG_DEBUG, "NAN: New NIK", nan->cfg->nik, NAN_NIK_LEN);
 
 	return 0;