]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Increase umac block count to 64 bits. Some reordering of umac contexts.
authorNiels Möller <nisse@lysator.liu.se>
Tue, 16 Apr 2013 12:22:08 +0000 (14:22 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Tue, 16 Apr 2013 12:22:08 +0000 (14:22 +0200)
ChangeLog
umac-l2.c
umac.h

index 35da57d3d2bcea53238a9c770efd50ab317e4ec2..bc0c950ccb4190a1f69fb0cabd75da1f56f04754 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 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
index 7fa5650b82209c06393afcd6fc9da7f9b1f9b569..f0ca122d2e36b9efaca98c70fa03fc42fd2b980f 100644 (file)
--- a/umac-l2.c
+++ b/umac-l2.c
@@ -57,7 +57,7 @@ _umac_l2_init (unsigned size, uint32_t *k)
 
 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;
 
@@ -95,7 +95,7 @@ _umac_l2(const uint32_t *key, uint64_t *state, unsigned n,
 
 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;
 
diff --git a/umac.h b/umac.h
index a2fd01014f8c73fb439043da2731773980f0690f..6f4d831c7adc87db1e15266bd72aff545540ae1b 100644 (file)
--- a/umac.h
+++ b/umac.h
@@ -81,39 +81,47 @@ extern "C" {
   /* 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. */
@@ -211,11 +219,11 @@ _umac_l2_init (unsigned size, uint32_t *k);
 
 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);