diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-03 22:46:18 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-03 22:46:18 +0300 |
commit | 91923133903515c98973543c0e17705537449c22 (patch) | |
tree | 3848b63fe8e6c2d2e5ff7f564bacadfd5652a783 /examples/aes192cbc_example.c | |
parent | add OFB mode (diff) | |
download | aes-tools-91923133903515c98973543c0e17705537449c22.tar.gz aes-tools-91923133903515c98973543c0e17705537449c22.zip |
init vectors are calculated by API functions
Diffstat (limited to '')
-rw-r--r-- | examples/aes192cbc_example.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/examples/aes192cbc_example.c b/examples/aes192cbc_example.c index dc6d478..2133a17 100644 --- a/examples/aes192cbc_example.c +++ b/examples/aes192cbc_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv; + __declspec(align(16)) AesBlock128 plain, cypher, decrypted, iv, next_iv; __declspec(align(16)) AesBlock192 key; __declspec(align(16)) Aes192KeySchedule key_schedule, inverted_schedule; @@ -38,11 +38,15 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes192cbc_encrypt(plain, &key_schedule, iv); + cypher = aes192cbc_encrypt(plain, &key_schedule, iv, &next_iv); printf("\n"); printf("Cypher: %s\n", format_aes_block128(&cypher).str); print_aes_block128_fips_matrix_style(&cypher); + printf("\n"); + printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); + print_aes_block128_fips_matrix_style(&next_iv); + aes192_invert_key_schedule(&key_schedule, &inverted_schedule); printf("\n"); @@ -50,10 +54,14 @@ int main() for (int i = 0; i < 13; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&inverted_schedule.keys[i]).str); - decrypted = aes192cbc_decrypt(cypher, &inverted_schedule, iv); + decrypted = aes192cbc_decrypt(cypher, &inverted_schedule, iv, &next_iv); printf("\n"); printf("Decrypted: %s\n", format_aes_block128(&decrypted).str); print_aes_block128_fips_matrix_style(&decrypted); + printf("\n"); + printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); + print_aes_block128_fips_matrix_style(&next_iv); + return 0; } |