host/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
This commit is contained in:
Krzysztof Kopyściński
2021-11-10 06:24:00 +01:00
committed by Krzysztof Kopyściński
parent 94b3c4a9d3
commit ea75a5e683
+5
View File
@@ -431,6 +431,9 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
return 0;
}
BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
meta.crypto.seq_num, bt_mesh.seq);
err = unseg_app_sdu_unpack(frnd, buf, &meta);
if (err) {
return err;
@@ -446,6 +449,8 @@ static int unseg_app_sdu_prepare(struct bt_mesh_friend *frnd,
BT_DBG("Re-encrypting friend pdu (SeqNum %06x -> %06x)",
meta.crypto.seq_num, bt_mesh.seq);
meta.crypto.seq_num = bt_mesh.seq;
err = unseg_app_sdu_decrypt(frnd, buf, &meta);
if (err) {
BT_WARN("Decryption failed! %d", err);