From 91923133903515c98973543c0e17705537449c22 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 3 Jun 2015 22:46:18 +0300 Subject: init vectors are calculated by API functions --- examples/aes128cfb_example.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'examples/aes128cfb_example.c') diff --git a/examples/aes128cfb_example.c b/examples/aes128cfb_example.c index c466c11..9d63a9a 100644 --- a/examples/aes128cfb_example.c +++ b/examples/aes128cfb_example.c @@ -12,7 +12,7 @@ int main() { - __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv; + __declspec(align(16)) AesBlock128 plain, key, cypher, decrypted, iv, next_iv; __declspec(align(16)) Aes128KeySchedule key_schedule; plain = make_aes_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100); @@ -37,15 +37,23 @@ int main() for (int i = 0; i < 11; ++i) printf("\t[%d]: %s\n", i, format_aes_block128(&key_schedule.keys[i]).str); - cypher = aes128cfb_encrypt(plain, &key_schedule, iv); + cypher = aes128cfb_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); - decrypted = aes128cfb_decrypt(cypher, &key_schedule, iv); + printf("\n"); + printf("Next initialization vector: %s\n", format_aes_block128(&next_iv).str); + print_aes_block128_fips_matrix_style(&next_iv); + + decrypted = aes128cfb_decrypt(cypher, &key_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; } -- cgit v1.2.3