From 0651133db30c0932877780c2f98901e4ca1072e1 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 17 Jun 2015 18:29:40 +0300 Subject: refactoring --- examples/aes128cbc.cpp | 8 ++++---- examples/aes128cfb.cpp | 6 +++--- examples/aes128ctr.cpp | 6 +++--- examples/aes128ecb.cpp | 8 ++++---- examples/aes128ofb.cpp | 6 +++--- examples/aes192cbc.cpp | 8 ++++---- examples/aes192cfb.cpp | 6 +++--- examples/aes192ctr.cpp | 6 +++--- examples/aes192ecb.cpp | 8 ++++---- examples/aes192ofb.cpp | 6 +++--- examples/aes256cbc.cpp | 8 ++++---- examples/aes256cfb.cpp | 6 +++--- examples/aes256ctr.cpp | 6 +++--- examples/aes256ecb.cpp | 8 ++++---- examples/aes256ofb.cpp | 6 +++--- 15 files changed, 51 insertions(+), 51 deletions(-) (limited to 'examples') diff --git a/examples/aes128cbc.cpp b/examples/aes128cbc.cpp index c7e6550..5bb8c67 100644 --- a/examples/aes128cbc.cpp +++ b/examples/aes128cbc.cpp @@ -29,19 +29,19 @@ int main() make_default_iv(iv); aesni::KeySchedule128 encryption_schedule; - aesni_expand_key_schedule128(key, &encryption_schedule); + aesni_aes128_expand_key(key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cbc128(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); aesni::KeySchedule128 decryption_schedule; - aesni_invert_key_schedule128(&encryption_schedule, &decryption_schedule); + aesni_aes128_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - aesni::Block128 decrypted = aesni_decrypt_block_cbc128(ciphertext, &decryption_schedule, iv, &next_iv); + aesni::Block128 decrypted = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes128cfb.cpp b/examples/aes128cfb.cpp index 72a1be0..b5f78a7 100644 --- a/examples/aes128cfb.cpp +++ b/examples/aes128cfb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule128 encryption_schedule; - aesni_expand_key_schedule128(key, &encryption_schedule); + aesni_aes128_expand_key(key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cfb128(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_cfb128(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes128ctr.cpp b/examples/aes128ctr.cpp index a02052c..0515336 100644 --- a/examples/aes128ctr.cpp +++ b/examples/aes128ctr.cpp @@ -29,13 +29,13 @@ int main() make_default_iv(iv); aesni::KeySchedule128 encryption_schedule; - aesni_expand_key_schedule128(key, &encryption_schedule); + aesni_aes128_expand_key(key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ctr128(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_decrypt_block_ctr128(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); dump_decrypted(decrypted); return 0; diff --git a/examples/aes128ecb.cpp b/examples/aes128ecb.cpp index 8ffda3a..b33c00a 100644 --- a/examples/aes128ecb.cpp +++ b/examples/aes128ecb.cpp @@ -26,17 +26,17 @@ int main() make_default_key(key); aesni::KeySchedule128 encryption_schedule; - aesni_expand_key_schedule128(key, &encryption_schedule); + aesni_aes128_expand_key(key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ecb128(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_schedule); dump_ciphertext(ciphertext); aesni::KeySchedule128 decryption_schedule; - aesni_invert_key_schedule128(&encryption_schedule, &decryption_schedule); + aesni_aes128_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - const auto decrypted = aesni_decrypt_block_ecb128(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_schedule); dump_decrypted(decrypted); return 0; diff --git a/examples/aes128ofb.cpp b/examples/aes128ofb.cpp index 6b63936..da3d750 100644 --- a/examples/aes128ofb.cpp +++ b/examples/aes128ofb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule128 encryption_schedule; - aesni_expand_key_schedule128(key, &encryption_schedule); + aesni_aes128_expand_key(key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_ofb128(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_ofb128(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192cbc.cpp b/examples/aes192cbc.cpp index f4341ea..6d7ff74 100644 --- a/examples/aes192cbc.cpp +++ b/examples/aes192cbc.cpp @@ -29,19 +29,19 @@ int main() make_default_iv(iv); aesni::KeySchedule192 encryption_schedule; - aesni_expand_key_schedule192(&key, &encryption_schedule); + aesni_aes192_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cbc192(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); aesni::KeySchedule192 decryption_schedule; - aesni_invert_key_schedule192(&encryption_schedule, &decryption_schedule); + aesni_aes192_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - const auto decrypted = aesni_decrypt_block_cbc192(ciphertext, &decryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192cfb.cpp b/examples/aes192cfb.cpp index 88b94b7..a8662ca 100644 --- a/examples/aes192cfb.cpp +++ b/examples/aes192cfb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule192 encryption_schedule; - aesni_expand_key_schedule192(&key, &encryption_schedule); + aesni_aes192_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cfb192(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_cfb192(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192ctr.cpp b/examples/aes192ctr.cpp index f7278cf..ef4dde6 100644 --- a/examples/aes192ctr.cpp +++ b/examples/aes192ctr.cpp @@ -29,13 +29,13 @@ int main() make_default_iv(iv); aesni::KeySchedule192 encryption_schedule; - aesni_expand_key_schedule192(&key, &encryption_schedule); + aesni_aes192_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ctr192(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_decrypt_block_ctr192(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); dump_decrypted(decrypted); } catch (const std::exception& e) diff --git a/examples/aes192ecb.cpp b/examples/aes192ecb.cpp index 139b48b..6faf96f 100644 --- a/examples/aes192ecb.cpp +++ b/examples/aes192ecb.cpp @@ -26,17 +26,17 @@ int main() make_default_key(key); aesni::KeySchedule192 encryption_schedule; - aesni_expand_key_schedule192(&key, &encryption_schedule); + aesni_aes192_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ecb192(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_schedule); dump_ciphertext(ciphertext); aesni::KeySchedule192 decryption_schedule; - aesni_invert_key_schedule192(&encryption_schedule, &decryption_schedule); + aesni_aes192_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - const auto decrypted = aesni_decrypt_block_ecb192(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_schedule); dump_decrypted(decrypted); return 0; diff --git a/examples/aes192ofb.cpp b/examples/aes192ofb.cpp index 5a07278..e7de746 100644 --- a/examples/aes192ofb.cpp +++ b/examples/aes192ofb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule192 encryption_schedule; - aesni_expand_key_schedule192(&key, &encryption_schedule); + aesni_aes192_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_ofb192(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_ofb192(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256cbc.cpp b/examples/aes256cbc.cpp index 0253adb..66f7c38 100644 --- a/examples/aes256cbc.cpp +++ b/examples/aes256cbc.cpp @@ -29,19 +29,19 @@ int main() make_default_iv(iv); aesni::KeySchedule256 encryption_schedule; - aesni_expand_key_schedule256(&key, &encryption_schedule); + aesni_aes256_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cbc256(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); aesni::KeySchedule256 decryption_schedule; - aesni_invert_key_schedule256(&encryption_schedule, &decryption_schedule); + aesni_aes256_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - const auto decrypted = aesni_decrypt_block_cbc256(ciphertext, &decryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256cfb.cpp b/examples/aes256cfb.cpp index ce05aec..8a23146 100644 --- a/examples/aes256cfb.cpp +++ b/examples/aes256cfb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule256 encryption_schedule; - aesni_expand_key_schedule256(&key, &encryption_schedule); + aesni_aes256_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_cfb256(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_cfb256(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256ctr.cpp b/examples/aes256ctr.cpp index 1be85f7..b5e2ae7 100644 --- a/examples/aes256ctr.cpp +++ b/examples/aes256ctr.cpp @@ -29,13 +29,13 @@ int main() make_default_iv(iv); aesni::KeySchedule256 encryption_schedule; - aesni_expand_key_schedule256(&key, &encryption_schedule); + aesni_aes256_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ctr256(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_decrypt_block_ctr256(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); dump_decrypted(decrypted); } catch (const std::exception& e) diff --git a/examples/aes256ecb.cpp b/examples/aes256ecb.cpp index 72f132e..aebd14b 100644 --- a/examples/aes256ecb.cpp +++ b/examples/aes256ecb.cpp @@ -26,17 +26,17 @@ int main() make_default_key(key); aesni::KeySchedule256 encryption_schedule; - aesni_expand_key_schedule256(&key, &encryption_schedule); + aesni_aes256_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); - const auto ciphertext = aesni_encrypt_block_ecb256(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_schedule); dump_ciphertext(ciphertext); aesni::KeySchedule256 decryption_schedule; - aesni_invert_key_schedule256(&encryption_schedule, &decryption_schedule); + aesni_aes256_derive_decryption_keys(&encryption_schedule, &decryption_schedule); dump_decryption_schedule(decryption_schedule); - const auto decrypted = aesni_decrypt_block_ecb256(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_schedule); dump_decrypted(decrypted); return 0; diff --git a/examples/aes256ofb.cpp b/examples/aes256ofb.cpp index 34f9725..cf1f1a0 100644 --- a/examples/aes256ofb.cpp +++ b/examples/aes256ofb.cpp @@ -29,15 +29,15 @@ int main() make_default_iv(iv); aesni::KeySchedule256 encryption_schedule; - aesni_expand_key_schedule256(&key, &encryption_schedule); + aesni_aes256_expand_key(&key, &encryption_schedule); dump_encryption_schedule(encryption_schedule); aesni::Block128 next_iv; - const auto ciphertext = aesni_encrypt_block_ofb256(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_decrypt_block_ofb256(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); -- cgit v1.2.3