Owen Kirby <[email protected]> writes:

> It also occurs to me that the my formula for calculating the maximum
> message size from L is completely wrong. L basically specifies the size
> of the counter field (in bytes), so it should really be maxlength = (1
> << (L*8)) - 1.

Is the following correct? Intended for ccm.h:

/* Maximum cleartext message size, as a function of the nonce size N.
   The length field is L octets, with L = 15 - N, and then the maximum
   size M = 2^{8L} - 1. */
#define CCM_MAX_MSG_SIZE(N)                     \
  ((sizeof(size_t) + (N) <= 15)                 \
   ? ~(size_t) 0                                \
   : ((size_t) 1 << (8*(15 - N))) - 1)


Regards,
/Niels

-- 
Niels Möller. PGP-encrypted email is preferred. Keyid C0B98E26.
Internet email is subject to wholesale government surveillance.
_______________________________________________
nettle-bugs mailing list
[email protected]
http://lists.lysator.liu.se/mailman/listinfo/nettle-bugs

Reply via email to