[noise] Nonce Post-Increment vs Pre-Increment

Jason A. Donenfeld Jason at zx2c4.com
Mon Nov 9 18:42:54 PST 2015


On Tue, Nov 10, 2015 at 2:55 AM, Trevor Perrin <trevp at trevp.net> wrote:
>
> I just meant that subtracting 1 to convert 1-based sequence numbers
> (your preference) to 0-based didn't seem a big deal, in the scheme of
> things.

I've got it sorted using 0-based nonces. I'm just subtracting one from
the atomic_inc_return, and adding one before validating a nonce.
There's some additional book keeping to make sure things don't
over/underflow. It's marginally more complex now, but still well
within the realm of readability.


More information about the Noise mailing list