diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-11 01:15:14 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-11 01:15:14 +0300 |
commit | 7c14e13c717c25818780ff4cc459d82a2ec0473a (patch) | |
tree | b03d3b5149c43334052c1a4e423df9025544bdd5 /src/c/aes256.c | |
parent | fix register usage in the asm implementation (diff) | |
download | aes-tools-7c14e13c717c25818780ff4cc459d82a2ec0473a.tar.gz aes-tools-7c14e13c717c25818780ff4cc459d82a2ec0473a.zip |
refactoring
Diffstat (limited to 'src/c/aes256.c')
-rw-r--r-- | src/c/aes256.c | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/src/c/aes256.c b/src/c/aes256.c index be4f783..a9042c6 100644 --- a/src/c/aes256.c +++ b/src/c/aes256.c @@ -11,9 +11,9 @@ #include <emmintrin.h> #include <wmmintrin.h> -AesBlock128 __fastcall raw_aes256_encrypt_block( - AesBlock128 plain, - Aes256KeySchedule* key_schedule) +AesNI_Block128 __fastcall aesni_raw_encrypt_block256( + AesNI_Block128 plain, + AesNI_KeySchedule256* key_schedule) { plain = _mm_xor_si128(plain, key_schedule->keys[0]); plain = _mm_aesenc_si128(plain, key_schedule->keys[1]); @@ -32,9 +32,9 @@ AesBlock128 __fastcall raw_aes256_encrypt_block( return _mm_aesenclast_si128(plain, key_schedule->keys[14]); } -AesBlock128 __fastcall raw_aes256_decrypt_block( - AesBlock128 cipher, - Aes256KeySchedule* inverted_schedule) +AesNI_Block128 __fastcall aesni_raw_decrypt_block256( + AesNI_Block128 cipher, + AesNI_KeySchedule256* inverted_schedule) { cipher = _mm_xor_si128(cipher, inverted_schedule->keys[0]); cipher = _mm_aesdec_si128(cipher, inverted_schedule->keys[1]); @@ -53,12 +53,12 @@ AesBlock128 __fastcall raw_aes256_decrypt_block( return _mm_aesdeclast_si128(cipher, inverted_schedule->keys[14]); } -static AesBlock128 __fastcall aes256_keygen_assist( - AesBlock128* prev_lo, - AesBlock128* prev_hi, - AesBlock128 hwgen) +static AesNI_Block128 __fastcall aes256_keygen_assist( + AesNI_Block128* prev_lo, + AesNI_Block128* prev_hi, + AesNI_Block128 hwgen) { - AesBlock128 tmp = *prev_lo; + AesNI_Block128 tmp = *prev_lo; tmp = _mm_slli_si128(tmp, 4); *prev_lo = _mm_xor_si128(*prev_lo, tmp); @@ -76,13 +76,13 @@ static AesBlock128 __fastcall aes256_keygen_assist( return *prev_hi; } -void __fastcall raw_aes256_expand_key_schedule( - AesBlock128 key_lo, - AesBlock128 key_hi, - Aes256KeySchedule* key_schedule) +void __fastcall aesni_raw_expand_key_schedule256( + AesNI_Block128 key_lo, + AesNI_Block128 key_hi, + AesNI_KeySchedule256* key_schedule) { - AesBlock128 prev_lo, prev_hi; - AesBlock128 hwgen; + AesNI_Block128 prev_lo, prev_hi; + AesNI_Block128 hwgen; prev_lo = key_schedule->keys[0] = key_lo; prev_hi = key_schedule->keys[1] = key_hi; @@ -140,9 +140,9 @@ void __fastcall raw_aes256_expand_key_schedule( key_schedule->keys[14] = aes256_keygen_assist(&prev_lo, &prev_hi, hwgen); } -void __fastcall raw_aes256_invert_key_schedule( - Aes256KeySchedule* key_schedule, - Aes256KeySchedule* inverted_schedule) +void __fastcall aesni_raw_invert_key_schedule256( + AesNI_KeySchedule256* key_schedule, + AesNI_KeySchedule256* inverted_schedule) { inverted_schedule->keys[0] = key_schedule->keys[14]; inverted_schedule->keys[1] = _mm_aesimc_si128(key_schedule->keys[13]); |