2020-03-30 15:28:45

by Michał Lowas-Rzechonek

[permalink] [raw]
Subject: Application vs Network nonce in segmented messages

Hi Brian,

A question: when poking around the code looking for places where I
should fix the net key index, I've noticed a peculiar thing in
mesh/net.c:

if (msg->segmented) {
/* Send each segment on unique seq_num */
seq_num = mesh_net_next_seq_num(net);
...

This means that for segmented messages, if sequence number used on the
transport layer is, say, N, then the first segment is encrypted with
sequence number N + 1 on *network* layer.

While I think it's legal from the spec point of view, I can't think of a
reason to do so. Can you please shed some light on that line?

regards
--
Michał Lowas-Rzechonek <[email protected]>
Silvair http://silvair.com
Jasnogórska 44, 31-358 Krakow, POLAND