diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-17 21:09:42 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-17 21:09:42 +0300 |
commit | 8430473494fcdbf39e02fcff80d51124df728e97 (patch) | |
tree | ba2a30c419e2d2e9fdd05ff697d98e24f1ef1876 /test | |
parent | factoring out AES-specific stuff (diff) | |
download | aes-tools-8430473494fcdbf39e02fcff80d51124df728e97.tar.gz aes-tools-8430473494fcdbf39e02fcff80d51124df728e97.zip |
refactoring
Diffstat (limited to 'test')
30 files changed, 186 insertions, 186 deletions
diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c index 73586eb..b286e64 100644 --- a/test/aes128cbc_decrypt_block.c +++ b/test/aes128cbc_decrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule, inverted_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); @@ -40,21 +40,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); - aesni_aes128_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes128_decrypt_block_cbc(cipher, &inverted_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c index dfdd7d3..15348de 100644 --- a/test/aes128cbc_encrypt_block.c +++ b/test/aes128cbc_encrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,20 +40,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes128_encrypt_block_cbc(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes128cfb_decrypt_block.c b/test/aes128cfb_decrypt_block.c index a78f276..a6d4f72 100644 --- a/test/aes128cfb_decrypt_block.c +++ b/test/aes128cfb_decrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,20 +40,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes128_decrypt_block_cfb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes128cfb_encrypt_block.c b/test/aes128cfb_encrypt_block.c index 576a2ed..e238048 100644 --- a/test/aes128cfb_encrypt_block.c +++ b/test/aes128cfb_encrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,20 +40,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes128_encrypt_block_cfb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes128ctr_decrypt_block.c b/test/aes128ctr_decrypt_block.c index 940d2f4..a9ed568 100644 --- a/test/aes128ctr_decrypt_block.c +++ b/test/aes128ctr_decrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,7 +40,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); int ctr = 0; @@ -49,13 +49,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes128_decrypt_block_ctr(cipher, &key_schedule, iv, ctr++); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes128ctr_encrypt_block.c b/test/aes128ctr_encrypt_block.c index 32dd216..1541274 100644 --- a/test/aes128ctr_encrypt_block.c +++ b/test/aes128ctr_encrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,7 +40,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); int ctr = 0; @@ -49,13 +49,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes128_encrypt_block_ctr(plain, &key_schedule, iv, ctr++); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c index 5885fb9..809ed67 100644 --- a/test/aes128ecb_decrypt_block.c +++ b/test/aes128ecb_decrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher; - AesNI_Aes128_RoundKeys key_schedule, inverted_schedule; + AesNI_Block128 plaintext, key, ciphertext; + AesNI_Aes128_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); @@ -34,21 +34,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); - aesni_aes128_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes128_decrypt_block_ecb(cipher, &inverted_schedule); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_keys); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c index 040d47d..1c73e90 100644 --- a/test/aes128ecb_encrypt_block.c +++ b/test/aes128ecb_encrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); @@ -34,20 +34,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes128_encrypt_block_ecb(plain, &key_schedule); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_keys); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes128ofb_decrypt_block.c b/test/aes128ofb_decrypt_block.c index 16f148d..e230451 100644 --- a/test/aes128ofb_decrypt_block.c +++ b/test/aes128ofb_decrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,20 +40,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes128_decrypt_block_ofb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes128ofb_encrypt_block.c b/test/aes128ofb_encrypt_block.c index 4532cc8..3911cf7 100644 --- a/test/aes128ofb_encrypt_block.c +++ b/test/aes128ofb_encrypt_block.c @@ -22,8 +22,8 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, key, cipher, iv; - AesNI_Aes128_RoundKeys key_schedule; + AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -40,20 +40,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes128_expand_key(key, &key_schedule); + aesni_aes128_expand_key(key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes128_encrypt_block_ofb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c index 9d5e1d6..fc72cf2 100644 --- a/test/aes192cbc_decrypt_block.c +++ b/test/aes192cbc_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule, inverted_schedule; + AesNI_Aes192_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); @@ -41,21 +41,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); - aesni_aes192_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); + aesni_aes192_derive_decryption_keys(&encryption_keys, &decryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes192_decrypt_block_cbc(cipher, &inverted_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c index d562ae5..8df44e2 100644 --- a/test/aes192cbc_encrypt_block.c +++ b/test/aes192cbc_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes192_encrypt_block_cbc(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes192cfb_decrypt_block.c b/test/aes192cfb_decrypt_block.c index b5703d1..8143972 100644 --- a/test/aes192cfb_decrypt_block.c +++ b/test/aes192cfb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes192_decrypt_block_cfb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes192cfb_encrypt_block.c b/test/aes192cfb_encrypt_block.c index a23aa72..40214d8 100644 --- a/test/aes192cfb_encrypt_block.c +++ b/test/aes192cfb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes192_encrypt_block_cfb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes192ctr_decrypt_block.c b/test/aes192ctr_decrypt_block.c index 14e91d9..2f88bcd 100644 --- a/test/aes192ctr_decrypt_block.c +++ b/test/aes192ctr_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,7 +41,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); int ctr = 0; @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes192_decrypt_block_ctr(cipher, &key_schedule, iv, ctr++); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes192ctr_encrypt_block.c b/test/aes192ctr_encrypt_block.c index e613d87..3052ea3 100644 --- a/test/aes192ctr_encrypt_block.c +++ b/test/aes192ctr_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,7 +41,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); int ctr = 0; @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes192_encrypt_block_ctr(plain, &key_schedule, iv, ctr++); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c index 39689e9..70c19f4 100644 --- a/test/aes192ecb_decrypt_block.c +++ b/test/aes192ecb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher; + AesNI_Block128 plaintext, ciphertext; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule, inverted_schedule; + AesNI_Aes192_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); @@ -35,21 +35,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); - aesni_aes192_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); + aesni_aes192_derive_decryption_keys(&encryption_keys, &decryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes192_decrypt_block_ecb(cipher, &inverted_schedule); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_keys); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c index 167ffd4..b8eb7b2 100644 --- a/test/aes192ecb_encrypt_block.c +++ b/test/aes192ecb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher; + AesNI_Block128 plaintext, ciphertext; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); @@ -35,20 +35,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes192_encrypt_block_ecb(plain, &key_schedule); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_keys); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes192ofb_decrypt_block.c b/test/aes192ofb_decrypt_block.c index 4dd5fbb..6e1adcb 100644 --- a/test/aes192ofb_decrypt_block.c +++ b/test/aes192ofb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes192_decrypt_block_ofb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes192ofb_encrypt_block.c b/test/aes192ofb_encrypt_block.c index 2a45b79..0ece731 100644 --- a/test/aes192ofb_encrypt_block.c +++ b/test/aes192ofb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block192 key; - AesNI_Aes192_RoundKeys key_schedule; + AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes192_expand_key(&key, &key_schedule); + aesni_aes192_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes192_encrypt_block_ofb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c index 7cfd85a..c65d5e5 100644 --- a/test/aes256cbc_decrypt_block.c +++ b/test/aes256cbc_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule, inverted_schedule; + AesNI_Aes256_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); @@ -41,21 +41,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); - aesni_aes256_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); + aesni_aes256_derive_decryption_keys(&encryption_keys, &decryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes256_decrypt_block_cbc(cipher, &inverted_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c index 9c0c24b..76c3b4e 100644 --- a/test/aes256cbc_encrypt_block.c +++ b/test/aes256cbc_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes256_encrypt_block_cbc(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes256cfb_decrypt_block.c b/test/aes256cfb_decrypt_block.c index 3f8f696..7c356a6 100644 --- a/test/aes256cfb_decrypt_block.c +++ b/test/aes256cfb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes256_decrypt_block_cfb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes256cfb_encrypt_block.c b/test/aes256cfb_encrypt_block.c index aca05a8..7d95658 100644 --- a/test/aes256cfb_encrypt_block.c +++ b/test/aes256cfb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes256_encrypt_block_cfb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes256ctr_decrypt_block.c b/test/aes256ctr_decrypt_block.c index 8255a11..71f9854 100644 --- a/test/aes256ctr_decrypt_block.c +++ b/test/aes256ctr_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,7 +41,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); int ctr = 0; @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes256_decrypt_block_ctr(cipher, &key_schedule, iv, ctr++); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes256ctr_encrypt_block.c b/test/aes256ctr_encrypt_block.c index 580c6e7..c0452f1 100644 --- a/test/aes256ctr_encrypt_block.c +++ b/test/aes256ctr_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,7 +41,7 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); int ctr = 0; @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes256_encrypt_block_ctr(plain, &key_schedule, iv, ctr++); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c index f4b38c5..c1f84b9 100644 --- a/test/aes256ecb_decrypt_block.c +++ b/test/aes256ecb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher; + AesNI_Block128 plaintext, ciphertext; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule, inverted_schedule; + AesNI_Aes256_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); @@ -35,21 +35,21 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); - aesni_aes256_derive_decryption_keys(&key_schedule, &inverted_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); + aesni_aes256_derive_decryption_keys(&encryption_keys, &decryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes256_decrypt_block_ecb(cipher, &inverted_schedule); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_keys); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c index 7752383..f12f1a2 100644 --- a/test/aes256ecb_encrypt_block.c +++ b/test/aes256ecb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher; + AesNI_Block128 plaintext, ciphertext; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); @@ -35,20 +35,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes256_encrypt_block_ecb(plain, &key_schedule); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_keys); + aesni_print_block128(&ciphertext, NULL); } } diff --git a/test/aes256ofb_decrypt_block.c b/test/aes256ofb_decrypt_block.c index b1c533d..dfd29bc 100644 --- a/test/aes256ofb_decrypt_block.c +++ b/test/aes256ofb_decrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&cipher, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - plain = aesni_aes256_decrypt_block_ofb(cipher, &key_schedule, iv, &iv); - aesni_print_block128(&plain, NULL); + plaintext = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); + aesni_print_block128(&plaintext, NULL); } } diff --git a/test/aes256ofb_encrypt_block.c b/test/aes256ofb_encrypt_block.c index 975a653..7d65671 100644 --- a/test/aes256ofb_encrypt_block.c +++ b/test/aes256ofb_encrypt_block.c @@ -22,9 +22,9 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plain, cipher, iv; + AesNI_Block128 plaintext, ciphertext, iv; AesNI_Block256 key; - AesNI_Aes256_RoundKeys key_schedule; + AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); @@ -41,20 +41,20 @@ int main(int argc, char** argv) exit_with_usage(); } - aesni_aes256_expand_key(&key, &key_schedule); + aesni_aes256_expand_key(&key, &encryption_keys); for (argc -= 2, argv += 2; argc > 0; --argc, ++argv) { if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plain, *argv, NULL))) + if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } - cipher = aesni_aes256_encrypt_block_ofb(plain, &key_schedule, iv, &iv); - aesni_print_block128(&cipher, NULL); + ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); + aesni_print_block128(&ciphertext, NULL); } } |