From 44d58e0a10c7dfdb33899fa98c0eea790e0b90ce Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 17 Jun 2015 23:25:52 +0300 Subject: factoring out AES-specific stuff --- utils/aes128ecb_decrypt_file.cpp | 10 +++++----- utils/aes128ecb_encrypt_file.cpp | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'utils') diff --git a/utils/aes128ecb_decrypt_file.cpp b/utils/aes128ecb_decrypt_file.cpp index 0f88144..ab55304 100644 --- a/utils/aes128ecb_decrypt_file.cpp +++ b/utils/aes128ecb_decrypt_file.cpp @@ -36,15 +36,15 @@ namespace int main(int argc, char** argv) { - AesNI_Block128 key; - AesNI_Aes128_RoundKeys encryption_keys, decryption_keys; - if (argc != 4) exit_with_usage(); try { - aesni_parse_block128(&key, argv[1], aesni::ErrorDetailsThrowsInDestructor()); + aesni::aes::Key128 key; + aesni::aes::from_string(key, argv[1]); + + aesni::aes::RoundKeys128 encryption_keys, decryption_keys; const std::string src_path(argv[2]); const std::string dest_path(argv[3]); @@ -60,7 +60,7 @@ int main(int argc, char** argv) src_buf.assign(std::istreambuf_iterator(src_ifs), std::istreambuf_iterator()); - aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_expand_key(&key, &encryption_keys); aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); std::size_t dest_size; diff --git a/utils/aes128ecb_encrypt_file.cpp b/utils/aes128ecb_encrypt_file.cpp index c7fef82..d197ec6 100644 --- a/utils/aes128ecb_encrypt_file.cpp +++ b/utils/aes128ecb_encrypt_file.cpp @@ -36,15 +36,15 @@ namespace int main(int argc, char** argv) { - AesNI_Block128 key; - AesNI_Aes128_RoundKeys encryption_keys; - if (argc != 4) exit_with_usage(); try { - aesni_parse_block128(&key, argv[1], aesni::ErrorDetailsThrowsInDestructor()); + aesni::aes::Key128 key; + aesni::aes::from_string(key, argv[1]); + + AesNI_Aes128_RoundKeys encryption_keys; const std::string src_path(argv[2]); const std::string dest_path(argv[3]); @@ -60,7 +60,7 @@ int main(int argc, char** argv) src_buf.assign(std::istreambuf_iterator(src_ifs), std::istreambuf_iterator()); - aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_expand_key(&key, &encryption_keys); std::size_t dest_size; -- cgit v1.2.3