diff options
| author | Egor Tensin <egor@tensin.name> | 2026-06-13 14:37:12 +0200 |
|---|---|---|
| committer | Egor Tensin <egor@tensin.name> | 2026-06-13 14:37:12 +0200 |
| commit | 6cac3cb57cb4f430df80f8a21e358ad40ae59c89 (patch) | |
| tree | b9551474bedb7fdd6a9a4e37bc641bd8d0cfcfb4 /aes/src/c/aes256.c | |
| parent | cmake: upgrade cmake-common, introduce new features, etc. (diff) | |
| download | aes-tools-6cac3cb57cb4f430df80f8a21e358ad40ae59c89.tar.gz aes-tools-6cac3cb57cb4f430df80f8a21e358ad40ae59c89.zip | |
add .clang-format
Diffstat (limited to 'aes/src/c/aes256.c')
| -rw-r--r-- | aes/src/c/aes256.c | 34 |
1 files changed, 12 insertions, 22 deletions
diff --git a/aes/src/c/aes256.c b/aes/src/c/aes256.c index 2190322..ea64f0f 100644 --- a/aes/src/c/aes256.c +++ b/aes/src/c/aes256.c @@ -10,10 +10,8 @@ #include <emmintrin.h> #include <wmmintrin.h> -AES_AES_Block __fastcall aes_AES256_encrypt_block_( - AES_AES_Block plaintext, - const AES_AES256_RoundKeys* encryption_keys) -{ +AES_AES_Block __fastcall aes_AES256_encrypt_block_(AES_AES_Block plaintext, + const AES_AES256_RoundKeys* encryption_keys) { plaintext = _mm_xor_si128(plaintext, encryption_keys->keys[0]); plaintext = _mm_aesenc_si128(plaintext, encryption_keys->keys[1]); plaintext = _mm_aesenc_si128(plaintext, encryption_keys->keys[2]); @@ -31,10 +29,8 @@ AES_AES_Block __fastcall aes_AES256_encrypt_block_( return _mm_aesenclast_si128(plaintext, encryption_keys->keys[14]); } -AES_AES_Block __fastcall aes_AES256_decrypt_block_( - AES_AES_Block ciphertext, - const AES_AES256_RoundKeys* decryption_keys) -{ +AES_AES_Block __fastcall aes_AES256_decrypt_block_(AES_AES_Block ciphertext, + const AES_AES256_RoundKeys* decryption_keys) { ciphertext = _mm_xor_si128(ciphertext, decryption_keys->keys[0]); ciphertext = _mm_aesdec_si128(ciphertext, decryption_keys->keys[1]); ciphertext = _mm_aesdec_si128(ciphertext, decryption_keys->keys[2]); @@ -52,11 +48,9 @@ AES_AES_Block __fastcall aes_AES256_decrypt_block_( return _mm_aesdeclast_si128(ciphertext, decryption_keys->keys[14]); } -static AES_AES_Block __fastcall aes_aes256_expand_key_assist( - AES_AES_Block* prev_lo, - AES_AES_Block* prev_hi, - AES_AES_Block hwgen) -{ +static AES_AES_Block __fastcall aes_aes256_expand_key_assist(AES_AES_Block* prev_lo, + AES_AES_Block* prev_hi, + AES_AES_Block hwgen) { AES_AES_Block tmp = *prev_lo; tmp = _mm_slli_si128(tmp, 4); @@ -75,11 +69,9 @@ static AES_AES_Block __fastcall aes_aes256_expand_key_assist( return *prev_hi; } -void __fastcall aes_AES256_expand_key_( - AES_AES_Block key_lo, - AES_AES_Block key_hi, - AES_AES256_RoundKeys* encryption_keys) -{ +void __fastcall aes_AES256_expand_key_(AES_AES_Block key_lo, + AES_AES_Block key_hi, + AES_AES256_RoundKeys* encryption_keys) { AES_AES_Block prev_lo, prev_hi; AES_AES_Block hwgen; @@ -139,10 +131,8 @@ void __fastcall aes_AES256_expand_key_( encryption_keys->keys[14] = aes_aes256_expand_key_assist(&prev_lo, &prev_hi, hwgen); } -void __fastcall aes_AES256_derive_decryption_keys_( - const AES_AES256_RoundKeys* encryption_keys, - AES_AES256_RoundKeys* decryption_keys) -{ +void __fastcall aes_AES256_derive_decryption_keys_(const AES_AES256_RoundKeys* encryption_keys, + AES_AES256_RoundKeys* decryption_keys) { decryption_keys->keys[0] = encryption_keys->keys[14]; decryption_keys->keys[1] = _mm_aesimc_si128(encryption_keys->keys[13]); decryption_keys->keys[2] = _mm_aesimc_si128(encryption_keys->keys[12]); |
