From 8799108df8cc07d18cfd853941a64499e2be89cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Narajowski?= Date: Wed, 30 Jan 2019 14:15:04 +0100 Subject: [PATCH] mesh/transport: Reformat SeqAuth calculation fix --- nimble/host/mesh/src/transport.c | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c index 81192c36e..ec2a8d611 100644 --- a/nimble/host/mesh/src/transport.c +++ b/nimble/host/mesh/src/transport.c @@ -1189,20 +1189,22 @@ static int trans_seg(struct os_mbuf *buf, struct bt_mesh_net_rx *net_rx, } /* According to Mesh 1.0 specification: - * "The SeqAuth is composed of the IV Index and the sequence number (SEQ) - * of the first segment " + * "The SeqAuth is composed of the IV Index and the sequence number + * (SEQ) of the first segment" * - * Therefore we need to calculate very first SEQ in order to find seqAuth. - * We can calculate as below: + * Therefore we need to calculate very first SEQ in order to find + * seqAuth. We can calculate as below: * - * SEQ(0) = SEQ(n) - (delta between seqZero and SEQ(n) by looking into - * 14 least significant bits of SEQ(n)) + * SEQ(0) = SEQ(n) - (delta between seqZero and SEQ(n) by looking into + * 14 least significant bits of SEQ(n)) * - * Mentioned delta shall be >= 0, if it is not then seq_auth will - * be broken and it will be verified by the code below. + * Mentioned delta shall be >= 0, if it is not then seq_auth will + * be broken and it will be verified by the code below. */ *seq_auth = SEQ_AUTH(BT_MESH_NET_IVI_RX(net_rx), - (net_rx->seq - ((((net_rx->seq & BIT_MASK(14)) - seq_zero)) & BIT_MASK(13)))); + (net_rx->seq - + ((((net_rx->seq & BIT_MASK(14)) - seq_zero)) & + BIT_MASK(13)))); /* Look for old RX sessions */ rx = seg_rx_find(net_rx, seq_auth);