aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/aes128cbc_decrypt_block.c6
-rw-r--r--test/aes128cbc_encrypt_block.c5
-rw-r--r--test/aes128ecb_decrypt_block.c6
-rw-r--r--test/aes128ecb_encrypt_block.c5
-rw-r--r--test/aes192cbc_decrypt_block.c6
-rw-r--r--test/aes192cbc_encrypt_block.c5
-rw-r--r--test/aes192ecb_decrypt_block.c6
-rw-r--r--test/aes192ecb_encrypt_block.c5
-rw-r--r--test/aes256cbc_decrypt_block.c6
-rw-r--r--test/aes256cbc_encrypt_block.c5
-rw-r--r--test/aes256ecb_decrypt_block.c6
-rw-r--r--test/aes256ecb_encrypt_block.c5
12 files changed, 54 insertions, 12 deletions
diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c
index 1a77cdf..3bd5d74 100644
--- a/test/aes128cbc_decrypt_block.c
+++ b/test/aes128cbc_decrypt_block.c
@@ -20,6 +20,7 @@ static void exit_with_usage(const char* argv0)
int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, key, cipher, iv;
+ __declspec(align(16)) Aes128KeySchedule key_schedule, inverted_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -36,6 +37,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes128_expand_key_schedule(key, &key_schedule);
+ aes128_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -43,7 +47,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes128cbc_decrypt(cipher, key, &iv);
+ plain = aes128cbc_decrypt(cipher, &inverted_schedule, &iv);
print_aes_block128(&plain);
}
diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c
index 31bb479..e35a1bf 100644
--- a/test/aes128cbc_encrypt_block.c
+++ b/test/aes128cbc_encrypt_block.c
@@ -20,6 +20,7 @@ static void exit_with_usage(const char* argv0)
int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, key, cipher, iv;
+ __declspec(align(16)) Aes128KeySchedule key_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -36,6 +37,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes128_expand_key_schedule(key, &key_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -43,7 +46,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes128cbc_encrypt(plain, key, &iv);
+ cipher = aes128cbc_encrypt(plain, &key_schedule, &iv);
print_aes_block128(&cipher);
}
diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c
index 188524b..70c7285 100644
--- a/test/aes128ecb_decrypt_block.c
+++ b/test/aes128ecb_decrypt_block.c
@@ -20,6 +20,7 @@ static void exit_with_usage(const char* argv0)
int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, key, cipher;
+ __declspec(align(16)) Aes128KeySchedule key_schedule, inverted_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -30,6 +31,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes128_expand_key_schedule(key, &key_schedule);
+ aes128_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -37,7 +41,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes128ecb_decrypt(cipher, key);
+ plain = aes128ecb_decrypt(cipher, &inverted_schedule);
print_aes_block128(&plain);
}
diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c
index 27c7a0e..8f0bf0a 100644
--- a/test/aes128ecb_encrypt_block.c
+++ b/test/aes128ecb_encrypt_block.c
@@ -20,6 +20,7 @@ static void exit_with_usage(const char* argv0)
int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, key, cipher;
+ __declspec(align(16)) Aes128KeySchedule key_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -30,6 +31,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes128_expand_key_schedule(key, &key_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -37,7 +40,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes128ecb_encrypt(plain, key);
+ cipher = aes128ecb_encrypt(plain, &key_schedule);
print_aes_block128(&cipher);
}
diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c
index 0fddf43..3d912ba 100644
--- a/test/aes192cbc_decrypt_block.c
+++ b/test/aes192cbc_decrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher, iv;
__declspec(align(16)) AesBlock192 key;
+ __declspec(align(16)) Aes192KeySchedule key_schedule, inverted_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -37,6 +38,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes192_expand_key_schedule(&key, &key_schedule);
+ aes192_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -44,7 +48,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes192cbc_decrypt(cipher, &key, &iv);
+ plain = aes192cbc_decrypt(cipher, &inverted_schedule, &iv);
print_aes_block128(&plain);
}
diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c
index 069c408..21765f5 100644
--- a/test/aes192cbc_encrypt_block.c
+++ b/test/aes192cbc_encrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher, iv;
__declspec(align(16)) AesBlock192 key;
+ __declspec(align(16)) Aes192KeySchedule key_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -37,6 +38,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes192_expand_key_schedule(&key, &key_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -44,7 +47,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes192cbc_encrypt(plain, &key, &iv);
+ cipher = aes192cbc_encrypt(plain, &key_schedule, &iv);
print_aes_block128(&cipher);
}
diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c
index 73827a2..e6e749a 100644
--- a/test/aes192ecb_decrypt_block.c
+++ b/test/aes192ecb_decrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher;
__declspec(align(16)) AesBlock192 key;
+ __declspec(align(16)) Aes192KeySchedule key_schedule, inverted_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -31,6 +32,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes192_expand_key_schedule(&key, &key_schedule);
+ aes192_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -38,7 +42,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes192ecb_decrypt(cipher, &key);
+ plain = aes192ecb_decrypt(cipher, &inverted_schedule);
print_aes_block128(&plain);
}
diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c
index 9f2db50..2b4f688 100644
--- a/test/aes192ecb_encrypt_block.c
+++ b/test/aes192ecb_encrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher;
__declspec(align(16)) AesBlock192 key;
+ __declspec(align(16)) Aes192KeySchedule key_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -31,6 +32,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes192_expand_key_schedule(&key, &key_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -38,7 +41,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes192ecb_encrypt(plain, &key);
+ cipher = aes192ecb_encrypt(plain, &key_schedule);
print_aes_block128(&cipher);
}
diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c
index bac98e3..bb082d5 100644
--- a/test/aes256cbc_decrypt_block.c
+++ b/test/aes256cbc_decrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher, iv;
__declspec(align(16)) AesBlock256 key;
+ __declspec(align(16)) Aes256KeySchedule key_schedule, inverted_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -37,6 +38,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes256_expand_key_schedule(&key, &key_schedule);
+ aes256_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -44,7 +48,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes256cbc_decrypt(cipher, &key, &iv);
+ plain = aes256cbc_decrypt(cipher, &inverted_schedule, &iv);
print_aes_block128(&plain);
}
diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c
index 08ca11b..1436020 100644
--- a/test/aes256cbc_encrypt_block.c
+++ b/test/aes256cbc_encrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher, iv;
__declspec(align(16)) AesBlock256 key;
+ __declspec(align(16)) Aes256KeySchedule key_schedule;
if (argc < 3)
exit_with_usage(argv[0]);
@@ -37,6 +38,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes256_expand_key_schedule(&key, &key_schedule);
+
for (int i = 3; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -44,7 +47,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes256cbc_encrypt(plain, &key, &iv);
+ cipher = aes256cbc_encrypt(plain, &key_schedule, &iv);
print_aes_block128(&cipher);
}
diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c
index f3126fe..a290eed 100644
--- a/test/aes256ecb_decrypt_block.c
+++ b/test/aes256ecb_decrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher;
__declspec(align(16)) AesBlock256 key;
+ __declspec(align(16)) Aes256KeySchedule key_schedule, inverted_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -31,6 +32,9 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes256_expand_key_schedule(&key, &key_schedule);
+ aes256_invert_key_schedule(&key_schedule, &inverted_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&cipher, argv[i]) != 0)
@@ -38,7 +42,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- plain = aes256ecb_decrypt(cipher, &key);
+ plain = aes256ecb_decrypt(cipher, &inverted_schedule);
print_aes_block128(&plain);
}
diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c
index 3fb979d..2a4899e 100644
--- a/test/aes256ecb_encrypt_block.c
+++ b/test/aes256ecb_encrypt_block.c
@@ -21,6 +21,7 @@ int main(int argc, char** argv)
{
__declspec(align(16)) AesBlock128 plain, cipher;
__declspec(align(16)) AesBlock256 key;
+ __declspec(align(16)) Aes256KeySchedule key_schedule;
if (argc < 2)
exit_with_usage(argv[0]);
@@ -31,6 +32,8 @@ int main(int argc, char** argv)
exit_with_usage(argv[0]);
}
+ aes256_expand_key_schedule(&key, &key_schedule);
+
for (int i = 2; i < argc; ++i)
{
if (parse_aes_block128(&plain, argv[i]) != 0)
@@ -38,7 +41,7 @@ int main(int argc, char** argv)
fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[i]);
continue;
}
- cipher = aes256ecb_encrypt(plain, &key);
+ cipher = aes256ecb_encrypt(plain, &key_schedule);
print_aes_block128(&cipher);
}