aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/aes/src/c/aes128.c
diff options
context:
space:
mode:
authorEgor Tensin <egor@tensin.name>2026-06-13 19:06:16 +0200
committerEgor Tensin <egor@tensin.name>2026-06-13 19:06:16 +0200
commit1b2505ac21ce8dd09a34aff86455a8a3677094a0 (patch)
tree61124c0c28bb884842ac931f11a6c203a034fe7e /aes/src/c/aes128.c
parentworkflows/ci: add linting for Python test scripts (diff)
downloadaes-tools-1b2505ac21ce8dd09a34aff86455a8a3677094a0.tar.gz
aes-tools-1b2505ac21ce8dd09a34aff86455a8a3677094a0.zip
finally, perfect .clang-format settings?
Diffstat (limited to 'aes/src/c/aes128.c')
-rw-r--r--aes/src/c/aes128.c24
1 files changed, 16 insertions, 8 deletions
diff --git a/aes/src/c/aes128.c b/aes/src/c/aes128.c
index 6b3a96a..d7b7243 100644
--- a/aes/src/c/aes128.c
+++ b/aes/src/c/aes128.c
@@ -10,8 +10,10 @@
#include <emmintrin.h>
#include <wmmintrin.h>
-AES_AES_Block __fastcall aes_AES128_encrypt_block_(AES_AES_Block plaintext,
- const AES_AES128_RoundKeys* encryption_keys) {
+AES_AES_Block __fastcall aes_AES128_encrypt_block_(
+ AES_AES_Block plaintext,
+ const AES_AES128_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]);
@@ -25,8 +27,10 @@ AES_AES_Block __fastcall aes_AES128_encrypt_block_(AES_AES_Block plaintext,
return _mm_aesenclast_si128(plaintext, encryption_keys->keys[10]);
}
-AES_AES_Block __fastcall aes_AES128_decrypt_block_(AES_AES_Block ciphertext,
- const AES_AES128_RoundKeys* decryption_keys) {
+AES_AES_Block __fastcall aes_AES128_decrypt_block_(
+ AES_AES_Block ciphertext,
+ const AES_AES128_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]);
@@ -40,8 +44,10 @@ AES_AES_Block __fastcall aes_AES128_decrypt_block_(AES_AES_Block ciphertext,
return _mm_aesdeclast_si128(ciphertext, decryption_keys->keys[10]);
}
-static AES_AES_Block __fastcall aes_aes128_expand_key_assist(AES_AES_Block prev,
- AES_AES_Block hwgen) {
+static AES_AES_Block __fastcall aes_aes128_expand_key_assist(
+ AES_AES_Block prev,
+ AES_AES_Block hwgen
+) {
AES_AES_Block tmp = prev;
tmp = _mm_slli_si128(tmp, 4);
@@ -81,8 +87,10 @@ void __fastcall aes_AES128_expand_key_(AES_AES_Block key, AES_AES128_RoundKeys*
aes_aes128_expand_key_assist(prev, _mm_aeskeygenassist_si128(prev, 0x36));
}
-void __fastcall aes_AES128_derive_decryption_keys_(const AES_AES128_RoundKeys* encryption_keys,
- AES_AES128_RoundKeys* decryption_keys) {
+void __fastcall aes_AES128_derive_decryption_keys_(
+ const AES_AES128_RoundKeys* encryption_keys,
+ AES_AES128_RoundKeys* decryption_keys
+) {
decryption_keys->keys[0] = encryption_keys->keys[10];
decryption_keys->keys[1] = _mm_aesimc_si128(encryption_keys->keys[9]);
decryption_keys->keys[2] = _mm_aesimc_si128(encryption_keys->keys[8]);