aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-05 02:09:07 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-05 02:09:07 +0300
commitf03495351c34315d30cc8566d1ef3884baa29d6b (patch)
treed0fb61f3dc480c529128f7727f3c06d5b4aa203f /src
parentallow to choose between C in asm implementations (diff)
downloadaes-tools-f03495351c34315d30cc8566d1ef3884baa29d6b.tar.gz
aes-tools-f03495351c34315d30cc8566d1ef3884baa29d6b.zip
refactoring
Diffstat (limited to 'src')
-rw-r--r--src/aes128.asm30
-rw-r--r--src/aes128.c4
-rw-r--r--src/aes192.asm8
-rw-r--r--src/aes192.c4
-rw-r--r--src/aes256.asm36
-rw-r--r--src/aes256.c4
6 files changed, 43 insertions, 43 deletions
diff --git a/src/aes128.asm b/src/aes128.asm
index 0153feb..081f25d 100644
--- a/src/aes128.asm
+++ b/src/aes128.asm
@@ -8,7 +8,7 @@
.code
-@raw_aes128ecb_encrypt@20 proc
+@raw_aes128_encrypt@20 proc
pxor xmm0, [ecx]
aesenc xmm0, [ecx + 10h]
aesenc xmm0, [ecx + 20h]
@@ -21,9 +21,9 @@
aesenc xmm0, [ecx + 90h]
aesenclast xmm0, [ecx + 0A0h]
ret
-@raw_aes128ecb_encrypt@20 endp
+@raw_aes128_encrypt@20 endp
-@raw_aes128ecb_decrypt@20 proc
+@raw_aes128_decrypt@20 proc
pxor xmm0, [ecx]
aesdec xmm0, [ecx + 10h]
aesdec xmm0, [ecx + 20h]
@@ -36,7 +36,7 @@
aesdec xmm0, [ecx + 90h]
aesdeclast xmm0, [ecx + 0A0h]
ret
-@raw_aes128ecb_decrypt@20 endp
+@raw_aes128_decrypt@20 endp
@raw_aes128_expand_key_schedule@20 proc
; A "word" (in terms of the FIPS 187 standard) is a 32-bit block.
@@ -89,29 +89,29 @@
add ecx, 10h ; ecx = &w[4]
aeskeygenassist xmm7, xmm0, 01h ; xmm7[127:96] = RotWord(SubWord(w[3]))^Rcon
- call gen_round_key ; sets w[4], w[5], w[6], w[7]
+ call aes128_keygen_assist ; sets w[4], w[5], w[6], w[7]
aeskeygenassist xmm7, xmm0, 02h ; xmm7[127:96] = RotWord(SubWord(w[7]))^Rcon
- call gen_round_key ; sets w[8], w[9], w[10], w[11]
+ call aes128_keygen_assist ; sets w[8], w[9], w[10], w[11]
aeskeygenassist xmm7, xmm0, 04h ; xmm7[127:96] = RotWord(SubWord(w[11]))^Rcon
- call gen_round_key ; sets w[12], w[13], w[14], w[15]
+ call aes128_keygen_assist ; sets w[12], w[13], w[14], w[15]
aeskeygenassist xmm7, xmm0, 08h ; xmm7[127:96] = RotWord(SubWord(w[15]))^Rcon
- call gen_round_key ; sets w[16], w[17], w[18], w[19]
+ call aes128_keygen_assist ; sets w[16], w[17], w[18], w[19]
aeskeygenassist xmm7, xmm0, 10h ; xmm7[127:96] = RotWord(SubWord(w[19]))^Rcon
- call gen_round_key ; sets w[20], w[21], w[22], w[23]
+ call aes128_keygen_assist ; sets w[20], w[21], w[22], w[23]
aeskeygenassist xmm7, xmm0, 20h ; xmm7[127:96] = RotWord(SubWord(w[23]))^Rcon
- call gen_round_key ; sets w[24], w[25], w[26], w[27]
+ call aes128_keygen_assist ; sets w[24], w[25], w[26], w[27]
aeskeygenassist xmm7, xmm0, 40h ; xmm7[127:96] = RotWord(SubWord(w[27]))^Rcon
- call gen_round_key ; sets w[28], w[29], w[30], w[31]
+ call aes128_keygen_assist ; sets w[28], w[29], w[30], w[31]
aeskeygenassist xmm7, xmm0, 80h ; xmm7[127:96] = RotWord(SubWord(w[31]))^Rcon
- call gen_round_key ; sets w[32], w[33], w[34], w[35]
+ call aes128_keygen_assist ; sets w[32], w[33], w[34], w[35]
aeskeygenassist xmm7, xmm0, 1Bh ; xmm7[127:96] = RotWord(SubWord(w[35]))^Rcon
- call gen_round_key ; sets w[36], w[37], w[38], w[39]
+ call aes128_keygen_assist ; sets w[36], w[37], w[38], w[39]
aeskeygenassist xmm7, xmm0, 36h ; xmm7[127:96] = RotWord(SubWord(w[39]))^Rcon
- call gen_round_key ; sets w[40], w[41], w[42], w[43]
+ call aes128_keygen_assist ; sets w[40], w[41], w[42], w[43]
ret
-gen_round_key:
+aes128_keygen_assist:
; Preconditions:
; * xmm0[127:96] == w[i+3],
; * xmm0[95:64] == w[i+2],
diff --git a/src/aes128.c b/src/aes128.c
index 66c2b2e..c700e30 100644
--- a/src/aes128.c
+++ b/src/aes128.c
@@ -11,7 +11,7 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesBlock128 __fastcall raw_aes128ecb_encrypt(
+AesBlock128 __fastcall raw_aes128_encrypt(
AesBlock128 plain,
Aes128KeySchedule* key_schedule)
{
@@ -28,7 +28,7 @@ AesBlock128 __fastcall raw_aes128ecb_encrypt(
return _mm_aesenclast_si128(plain, key_schedule->keys[10]);
}
-AesBlock128 __fastcall raw_aes128ecb_decrypt(
+AesBlock128 __fastcall raw_aes128_decrypt(
AesBlock128 cipher,
Aes128KeySchedule* inverted_schedule)
{
diff --git a/src/aes192.asm b/src/aes192.asm
index 6851ae1..a437801 100644
--- a/src/aes192.asm
+++ b/src/aes192.asm
@@ -8,7 +8,7 @@
.code
-@raw_aes192ecb_encrypt@20 proc
+@raw_aes192_encrypt@20 proc
pxor xmm0, [ecx]
aesenc xmm0, [ecx + 10h]
aesenc xmm0, [ecx + 20h]
@@ -23,9 +23,9 @@
aesenc xmm0, [ecx + 0B0h]
aesenclast xmm0, [ecx + 0C0h]
ret
-@raw_aes192ecb_encrypt@20 endp
+@raw_aes192_encrypt@20 endp
-@raw_aes192ecb_decrypt@20 proc
+@raw_aes192_decrypt@20 proc
pxor xmm0, [ecx]
aesdec xmm0, [ecx + 10h]
aesdec xmm0, [ecx + 20h]
@@ -40,7 +40,7 @@
aesdec xmm0, [ecx + 0B0h]
aesdeclast xmm0, [ecx + 0C0h]
ret
-@raw_aes192ecb_decrypt@20 endp
+@raw_aes192_decrypt@20 endp
@raw_aes192_expand_key_schedule@36 proc
; A "word" (in terms of the FIPS 187 standard) is a 32-bit block.
diff --git a/src/aes192.c b/src/aes192.c
index 2d1d6e5..62f6ce7 100644
--- a/src/aes192.c
+++ b/src/aes192.c
@@ -11,7 +11,7 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesBlock128 __fastcall raw_aes192ecb_encrypt(
+AesBlock128 __fastcall raw_aes192_encrypt(
AesBlock128 plain,
Aes192KeySchedule* key_schedule)
{
@@ -30,7 +30,7 @@ AesBlock128 __fastcall raw_aes192ecb_encrypt(
return _mm_aesenclast_si128(plain, key_schedule->keys[12]);
}
-AesBlock128 __fastcall raw_aes192ecb_decrypt(
+AesBlock128 __fastcall raw_aes192_decrypt(
AesBlock128 cipher,
Aes192KeySchedule* inverted_schedule)
{
diff --git a/src/aes256.asm b/src/aes256.asm
index 41921dd..3dfd4b2 100644
--- a/src/aes256.asm
+++ b/src/aes256.asm
@@ -8,7 +8,7 @@
.code
-@raw_aes256ecb_encrypt@20 proc
+@raw_aes256_encrypt@20 proc
pxor xmm0, [ecx]
aesenc xmm0, [ecx + 10h]
aesenc xmm0, [ecx + 20h]
@@ -25,9 +25,9 @@
aesenc xmm0, [ecx + 0D0h]
aesenclast xmm0, [ecx + 0E0h]
ret
-@raw_aes256ecb_encrypt@20 endp
+@raw_aes256_encrypt@20 endp
-@raw_aes256ecb_decrypt@20 proc
+@raw_aes256_decrypt@20 proc
pxor xmm0, [ecx]
aesdec xmm0, [ecx + 10h]
aesdec xmm0, [ecx + 20h]
@@ -44,7 +44,7 @@
aesdec xmm0, [ecx + 0D0h]
aesdeclast xmm0, [ecx + 0E0h]
ret
-@raw_aes256ecb_decrypt@20 endp
+@raw_aes256_decrypt@20 endp
@raw_aes256_expand_key_schedule@36 proc
; A "word" (in terms of the FIPS 187 standard) is a 32-bit block.
@@ -119,59 +119,59 @@
aeskeygenassist xmm7, xmm1, 1h ; xmm7[127:96] = RotWord(SubWord(w[7]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[8], w[9], w[10], w[11]
+ call aes256_keygen_assist ; sets w[8], w[9], w[10], w[11]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[11])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[12], w[13], w[14], w[15]
+ call aes256_keygen_assist ; sets w[12], w[13], w[14], w[15]
aeskeygenassist xmm7, xmm1, 2h ; xmm7[127:96] = RotWord(SubWord(w[15]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[16], w[17], w[18], w[19]
+ call aes256_keygen_assist ; sets w[16], w[17], w[18], w[19]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[19])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[20], w[21], w[22], w[23]
+ call aes256_keygen_assist ; sets w[20], w[21], w[22], w[23]
aeskeygenassist xmm7, xmm1, 4h ; xmm7[127:96] = RotWord(SubWord(w[23]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[24], w[25], w[26], w[27]
+ call aes256_keygen_assist ; sets w[24], w[25], w[26], w[27]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[27])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[28], w[29], w[30], w[31]
+ call aes256_keygen_assist ; sets w[28], w[29], w[30], w[31]
aeskeygenassist xmm7, xmm1, 8h ; xmm7[127:96] = RotWord(SubWord(w[31]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[32], w[33], w[34], w[35]
+ call aes256_keygen_assist ; sets w[32], w[33], w[34], w[35]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[35])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[36], w[37], w[38], w[39]
+ call aes256_keygen_assist ; sets w[36], w[37], w[38], w[39]
aeskeygenassist xmm7, xmm1, 10h ; xmm7[127:96] = RotWord(SubWord(w[39]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[40], w[41], w[42], w[43]
+ call aes256_keygen_assist ; sets w[40], w[41], w[42], w[43]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[43])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[44], w[45], w[46], w[47]
+ call aes256_keygen_assist ; sets w[44], w[45], w[46], w[47]
aeskeygenassist xmm7, xmm1, 20h ; xmm7[127:96] = RotWord(SubWord(w[47]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[48], w[49], w[50], w[51]
+ call aes256_keygen_assist ; sets w[48], w[49], w[50], w[51]
aeskeygenassist xmm7, xmm1, 0 ; xmm7[95:64] = SubWord(w[51])
pshufd xmm7, xmm7, 0AAh ; xmm7[127:96] = xmm7[63:32] = xmm7[31:0] = xmm7[95:64]
- call gen_round_key ; sets w[52], w[53], w[54], w[55]
+ call aes256_keygen_assist ; sets w[52], w[53], w[54], w[55]
aeskeygenassist xmm7, xmm1, 40h ; xmm7[127:96] = RotWord(SubWord(w[55]))^Rcon
pshufd xmm7, xmm7, 0FFh ; xmm7[95:64] = xmm7[63:32] = xmm7[31:0] = xmm7[127:96]
- call gen_round_key ; sets w[56], w[57], w[58], w[59]
+ call aes256_keygen_assist ; sets w[56], w[57], w[58], w[59]
ret
-gen_round_key:
+aes256_keygen_assist:
; Preconditions:
; * xmm1[127:96] == w[i+7],
; * xmm1[95:64] == w[i+6],
diff --git a/src/aes256.c b/src/aes256.c
index 1faa092..25cee25 100644
--- a/src/aes256.c
+++ b/src/aes256.c
@@ -11,7 +11,7 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesBlock128 __fastcall raw_aes256ecb_encrypt(
+AesBlock128 __fastcall raw_aes256_encrypt(
AesBlock128 plain,
Aes256KeySchedule* key_schedule)
{
@@ -32,7 +32,7 @@ AesBlock128 __fastcall raw_aes256ecb_encrypt(
return _mm_aesenclast_si128(plain, key_schedule->keys[14]);
}
-AesBlock128 __fastcall raw_aes256ecb_decrypt(
+AesBlock128 __fastcall raw_aes256_decrypt(
AesBlock128 cipher,
Aes256KeySchedule* inverted_schedule)
{