aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/include
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 /include
parentallow to choose between C in asm implementations (diff)
downloadaes-tools-f03495351c34315d30cc8566d1ef3884baa29d6b.tar.gz
aes-tools-f03495351c34315d30cc8566d1ef3884baa29d6b.zip
refactoring
Diffstat (limited to '')
-rw-r--r--include/aesni/api.h60
-rw-r--r--include/aesni/raw.h12
2 files changed, 36 insertions, 36 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);