2013-04-16 Niels Möller <nisse@lysator.liu.se>
+ * umac.h (umac32_ctx, umac64_ctx, umac96_ctx, umac128_ctx): Make
+ block count an uint64_t. Reorder some elements to put short values
+ together.
+ * umac-l2.c (_umac_l2, _umac_l2_final): Make count argument an uint64_t.
+
* configure.ac: Changed version number to 2.7.
(LIBNETTLE_MINOR): Bumped library version, to 4.6
(LIBHOGWEED_MINOR): And to 2.4
void
_umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
- unsigned count, uint64_t *prev, const uint64_t *m)
+ uint64_t count, uint64_t *prev, const uint64_t *m)
{
unsigned i;
void
_umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
- unsigned count, uint64_t *prev)
+ uint64_t count, uint64_t *prev)
{
unsigned i;
/* Input to the pdf_key, zero-padded and low bits \
cleared if appropriate. */ \
uint8_t nonce[AES_BLOCK_SIZE]; \
- unsigned short nonce_length; /* For incrementing */ \
- /* Buffering */ \
+ unsigned short nonce_length /* For incrementing */
+
+ /* Buffering */
+#define _UMAC_BUFFER \
/* Complete blocks processed */ \
- unsigned count; \
unsigned index; \
- uint8_t block[UMAC_BLOCK_SIZE];
-
+ uint64_t count; \
+ uint8_t block[UMAC_BLOCK_SIZE]
+
#define _UMAC_NONCE_CACHED 0x80
struct umac32_ctx
{
_UMAC_STATE(1);
- unsigned short nonce_low; /* Low bits, plus some flag for the pad cache. */
+ /* Low bits and cache flag. */
+ unsigned short nonce_low;
/* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE / 4];
+ _UMAC_BUFFER;
};
struct umac64_ctx
{
_UMAC_STATE(2);
- int nonce_low; /* Low bits, plus some flag for the pad cache. */
+ /* Low bit and cache flag. */
+ unsigned short nonce_low;
/* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE/4];
+ _UMAC_BUFFER;
};
struct umac96_ctx
{
_UMAC_STATE(3);
+ _UMAC_BUFFER;
};
struct umac128_ctx
{
_UMAC_STATE(4);
+ _UMAC_BUFFER;
};
/* The _set_key function initialize the nonce to zero. */
void
_umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
- unsigned count, uint64_t *prev, const uint64_t *m);
+ uint64_t count, uint64_t *prev, const uint64_t *m);
void
_umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
- unsigned count, uint64_t *prev);
+ uint64_t count, uint64_t *prev);
void
_umac_l3_init (unsigned size, uint64_t *k);