Commit 15353743 authored by Niels Möller's avatar Niels Möller

* aes-internal.h (struct aes_table): Renamed the shift_idx field

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
parent f91e7210
...@@ -66,10 +66,9 @@ _aes_decrypt_table = ...@@ -66,10 +66,9 @@ _aes_decrypt_table =
{ 3, 0, 1, 2 }, { 3, 0, 1, 2 },
{ 2, 3, 0, 1 }, { 2, 3, 0, 1 },
{ 1, 2, 3, 0 } }, { 1, 2, 3, 0 } },
{ /* idx_shift */ { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */
{ 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR, 2 * IDX_FACTOR }, { 12, 0, 4, 8 },
{ 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR }, { 4, 8, 12, 0 } },
{ 1 * IDX_FACTOR, 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR } },
{ /* itable */ { /* itable */
{ {
0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a, 0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a,
......
...@@ -77,10 +77,9 @@ _aes_encrypt_table = ...@@ -77,10 +77,9 @@ _aes_encrypt_table =
{ 1, 2, 3, 0 }, { 1, 2, 3, 0 },
{ 2, 3, 0, 1 }, { 2, 3, 0, 1 },
{ 3, 0, 1, 2 } }, { 3, 0, 1, 2 } },
{ /* idx_shift */ { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */
{ 1 * IDX_FACTOR, 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR }, { 4, 8, 12, 0 },
{ 2 * IDX_FACTOR, 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR }, { 12, 0, 4, 8 } },
{ 3 * IDX_FACTOR, 0 * IDX_FACTOR, 1 * IDX_FACTOR, 2 * IDX_FACTOR } },
{ /* dtable */ { /* dtable */
{ {
0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6, 0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6,
......
...@@ -39,14 +39,14 @@ ...@@ -39,14 +39,14 @@
# define AES_TABLE_SIZE 4 # define AES_TABLE_SIZE 4
#endif #endif
#define IDX_FACTOR 4
struct aes_table struct aes_table
{ {
uint8_t sbox[0x100]; uint8_t sbox[0x100];
unsigned idx[3][4]; unsigned idx[3][4];
/* Preshifted indices, multiplied by IDX_FACTOR */ /* Variant of the idx array suitable for the sparc
unsigned idx_shift[3][4]; * assembler code. */
unsigned sparc_idx [2][4];
uint32_t table[AES_TABLE_SIZE][0x100]; uint32_t table[AES_TABLE_SIZE][0x100];
}; };
......
...@@ -41,7 +41,6 @@ STRUCTURE(AES) ...@@ -41,7 +41,6 @@ STRUCTURE(AES)
STRUCT(IDX3, AES_IDX_SIZE) STRUCT(IDX3, AES_IDX_SIZE)
STRUCT(SIDX1, AES_IDX_SIZE) STRUCT(SIDX1, AES_IDX_SIZE)
STRUCT(SIDX2, AES_IDX_SIZE)
STRUCT(SIDX3, AES_IDX_SIZE) STRUCT(SIDX3, AES_IDX_SIZE)
STRUCT(TABLE0, AES_TABLE_SIZE) STRUCT(TABLE0, AES_TABLE_SIZE)
......
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