diff --git a/aes-decrypt-table.c b/aes-decrypt-table.c index e2f1efe895147f2acdc50efc3f63489bceae536c..8eceb2bcef391b887f6b64b04f3e5642808caa43 100644 --- a/aes-decrypt-table.c +++ b/aes-decrypt-table.c @@ -66,9 +66,9 @@ _aes_decrypt_table = { 3, 0, 1, 2 }, { 2, 3, 0, 1 }, { 1, 2, 3, 0 } }, - { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */ - { 12, 0, 4, 8 }, - { 4, 8, 12, 0 } }, + { /* sparc_idx, explained in aes-internal.h */ + { 14, 2, 6, 10 }, + { 4, 8, 12, 0 } }, { /* itable */ { 0x50a7f451,0x5365417e,0xc3a4171a,0x965e273a, diff --git a/aes-encrypt-table.c b/aes-encrypt-table.c index 73d592058901ba0c60a01491a054ec0bef3069f8..89f796739f0a8c3918637660f523c44107df946b 100644 --- a/aes-encrypt-table.c +++ b/aes-encrypt-table.c @@ -77,9 +77,9 @@ _aes_encrypt_table = { 1, 2, 3, 0 }, { 2, 3, 0, 1 }, { 3, 0, 1, 2 } }, - { /* sparc_idx, IDX1 and IDX3 shifted by the size of a word */ - { 4, 8, 12, 0 }, - { 12, 0, 4, 8 } }, + { /* sparc_idx, explained in aes-internal.h */ + { 6, 10, 14, 2 }, + { 12, 0, 4, 8 } }, { /* dtable */ { 0xa56363c6,0x847c7cf8,0x997777ee,0x8d7b7bf6, diff --git a/aes-internal.h b/aes-internal.h index 0fa8ed00d6b22fc0401cbd02d673d3d98a532c5a..e79c8b9bc9a3d3e9785fe7465b92f1d15b2b415e 100644 --- a/aes-internal.h +++ b/aes-internal.h @@ -45,7 +45,12 @@ struct aes_table unsigned idx[3][4]; /* Variant of the idx array suitable for the sparc - * assembler code. */ + * assembler code. + * + * sparc_idx[0][i] = idx[0][i] * 4 + 2 + * sparc_idx[1][i] = idx[2][i] * 4 + */ + unsigned sparc_idx [2][4]; uint32_t table[AES_TABLE_SIZE][0x100];