]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
* aes-internal.h (struct aes_table): Renamed the shift_idx field
authorNiels Möller <nisse@lysator.liu.se>
Wed, 15 May 2002 20:17:35 +0000 (22:17 +0200)
committerNiels Möller <nisse@lysator.liu.se>
Wed, 15 May 2002 20:17:35 +0000 (22:17 +0200)
to sparc_idx, as it will be tweaked to improve the sparc code.
Also reduced its size to [2][4].
(IDX_FACTOR): Deleted constant.
* aes-encrypt-table.c (_aes_encrypt_table): Adapted initializer of
sparc_idx.
* aes-decrypt-table.c (_aes_decrypt_table): Likewise.
* asm.m4: Deleted AES_SIDX2, to match struct aes_table.

Rev: src/nettle/aes-decrypt-table.c:1.2
Rev: src/nettle/aes-encrypt-table.c:1.2
Rev: src/nettle/aes-internal.h:1.7
Rev: src/nettle/asm.m4:1.9

aes-decrypt-table.c
aes-encrypt-table.c
aes-internal.h
asm.m4

index a20ec7cc1bf519003fd7c338b8d83fd2bfbd5ed3..e2f1efe895147f2acdc50efc3f63489bceae536c 100644 (file)
@@ -66,10 +66,9 @@ _aes_decrypt_table =
       { 3, 0, 1, 2 },
       { 2, 3, 0, 1 },
       { 1, 2, 3, 0 } },
-    { /* idx_shift */
-      { 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR, 2 * IDX_FACTOR },
-      { 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR },
-      { 1 * IDX_FACTOR, 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR } },
+    { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */
+      { 12, 0, 4,  8 },
+      {  4, 8, 12, 0 } },
     { /* itable */
       { 
        0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a,
index 1dea352eba1a8fa77dde81ed970fe464bcf6b3d5..73d592058901ba0c60a01491a054ec0bef3069f8 100644 (file)
@@ -77,10 +77,9 @@ _aes_encrypt_table =
       { 1, 2, 3, 0 },
       { 2, 3, 0, 1 },
       { 3, 0, 1, 2 } },
-    { /* idx_shift */
-      { 1 * IDX_FACTOR, 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR },
-      { 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR },
-      { 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR, 2 * IDX_FACTOR } },
+    { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */
+      {  4, 8, 12, 0 },
+      { 12, 0,  4, 8 } },
     { /* dtable */
       { 
        0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6,
index f063ff6594a0e5be2e4ebb2eb25367a022331865..0fa8ed00d6b22fc0401cbd02d673d3d98a532c5a 100644 (file)
 # define AES_TABLE_SIZE 4
 #endif
 
-#define IDX_FACTOR 4
 struct aes_table
 {
   uint8_t sbox[0x100];
   unsigned idx[3][4];
 
-  /* Preshifted indices, multiplied by IDX_FACTOR */
-  unsigned idx_shift[3][4];
+  /* Variant of the idx array suitable for the sparc
+   * assembler code. */
+  unsigned sparc_idx [2][4]; 
 
   uint32_t table[AES_TABLE_SIZE][0x100];
 };
diff --git a/asm.m4 b/asm.m4
index c3ab4d7b0e252e5bfe836795ab293ac74c4ba100..36936c150e23d90311e9efba168812238b7453fd 100644 (file)
--- a/asm.m4
+++ b/asm.m4
@@ -41,7 +41,6 @@ STRUCTURE(AES)
   STRUCT(IDX3, AES_IDX_SIZE)
 
   STRUCT(SIDX1, AES_IDX_SIZE)
-  STRUCT(SIDX2, AES_IDX_SIZE)
   STRUCT(SIDX3, AES_IDX_SIZE)
 
   STRUCT(TABLE0, AES_TABLE_SIZE)