diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/aes128cbc.cpp | 16 | ||||
-rw-r--r-- | examples/aes128cfb.cpp | 10 | ||||
-rw-r--r-- | examples/aes128ctr.cpp | 10 | ||||
-rw-r--r-- | examples/aes128ecb.cpp | 16 | ||||
-rw-r--r-- | examples/aes128ofb.cpp | 10 | ||||
-rw-r--r-- | examples/aes192cbc.cpp | 16 | ||||
-rw-r--r-- | examples/aes192cfb.cpp | 10 | ||||
-rw-r--r-- | examples/aes192ctr.cpp | 10 | ||||
-rw-r--r-- | examples/aes192ecb.cpp | 16 | ||||
-rw-r--r-- | examples/aes192ofb.cpp | 10 | ||||
-rw-r--r-- | examples/aes256cbc.cpp | 16 | ||||
-rw-r--r-- | examples/aes256cfb.cpp | 10 | ||||
-rw-r--r-- | examples/aes256ctr.cpp | 10 | ||||
-rw-r--r-- | examples/aes256ecb.cpp | 16 | ||||
-rw-r--r-- | examples/aes256ofb.cpp | 10 | ||||
-rw-r--r-- | examples/common.hpp | 20 |
16 files changed, 103 insertions, 103 deletions
diff --git a/examples/aes128cbc.cpp b/examples/aes128cbc.cpp index b6253e6..09f13cd 100644 --- a/examples/aes128cbc.cpp +++ b/examples/aes128cbc.cpp @@ -28,20 +28,20 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys128 encryption_schedule; - aesni_aes128_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys128 encryption_keys; + aesni_aes128_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - aesni::aes::RoundKeys128 decryption_schedule; - aesni_aes128_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys128 decryption_keys; + aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - aesni::aes::Block decrypted = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); + aesni::aes::Block decrypted = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes128cfb.cpp b/examples/aes128cfb.cpp index 472b0c3..a8bbb03 100644 --- a/examples/aes128cfb.cpp +++ b/examples/aes128cfb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys128 encryption_schedule; - aesni_aes128_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys128 encryption_keys; + aesni_aes128_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes128ctr.cpp b/examples/aes128ctr.cpp index 3f64173..671a5f3 100644 --- a/examples/aes128ctr.cpp +++ b/examples/aes128ctr.cpp @@ -28,14 +28,14 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys128 encryption_schedule; - aesni_aes128_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys128 encryption_keys; + aesni_aes128_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); dump_decrypted(decrypted); return 0; diff --git a/examples/aes128ecb.cpp b/examples/aes128ecb.cpp index cf0d033..c716c70 100644 --- a/examples/aes128ecb.cpp +++ b/examples/aes128ecb.cpp @@ -25,18 +25,18 @@ int main() aesni::aes::Key128 key; make_default_key(key); - aesni::aes::RoundKeys128 encryption_schedule; - aesni_aes128_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys128 encryption_keys; + aesni_aes128_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_keys); dump_ciphertext(ciphertext); - aesni::aes::RoundKeys128 decryption_schedule; - aesni_aes128_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys128 decryption_keys; + aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - const auto decrypted = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_keys); dump_decrypted(decrypted); return 0; diff --git a/examples/aes128ofb.cpp b/examples/aes128ofb.cpp index d6a5c87..32d67d5 100644 --- a/examples/aes128ofb.cpp +++ b/examples/aes128ofb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys128 encryption_schedule; - aesni_aes128_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys128 encryption_keys; + aesni_aes128_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192cbc.cpp b/examples/aes192cbc.cpp index 2c18d34..8eaffa8 100644 --- a/examples/aes192cbc.cpp +++ b/examples/aes192cbc.cpp @@ -28,20 +28,20 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys192 encryption_schedule; - aesni_aes192_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys192 encryption_keys; + aesni_aes192_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - aesni::aes::RoundKeys192 decryption_schedule; - aesni_aes192_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys192 decryption_keys; + aesni_aes192_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - const auto decrypted = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192cfb.cpp b/examples/aes192cfb.cpp index 4deaf1c..b84700e 100644 --- a/examples/aes192cfb.cpp +++ b/examples/aes192cfb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys192 encryption_schedule; - aesni_aes192_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys192 encryption_keys; + aesni_aes192_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes192ctr.cpp b/examples/aes192ctr.cpp index 022bc33..bdd34cf 100644 --- a/examples/aes192ctr.cpp +++ b/examples/aes192ctr.cpp @@ -28,14 +28,14 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys192 encryption_schedule; - aesni_aes192_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys192 encryption_keys; + aesni_aes192_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); dump_decrypted(decrypted); } catch (const std::exception& e) diff --git a/examples/aes192ecb.cpp b/examples/aes192ecb.cpp index 6de3e16..7a7cb92 100644 --- a/examples/aes192ecb.cpp +++ b/examples/aes192ecb.cpp @@ -25,18 +25,18 @@ int main() aesni::aes::Key192 key; make_default_key(key); - aesni::aes::RoundKeys192 encryption_schedule; - aesni_aes192_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys192 encryption_keys; + aesni_aes192_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_keys); dump_ciphertext(ciphertext); - aesni::aes::RoundKeys192 decryption_schedule; - aesni_aes192_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys192 decryption_keys; + aesni_aes192_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - const auto decrypted = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_keys); dump_decrypted(decrypted); return 0; diff --git a/examples/aes192ofb.cpp b/examples/aes192ofb.cpp index df907cd..c0fc88e 100644 --- a/examples/aes192ofb.cpp +++ b/examples/aes192ofb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys192 encryption_schedule; - aesni_aes192_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys192 encryption_keys; + aesni_aes192_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256cbc.cpp b/examples/aes256cbc.cpp index 9123c9b..8ce14c2 100644 --- a/examples/aes256cbc.cpp +++ b/examples/aes256cbc.cpp @@ -28,20 +28,20 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys256 encryption_schedule; - aesni_aes256_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys256 encryption_keys; + aesni_aes256_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - aesni::aes::RoundKeys256 decryption_schedule; - aesni_aes256_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys256 decryption_keys; + aesni_aes256_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - const auto decrypted = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256cfb.cpp b/examples/aes256cfb.cpp index a6e8ba7..599392c 100644 --- a/examples/aes256cfb.cpp +++ b/examples/aes256cfb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys256 encryption_schedule; - aesni_aes256_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys256 encryption_keys; + aesni_aes256_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/aes256ctr.cpp b/examples/aes256ctr.cpp index 3360c76..c27d177 100644 --- a/examples/aes256ctr.cpp +++ b/examples/aes256ctr.cpp @@ -28,14 +28,14 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys256 encryption_schedule; - aesni_aes256_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys256 encryption_keys; + aesni_aes256_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_schedule, iv, 0); + const auto ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); dump_ciphertext(ciphertext); - const auto decrypted = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_schedule, iv, 0); + const auto decrypted = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); dump_decrypted(decrypted); } catch (const std::exception& e) diff --git a/examples/aes256ecb.cpp b/examples/aes256ecb.cpp index d11aaa6..49e03bf 100644 --- a/examples/aes256ecb.cpp +++ b/examples/aes256ecb.cpp @@ -25,18 +25,18 @@ int main() aesni::aes::Key256 key; make_default_key(key); - aesni::aes::RoundKeys256 encryption_schedule; - aesni_aes256_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys256 encryption_keys; + aesni_aes256_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_schedule); + const auto ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_keys); dump_ciphertext(ciphertext); - aesni::aes::RoundKeys256 decryption_schedule; - aesni_aes256_derive_decryption_keys(&encryption_schedule, &decryption_schedule); - dump_decryption_schedule(decryption_schedule); + aesni::aes::RoundKeys256 decryption_keys; + aesni_aes256_derive_decryption_keys(&encryption_keys, &decryption_keys); + dump_decryption_keys(decryption_keys); - const auto decrypted = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_schedule); + const auto decrypted = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_keys); dump_decrypted(decrypted); return 0; diff --git a/examples/aes256ofb.cpp b/examples/aes256ofb.cpp index b4f9a1f..3bc7268 100644 --- a/examples/aes256ofb.cpp +++ b/examples/aes256ofb.cpp @@ -28,16 +28,16 @@ int main() aesni::aes::Block iv; make_default_iv(iv); - aesni::aes::RoundKeys256 encryption_schedule; - aesni_aes256_expand_key(&key, &encryption_schedule); - dump_encryption_schedule(encryption_schedule); + aesni::aes::RoundKeys256 encryption_keys; + aesni_aes256_expand_key(&key, &encryption_keys); + dump_encryption_keys(encryption_keys); aesni::aes::Block next_iv; - const auto ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_schedule, iv, &next_iv); + const auto ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); dump_next_iv(next_iv); - const auto decrypted = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_schedule, iv, &next_iv); + const auto decrypted = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); dump_next_iv(next_iv); diff --git a/examples/common.hpp b/examples/common.hpp index 25ee87d..9e98de5 100644 --- a/examples/common.hpp +++ b/examples/common.hpp @@ -82,24 +82,24 @@ namespace dump_iv(iv); } - template <typename KeyScheduleT> - void dump_schedule(const char* name, const KeyScheduleT& schedule) + template <typename RoundKeysT> + void dump_round_keys(const char* name, const RoundKeysT& round_keys) { std::cout << name << ":\n"; - for (std::size_t i = 0; i < aesni::aes::get_number_of_rounds(schedule); ++i) - std::cout << "\t[" << i << "]: " << aesni::aes::to_string(schedule.keys[i]) << "\n"; + for (std::size_t i = 0; i < aesni::aes::get_number_of_rounds(round_keys); ++i) + std::cout << "\t[" << i << "]: " << aesni::aes::to_string(round_keys.keys[i]) << "\n"; std::cout << "\n"; } - template <typename KeyScheduleT> - void dump_encryption_schedule(const KeyScheduleT& schedule) + template <typename RoundKeysT> + void dump_encryption_keys(const RoundKeysT& round_keys) { - dump_schedule("Encryption schedule", schedule); + dump_round_keys("Encryption round keys", round_keys); } - template <typename KeyScheduleT> - void dump_decryption_schedule(const KeyScheduleT& schedule) + template <typename RoundKeysT> + void dump_decryption_keys(const RoundKeysT& round_keys) { - dump_schedule("Decryption schedule", schedule); + dump_round_keys("Decryption round keys", round_keys); } } |