Commit 512444d8 authored by Trond Einar Snekvik's avatar Trond Einar Snekvik Committed by Anas Nashif
Browse files

Bluetooth: Mesh: Update seqnum when re-encrypting for friend



Sets the sequence number when re-encrypting messages from the friend to
the lpn.

This is a regression from #28511.

Signed-off-by: default avatarTrond Einar Snekvik <Trond.Einar.Snekvik@nordicsemi.no>
parent 48526b69
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -432,7 +432,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) {
@@ -440,6 +441,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);