From a483e9bd8a7efe3fbad0f0c8ec70d9f5041d86b2 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Fri, 19 Jun 2015 01:29:53 +0300 Subject: respect the generic interface in CTR functions --- examples/aes128ctr.cpp | 7 +++++-- examples/aes192ctr.cpp | 7 +++++-- examples/aes256ctr.cpp | 7 +++++-- 3 files changed, 15 insertions(+), 6 deletions(-) (limited to 'examples') diff --git a/examples/aes128ctr.cpp b/examples/aes128ctr.cpp index 671a5f3..ebd8793 100644 --- a/examples/aes128ctr.cpp +++ b/examples/aes128ctr.cpp @@ -32,11 +32,14 @@ int main() aesni_aes128_expand_key(&key, &encryption_keys); dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); + aesni::aes::Block next_iv; + const auto ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); + dump_next_iv(next_iv); - const auto decrypted = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); + const auto decrypted = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); + dump_next_iv(next_iv); return 0; } diff --git a/examples/aes192ctr.cpp b/examples/aes192ctr.cpp index bdd34cf..d53cb38 100644 --- a/examples/aes192ctr.cpp +++ b/examples/aes192ctr.cpp @@ -32,11 +32,14 @@ int main() aesni_aes192_expand_key(&key, &encryption_keys); dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); + aesni::aes::Block next_iv; + const auto ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); + dump_next_iv(next_iv); - const auto decrypted = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); + const auto decrypted = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); + dump_next_iv(next_iv); } catch (const std::exception& e) { diff --git a/examples/aes256ctr.cpp b/examples/aes256ctr.cpp index c27d177..1431992 100644 --- a/examples/aes256ctr.cpp +++ b/examples/aes256ctr.cpp @@ -32,11 +32,14 @@ int main() aesni_aes256_expand_key(&key, &encryption_keys); dump_encryption_keys(encryption_keys); - const auto ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, 0); + aesni::aes::Block next_iv; + const auto ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, &next_iv); dump_ciphertext(ciphertext); + dump_next_iv(next_iv); - const auto decrypted = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, 0); + const auto decrypted = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &next_iv); dump_decrypted(decrypted); + dump_next_iv(next_iv); } catch (const std::exception& e) { -- cgit v1.2.3