aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/c
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-17 23:25:52 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-17 23:25:52 +0300
commit44d58e0a10c7dfdb33899fa98c0eea790e0b90ce (patch)
tree646541b156ffdd88bbaa4f1fa860aed465dfce60 /src/c
parentrefactoring (diff)
downloadaes-tools-44d58e0a10c7dfdb33899fa98c0eea790e0b90ce.tar.gz
aes-tools-44d58e0a10c7dfdb33899fa98c0eea790e0b90ce.zip
factoring out AES-specific stuff
Diffstat (limited to '')
-rw-r--r--src/c/aes128.c18
-rw-r--r--src/c/aes192.c20
-rw-r--r--src/c/aes256.c26
3 files changed, 32 insertions, 32 deletions
diff --git a/src/c/aes128.c b/src/c/aes128.c
index 8f2da44..b2e37ba 100644
--- a/src/c/aes128.c
+++ b/src/c/aes128.c
@@ -11,8 +11,8 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesNI_Block128 __fastcall aesni_aes128_encrypt_block_(
- AesNI_Block128 plaintext,
+AesNI_Aes_Block __fastcall aesni_aes128_encrypt_block_(
+ AesNI_Aes_Block plaintext,
const AesNI_Aes128_RoundKeys* encryption_keys)
{
plaintext = _mm_xor_si128(plaintext, encryption_keys->keys[0]);
@@ -28,8 +28,8 @@ AesNI_Block128 __fastcall aesni_aes128_encrypt_block_(
return _mm_aesenclast_si128(plaintext, encryption_keys->keys[10]);
}
-AesNI_Block128 __fastcall aesni_aes128_decrypt_block_(
- AesNI_Block128 ciphertext,
+AesNI_Aes_Block __fastcall aesni_aes128_decrypt_block_(
+ AesNI_Aes_Block ciphertext,
const AesNI_Aes128_RoundKeys* decryption_keys)
{
ciphertext = _mm_xor_si128(ciphertext, decryption_keys->keys[0]);
@@ -45,11 +45,11 @@ AesNI_Block128 __fastcall aesni_aes128_decrypt_block_(
return _mm_aesdeclast_si128(ciphertext, decryption_keys->keys[10]);
}
-static AesNI_Block128 __fastcall aesni_aes128_expand_key_assist(
- AesNI_Block128 prev,
- AesNI_Block128 hwgen)
+static AesNI_Aes_Block __fastcall aesni_aes128_expand_key_assist(
+ AesNI_Aes_Block prev,
+ AesNI_Aes_Block hwgen)
{
- AesNI_Block128 tmp = prev;
+ AesNI_Aes_Block tmp = prev;
tmp = _mm_slli_si128(tmp, 4);
prev = _mm_xor_si128(prev, tmp);
@@ -65,7 +65,7 @@ static AesNI_Block128 __fastcall aesni_aes128_expand_key_assist(
}
void __fastcall aesni_aes128_expand_key_(
- AesNI_Block128 key,
+ AesNI_Aes_Block key,
AesNI_Aes128_RoundKeys* encryption_keys)
{
AesNI_Block128 prev = encryption_keys->keys[0] = key;
diff --git a/src/c/aes192.c b/src/c/aes192.c
index 6e97637..702ee5e 100644
--- a/src/c/aes192.c
+++ b/src/c/aes192.c
@@ -11,8 +11,8 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesNI_Block128 __fastcall aesni_aes192_encrypt_block_(
- AesNI_Block128 plaintext,
+AesNI_Aes_Block __fastcall aesni_aes192_encrypt_block_(
+ AesNI_Aes_Block plaintext,
const AesNI_Aes192_RoundKeys* encryption_keys)
{
plaintext = _mm_xor_si128(plaintext, encryption_keys->keys[0]);
@@ -30,8 +30,8 @@ AesNI_Block128 __fastcall aesni_aes192_encrypt_block_(
return _mm_aesenclast_si128(plaintext, encryption_keys->keys[12]);
}
-AesNI_Block128 __fastcall aesni_aes192_decrypt_block_(
- AesNI_Block128 ciphertext,
+AesNI_Aes_Block __fastcall aesni_aes192_decrypt_block_(
+ AesNI_Aes_Block ciphertext,
const AesNI_Aes192_RoundKeys* decryption_keys)
{
ciphertext = _mm_xor_si128(ciphertext, decryption_keys->keys[0]);
@@ -50,11 +50,11 @@ AesNI_Block128 __fastcall aesni_aes192_decrypt_block_(
}
static void __fastcall aesni_aes192_expand_key_assist(
- AesNI_Block128* prev_lo,
- AesNI_Block128* prev_hi,
- AesNI_Block128 hwgen)
+ AesNI_Aes_Block* prev_lo,
+ AesNI_Aes_Block* prev_hi,
+ AesNI_Aes_Block hwgen)
{
- AesNI_Block128 tmp = *prev_lo;
+ AesNI_Aes_Block tmp = *prev_lo;
tmp = _mm_slli_si128(tmp, 4);
*prev_lo = _mm_xor_si128(*prev_lo, tmp);
@@ -75,8 +75,8 @@ static void __fastcall aesni_aes192_expand_key_assist(
}
void __fastcall aesni_aes192_expand_key_(
- AesNI_Block128 key_lo,
- AesNI_Block128 key_hi,
+ AesNI_Aes_Block key_lo,
+ AesNI_Aes_Block key_hi,
AesNI_Aes192_RoundKeys* encryption_keys)
{
encryption_keys->keys[0] = key_lo;
diff --git a/src/c/aes256.c b/src/c/aes256.c
index 820010d..243ec03 100644
--- a/src/c/aes256.c
+++ b/src/c/aes256.c
@@ -11,8 +11,8 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AesNI_Block128 __fastcall aesni_aes256_encrypt_block_(
- AesNI_Block128 plaintext,
+AesNI_Aes_Block __fastcall aesni_aes256_encrypt_block_(
+ AesNI_Aes_Block plaintext,
const AesNI_Aes256_RoundKeys* encryption_keys)
{
plaintext = _mm_xor_si128(plaintext, encryption_keys->keys[0]);
@@ -32,8 +32,8 @@ AesNI_Block128 __fastcall aesni_aes256_encrypt_block_(
return _mm_aesenclast_si128(plaintext, encryption_keys->keys[14]);
}
-AesNI_Block128 __fastcall aesni_aes256_decrypt_block_(
- AesNI_Block128 ciphertext,
+AesNI_Aes_Block __fastcall aesni_aes256_decrypt_block_(
+ AesNI_Aes_Block ciphertext,
const AesNI_Aes256_RoundKeys* decryption_keys)
{
ciphertext = _mm_xor_si128(ciphertext, decryption_keys->keys[0]);
@@ -53,12 +53,12 @@ AesNI_Block128 __fastcall aesni_aes256_decrypt_block_(
return _mm_aesdeclast_si128(ciphertext, decryption_keys->keys[14]);
}
-static AesNI_Block128 __fastcall aesni_aes256_expand_key_assist(
- AesNI_Block128* prev_lo,
- AesNI_Block128* prev_hi,
- AesNI_Block128 hwgen)
+static AesNI_Aes_Block __fastcall aesni_aes256_expand_key_assist(
+ AesNI_Aes_Block* prev_lo,
+ AesNI_Aes_Block* prev_hi,
+ AesNI_Aes_Block hwgen)
{
- AesNI_Block128 tmp = *prev_lo;
+ AesNI_Aes_Block tmp = *prev_lo;
tmp = _mm_slli_si128(tmp, 4);
*prev_lo = _mm_xor_si128(*prev_lo, tmp);
@@ -77,12 +77,12 @@ static AesNI_Block128 __fastcall aesni_aes256_expand_key_assist(
}
void __fastcall aesni_aes256_expand_key_(
- AesNI_Block128 key_lo,
- AesNI_Block128 key_hi,
+ AesNI_Aes_Block key_lo,
+ AesNI_Aes_Block key_hi,
AesNI_Aes256_RoundKeys* encryption_keys)
{
- AesNI_Block128 prev_lo, prev_hi;
- AesNI_Block128 hwgen;
+ AesNI_Aes_Block prev_lo, prev_hi;
+ AesNI_Aes_Block hwgen;
prev_lo = encryption_keys->keys[0] = key_lo;
prev_hi = encryption_keys->keys[1] = key_hi;