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

(struct aes_table): New subtable idx_shift.

Updated tables in aes_encrypt.c and aes_decrypt.c.

Rev: src/nettle/aes-decrypt.c:1.2
Rev: src/nettle/aes-encrypt.c:1.2
Rev: src/nettle/aes-internal.h:1.6
parent 6d7406b3
...@@ -68,6 +68,10 @@ _aes_decrypt_table = ...@@ -68,6 +68,10 @@ _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 */
{ 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 } },
{ /* itable */ { /* itable */
{ {
0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a, 0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a,
......
...@@ -79,6 +79,10 @@ _aes_encrypt_table = ...@@ -79,6 +79,10 @@ _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 */
{ 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 } },
{ /* dtable */ { /* dtable */
{ {
0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6, 0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6,
......
...@@ -39,10 +39,15 @@ ...@@ -39,10 +39,15 @@
# 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 */
unsigned idx_shift[3][4];
uint32_t table[AES_TABLE_SIZE][0x100]; uint32_t table[AES_TABLE_SIZE][0x100];
}; };
......
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