Nikos Mavrogiannopoulos nmav@gnutls.org writes:
On 03/28/2013 06:24 PM, Niels Möller wrote:
Maybe one could also have a default autoincrementing nonce?
If you do that please don't make it the default. There are several cases in DTLS where the nonce isn't simply incrementing (e.g. when receiving packets out-of-order).
I was thinking of _init setting it to zero, and have _digest do post increment. So then you could chose between
_init
per message: _set_nonce _update (0 or more times) _digest
to get a nonce of your choice for each message, or
_init
per message: _update (0 or more times) _digest
to get an incrementing nonce, starting from zero, or
_init _set_nonce
per message: _update (0 or more times) _digest
to get an incrementing nonce, with a starting value of your choice.
Do you think this makes sense? There's a slight disadvantage that in the case that you call set_nonce for each message, the automatic inititializing and updating of the nonce is some useless work. I'm not sure what the typical usecases are.
Regards, /Niels