You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by na...@apache.org on 2021/05/27 08:19:45 UTC

[mynewt-nimble] 07/31: mesh: Update seqnum when re-encrypting for friend

This is an automated email from the ASF dual-hosted git repository.

naraj pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git

commit 8255bee130c3ab3e1852448f09634e60fd3ca9fc
Author: Krzysztof Kopyściński <kr...@codecoup.pl>
AuthorDate: Mon Mar 29 12:47:24 2021 +0200

    mesh: Update seqnum when re-encrypting for friend
    
    Sets the sequence number when re-encrypting messages from the friend to
    the lpn.
    
    this is port of 512444d863f0e4de69ea600dda37b11f032e9707
---
 nimble/host/mesh/src/friend.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/nimble/host/mesh/src/friend.c b/nimble/host/mesh/src/friend.c
index 8dc55c1..5918ecf 100644
--- a/nimble/host/mesh/src/friend.c
+++ b/nimble/host/mesh/src/friend.c
@@ -442,7 +442,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
 		return 0;
 	}
 
-	BT_DBG("Re-encrypting friend pdu");
+	BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
+	       meta.crypto.seq_num, bt_mesh.seq);
 
 	err = unseg_app_sdu_decrypt(frnd, buf, &meta);
 	if (err) {
@@ -450,6 +451,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
 		return err;
 	}
 
+	meta.crypto.seq_num = bt_mesh.seq;
+
 	err = unseg_app_sdu_encrypt(frnd, buf, &meta);
 	if (err) {
 		BT_WARN("Re-encryption failed! %d", err);