From 44d58e0a10c7dfdb33899fa98c0eea790e0b90ce Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 17 Jun 2015 23:25:52 +0300 Subject: factoring out AES-specific stuff --- src/c/aes256.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'src/c/aes256.c') 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 #include -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; -- cgit v1.2.3