Commit a56ede19 authored by Niels Möller's avatar Niels Möller
Browse files

Increase umac block count to 64 bits. Some reordering of umac contexts.

parent 7eb18308
2013-04-16 Niels Möller <nisse@lysator.liu.se> 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. * configure.ac: Changed version number to 2.7.
(LIBNETTLE_MINOR): Bumped library version, to 4.6 (LIBNETTLE_MINOR): Bumped library version, to 4.6
(LIBHOGWEED_MINOR): And to 2.4 (LIBHOGWEED_MINOR): And to 2.4
......
...@@ -57,7 +57,7 @@ _umac_l2_init (unsigned size, uint32_t *k) ...@@ -57,7 +57,7 @@ _umac_l2_init (unsigned size, uint32_t *k)
void void
_umac_l2(const uint32_t *key, uint64_t *state, unsigned n, _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; unsigned i;
...@@ -95,7 +95,7 @@ _umac_l2(const uint32_t *key, uint64_t *state, unsigned n, ...@@ -95,7 +95,7 @@ _umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
void void
_umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n, _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; unsigned i;
......
...@@ -81,39 +81,47 @@ extern "C" { ...@@ -81,39 +81,47 @@ extern "C" {
/* Input to the pdf_key, zero-padded and low bits \ /* Input to the pdf_key, zero-padded and low bits \
cleared if appropriate. */ \ cleared if appropriate. */ \
uint8_t nonce[AES_BLOCK_SIZE]; \ uint8_t nonce[AES_BLOCK_SIZE]; \
unsigned short nonce_length; /* For incrementing */ \ unsigned short nonce_length /* For incrementing */
/* Buffering */ \
/* Buffering */
#define _UMAC_BUFFER \
/* Complete blocks processed */ \ /* Complete blocks processed */ \
unsigned count; \
unsigned index; \ unsigned index; \
uint8_t block[UMAC_BLOCK_SIZE]; uint64_t count; \
uint8_t block[UMAC_BLOCK_SIZE]
#define _UMAC_NONCE_CACHED 0x80 #define _UMAC_NONCE_CACHED 0x80
struct umac32_ctx struct umac32_ctx
{ {
_UMAC_STATE(1); _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 */ /* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE / 4]; uint32_t pad_cache[AES_BLOCK_SIZE / 4];
_UMAC_BUFFER;
}; };
struct umac64_ctx struct umac64_ctx
{ {
_UMAC_STATE(2); _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 */ /* Previous padding block */
uint32_t pad_cache[AES_BLOCK_SIZE/4]; uint32_t pad_cache[AES_BLOCK_SIZE/4];
_UMAC_BUFFER;
}; };
struct umac96_ctx struct umac96_ctx
{ {
_UMAC_STATE(3); _UMAC_STATE(3);
_UMAC_BUFFER;
}; };
struct umac128_ctx struct umac128_ctx
{ {
_UMAC_STATE(4); _UMAC_STATE(4);
_UMAC_BUFFER;
}; };
/* The _set_key function initialize the nonce to zero. */ /* The _set_key function initialize the nonce to zero. */
...@@ -211,11 +219,11 @@ _umac_l2_init (unsigned size, uint32_t *k); ...@@ -211,11 +219,11 @@ _umac_l2_init (unsigned size, uint32_t *k);
void void
_umac_l2(const uint32_t *key, uint64_t *state, unsigned n, _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 void
_umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n, _umac_l2_final(const uint32_t *key, uint64_t *state, unsigned n,
unsigned count, uint64_t *prev); uint64_t count, uint64_t *prev);
void void
_umac_l3_init (unsigned size, uint64_t *k); _umac_l3_init (unsigned size, uint64_t *k);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment