diff options
-rw-r--r-- | include/aesni/api.h | 60 | ||||
-rw-r--r-- | include/aesni/raw.h | 12 | ||||
-rw-r--r-- | src/aes128.asm | 30 | ||||
-rw-r--r-- | src/aes128.c | 4 | ||||
-rw-r--r-- | src/aes192.asm | 8 | ||||
-rw-r--r-- | src/aes192.c | 4 | ||||
-rw-r--r-- | src/aes256.asm | 36 | ||||
-rw-r--r-- | src/aes256.c | 4 |
8 files changed, 79 insertions, 79 deletions
diff --git a/include/aesni/api.h b/include/aesni/api.h index 0d45fd8..852cfd4 100644 --- a/include/aesni/api.h +++ b/include/aesni/api.h @@ -29,14 +29,14 @@ static __inline AesBlock128 __fastcall aes128ecb_encrypt( AesBlock128 plain, Aes128KeySchedule* key_schedule) { - return raw_aes128ecb_encrypt(plain, key_schedule); + return raw_aes128_encrypt(plain, key_schedule); } static __inline AesBlock128 __fastcall aes128ecb_decrypt( AesBlock128 cipher, Aes128KeySchedule* inverted_schedule) { - return raw_aes128ecb_decrypt(cipher, inverted_schedule); + return raw_aes128_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes128cbc_encrypt( @@ -45,7 +45,7 @@ static __inline AesBlock128 __fastcall aes128cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = raw_aes128ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + AesBlock128 cipher = raw_aes128_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -56,7 +56,7 @@ static __inline AesBlock128 __fastcall aes128cbc_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_decrypt(cipher, inverted_schedule), init_vector); + AesBlock128 plain = _mm_xor_si128(raw_aes128_decrypt(cipher, inverted_schedule), init_vector); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -67,7 +67,7 @@ static __inline AesBlock128 __fastcall aes128cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), plain); + AesBlock128 cipher = _mm_xor_si128(raw_aes128_encrypt(init_vector, key_schedule), plain); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -78,7 +78,7 @@ static __inline AesBlock128 __fastcall aes128cfb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes128ecb_encrypt(init_vector, key_schedule), cipher); + AesBlock128 plain = _mm_xor_si128(raw_aes128_encrypt(init_vector, key_schedule), cipher); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -89,7 +89,7 @@ static __inline AesBlock128 __fastcall aes128ofb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes128ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes128_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, plain); } @@ -100,7 +100,7 @@ static __inline AesBlock128 __fastcall aes128ofb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes128ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes128_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, cipher); } @@ -114,7 +114,7 @@ static __inline AesBlock128 __fastcall aes128ctr_encrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(plain, raw_aes128ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(plain, raw_aes128_encrypt(init_vector, key_schedule)); } static __inline AesBlock128 __fastcall aes128ctr_decrypt( @@ -126,7 +126,7 @@ static __inline AesBlock128 __fastcall aes128ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cipher, raw_aes128ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes128_encrypt(init_vector, key_schedule)); } static __inline void __fastcall aes192_expand_key_schedule( @@ -147,14 +147,14 @@ static __inline AesBlock128 __fastcall aes192ecb_encrypt( AesBlock128 plain, Aes192KeySchedule* key_schedule) { - return raw_aes192ecb_encrypt(plain, key_schedule); + return raw_aes192_encrypt(plain, key_schedule); } static __inline AesBlock128 __fastcall aes192ecb_decrypt( AesBlock128 cipher, Aes192KeySchedule* inverted_schedule) { - return raw_aes192ecb_decrypt(cipher, inverted_schedule); + return raw_aes192_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes192cbc_encrypt( @@ -163,7 +163,7 @@ static __inline AesBlock128 __fastcall aes192cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = raw_aes192ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + AesBlock128 cipher = raw_aes192_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -174,7 +174,7 @@ static __inline AesBlock128 __fastcall aes192cbc_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_decrypt(cipher, inverted_schedule), init_vector); + AesBlock128 plain = _mm_xor_si128(raw_aes192_decrypt(cipher, inverted_schedule), init_vector); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -185,7 +185,7 @@ static __inline AesBlock128 __fastcall aes192cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), plain); + AesBlock128 cipher = _mm_xor_si128(raw_aes192_encrypt(init_vector, key_schedule), plain); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -196,7 +196,7 @@ static __inline AesBlock128 __fastcall aes192cfb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes192ecb_encrypt(init_vector, key_schedule), cipher); + AesBlock128 plain = _mm_xor_si128(raw_aes192_encrypt(init_vector, key_schedule), cipher); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -207,7 +207,7 @@ static __inline AesBlock128 __fastcall aes192ofb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes192ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes192_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, plain); } @@ -218,7 +218,7 @@ static __inline AesBlock128 __fastcall aes192ofb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes192ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes192_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, cipher); } @@ -232,7 +232,7 @@ static __inline AesBlock128 __fastcall aes192ctr_encrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(plain, raw_aes192ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(plain, raw_aes192_encrypt(init_vector, key_schedule)); } static __inline AesBlock128 __fastcall aes192ctr_decrypt( @@ -244,7 +244,7 @@ static __inline AesBlock128 __fastcall aes192ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cipher, raw_aes192ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes192_encrypt(init_vector, key_schedule)); } static __inline void __fastcall aes256_expand_key_schedule( @@ -265,14 +265,14 @@ static __inline AesBlock128 __fastcall aes256ecb_encrypt( AesBlock128 plain, Aes256KeySchedule* key_schedule) { - return raw_aes256ecb_encrypt(plain, key_schedule); + return raw_aes256_encrypt(plain, key_schedule); } static __inline AesBlock128 __fastcall aes256ecb_decrypt( AesBlock128 cipher, Aes256KeySchedule* inverted_schedule) { - return raw_aes256ecb_decrypt(cipher, inverted_schedule); + return raw_aes256_decrypt(cipher, inverted_schedule); } static __inline AesBlock128 __fastcall aes256cbc_encrypt( @@ -281,7 +281,7 @@ static __inline AesBlock128 __fastcall aes256cbc_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = raw_aes256ecb_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); + AesBlock128 cipher = raw_aes256_encrypt(_mm_xor_si128(plain, init_vector), key_schedule); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -292,7 +292,7 @@ static __inline AesBlock128 __fastcall aes256cbc_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_decrypt(cipher, inverted_schedule), init_vector); + AesBlock128 plain = _mm_xor_si128(raw_aes256_decrypt(cipher, inverted_schedule), init_vector); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -303,7 +303,7 @@ static __inline AesBlock128 __fastcall aes256cfb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 cipher = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), plain); + AesBlock128 cipher = _mm_xor_si128(raw_aes256_encrypt(init_vector, key_schedule), plain); _mm_storeu_si128(next_init_vector, cipher); return cipher; } @@ -314,7 +314,7 @@ static __inline AesBlock128 __fastcall aes256cfb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 plain = _mm_xor_si128(raw_aes256ecb_encrypt(init_vector, key_schedule), cipher); + AesBlock128 plain = _mm_xor_si128(raw_aes256_encrypt(init_vector, key_schedule), cipher); _mm_storeu_si128(next_init_vector, cipher); return plain; } @@ -325,7 +325,7 @@ static __inline AesBlock128 __fastcall aes256ofb_encrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes256ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes256_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, plain); } @@ -336,7 +336,7 @@ static __inline AesBlock128 __fastcall aes256ofb_decrypt( AesBlock128 init_vector, AesBlock128* next_init_vector) { - AesBlock128 tmp = raw_aes256ecb_encrypt(init_vector, key_schedule); + AesBlock128 tmp = raw_aes256_encrypt(init_vector, key_schedule); _mm_storeu_si128(next_init_vector, tmp); return _mm_xor_si128(tmp, cipher); } @@ -350,7 +350,7 @@ static __inline AesBlock128 __fastcall aes256ctr_encrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(plain, raw_aes256ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(plain, raw_aes256_encrypt(init_vector, key_schedule)); } static __inline AesBlock128 __fastcall aes256ctr_decrypt( @@ -362,5 +362,5 @@ static __inline AesBlock128 __fastcall aes256ctr_decrypt( init_vector = aes128_le2be(init_vector); init_vector = _mm_add_epi32(init_vector, make_aes_block128(0, 0, 0, counter)); init_vector = aes128_be2le(init_vector); - return _mm_xor_si128(cipher, raw_aes256ecb_encrypt(init_vector, key_schedule)); + return _mm_xor_si128(cipher, raw_aes256_encrypt(init_vector, key_schedule)); } diff --git a/include/aesni/raw.h b/include/aesni/raw.h index 62ce639..d570ecc 100644 --- a/include/aesni/raw.h +++ b/include/aesni/raw.h @@ -17,10 +17,10 @@ void __fastcall raw_aes128_invert_key_schedule( Aes128KeySchedule* key_schedule, Aes128KeySchedule* inverted_schedule); -AesBlock128 __fastcall raw_aes128ecb_encrypt( +AesBlock128 __fastcall raw_aes128_encrypt( AesBlock128 plain, Aes128KeySchedule* key_schedule); -AesBlock128 __fastcall raw_aes128ecb_decrypt( +AesBlock128 __fastcall raw_aes128_decrypt( AesBlock128 cipher, Aes128KeySchedule* inverted_schedule); @@ -32,10 +32,10 @@ void __fastcall raw_aes192_invert_key_schedule( Aes192KeySchedule* key_schedule, Aes192KeySchedule* inverted_schedule); -AesBlock128 __fastcall raw_aes192ecb_encrypt( +AesBlock128 __fastcall raw_aes192_encrypt( AesBlock128 plain, Aes192KeySchedule* key_schedule); -AesBlock128 __fastcall raw_aes192ecb_decrypt( +AesBlock128 __fastcall raw_aes192_decrypt( AesBlock128 cipher, Aes192KeySchedule* inverted_schedule); @@ -47,9 +47,9 @@ void __fastcall raw_aes256_invert_key_schedule( Aes256KeySchedule* key_schedule, Aes256KeySchedule* inverted_schedule); -AesBlock128 __fastcall raw_aes256ecb_encrypt( +AesBlock128 __fastcall raw_aes256_encrypt( AesBlock128 plain, Aes256KeySchedule* key_schedule); -AesBlock128 __fastcall raw_aes256ecb_decrypt( +AesBlock128 __fastcall raw_aes256_decrypt( AesBlock128 cipher, Aes256KeySchedule* inverted_schedule); 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) { |