diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-17 23:25:52 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-06-17 23:25:52 +0300 |
commit | 44d58e0a10c7dfdb33899fa98c0eea790e0b90ce (patch) | |
tree | 646541b156ffdd88bbaa4f1fa860aed465dfce60 /test | |
parent | refactoring (diff) | |
download | aes-tools-44d58e0a10c7dfdb33899fa98c0eea790e0b90ce.tar.gz aes-tools-44d58e0a10c7dfdb33899fa98c0eea790e0b90ce.zip |
factoring out AES-specific stuff
Diffstat (limited to '')
32 files changed, 172 insertions, 162 deletions
diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c index b286e64..ce05e1d 100644 --- a/test/aes128cbc_decrypt_block.c +++ b/test/aes128cbc_decrypt_block.c @@ -22,25 +22,26 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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) @@ -48,13 +49,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c index 15348de..d51a673 100644 --- a/test/aes128cbc_encrypt_block.c +++ b/test/aes128cbc_encrypt_block.c @@ -22,38 +22,39 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes128cfb_decrypt_block.c b/test/aes128cfb_decrypt_block.c index a6d4f72..636e2d9 100644 --- a/test/aes128cfb_decrypt_block.c +++ b/test/aes128cfb_decrypt_block.c @@ -22,38 +22,39 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes128cfb_encrypt_block.c b/test/aes128cfb_encrypt_block.c index e238048..fd64dc6 100644 --- a/test/aes128cfb_encrypt_block.c +++ b/test/aes128cfb_encrypt_block.c @@ -22,38 +22,39 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes128ctr_decrypt_block.c b/test/aes128ctr_decrypt_block.c index a9ed568..4e7e5b0 100644 --- a/test/aes128ctr_decrypt_block.c +++ b/test/aes128ctr_decrypt_block.c @@ -22,25 +22,26 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_expand_key(&key, &encryption_keys); int ctr = 0; @@ -49,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes128ctr_encrypt_block.c b/test/aes128ctr_encrypt_block.c index 1541274..ad2e036 100644 --- a/test/aes128ctr_encrypt_block.c +++ b/test/aes128ctr_encrypt_block.c @@ -22,25 +22,26 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_expand_key(&key, &encryption_keys); int ctr = 0; @@ -49,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c index 809ed67..d68505d 100644 --- a/test/aes128ecb_decrypt_block.c +++ b/test/aes128ecb_decrypt_block.c @@ -22,19 +22,20 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext; + AesNI_Block128 plaintext, ciphertext; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + aesni_aes128_expand_key(&key, &encryption_keys); aesni_aes128_derive_decryption_keys(&encryption_keys, &decryption_keys); for (--argc, ++argv; argc > 0; --argc, ++argv) @@ -42,13 +43,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_keys); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c index 1c73e90..77bb557 100644 --- a/test/aes128ecb_encrypt_block.c +++ b/test/aes128ecb_encrypt_block.c @@ -22,32 +22,33 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext; + AesNI_Block128 plaintext, ciphertext; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_keys); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes128ofb_decrypt_block.c b/test/aes128ofb_decrypt_block.c index e230451..10e865e 100644 --- a/test/aes128ofb_decrypt_block.c +++ b/test/aes128ofb_decrypt_block.c @@ -22,38 +22,39 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes128ofb_encrypt_block.c b/test/aes128ofb_encrypt_block.c index 3911cf7..7bf3b00 100644 --- a/test/aes128ofb_encrypt_block.c +++ b/test/aes128ofb_encrypt_block.c @@ -22,38 +22,39 @@ int main(int argc, char** argv) { for (--argc, ++argv; argc > -1; --argc, ++argv) { - AesNI_Block128 plaintext, key, ciphertext, iv; + AesNI_Block128 plaintext, ciphertext, iv; + AesNI_Aes128_Key key; AesNI_Aes128_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block128(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); } - aesni_aes128_expand_key(key, &encryption_keys); + 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(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c index fc72cf2..0cbef38 100644 --- a/test/aes192cbc_decrypt_block.c +++ b/test/aes192cbc_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -49,13 +49,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c index 8df44e2..c7df499 100644 --- a/test/aes192cbc_encrypt_block.c +++ b/test/aes192cbc_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes192cfb_decrypt_block.c b/test/aes192cfb_decrypt_block.c index 8143972..1ede253 100644 --- a/test/aes192cfb_decrypt_block.c +++ b/test/aes192cfb_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes192cfb_encrypt_block.c b/test/aes192cfb_encrypt_block.c index 40214d8..7c98132 100644 --- a/test/aes192cfb_encrypt_block.c +++ b/test/aes192cfb_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes192ctr_decrypt_block.c b/test/aes192ctr_decrypt_block.c index 2f88bcd..16bd35b 100644 --- a/test/aes192ctr_decrypt_block.c +++ b/test/aes192ctr_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes192ctr_encrypt_block.c b/test/aes192ctr_encrypt_block.c index 3052ea3..d390f52 100644 --- a/test/aes192ctr_encrypt_block.c +++ b/test/aes192ctr_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c index 70c19f4..4200fc4 100644 --- a/test/aes192ecb_decrypt_block.c +++ b/test/aes192ecb_decrypt_block.c @@ -23,13 +23,13 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); exit_with_usage(); @@ -43,13 +43,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_keys); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c index b8eb7b2..2b140e3 100644 --- a/test/aes192ecb_encrypt_block.c +++ b/test/aes192ecb_encrypt_block.c @@ -23,13 +23,13 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); @@ -42,13 +42,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_keys); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes192ofb_decrypt_block.c b/test/aes192ofb_decrypt_block.c index 6e1adcb..5d791ac 100644 --- a/test/aes192ofb_decrypt_block.c +++ b/test/aes192ofb_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes192ofb_encrypt_block.c b/test/aes192ofb_encrypt_block.c index 0ece731..cb2ab85 100644 --- a/test/aes192ofb_encrypt_block.c +++ b/test/aes192ofb_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block192 key; + AesNI_Aes192_Key key; AesNI_Aes192_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block192(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c index c65d5e5..db66bef 100644 --- a/test/aes256cbc_decrypt_block.c +++ b/test/aes256cbc_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys, decryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -49,13 +49,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c index 76c3b4e..69426a4 100644 --- a/test/aes256cbc_encrypt_block.c +++ b/test/aes256cbc_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes256cfb_decrypt_block.c b/test/aes256cfb_decrypt_block.c index 7c356a6..b4a0728 100644 --- a/test/aes256cfb_decrypt_block.c +++ b/test/aes256cfb_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes256cfb_encrypt_block.c b/test/aes256cfb_encrypt_block.c index 7d95658..ab0090f 100644 --- a/test/aes256cfb_encrypt_block.c +++ b/test/aes256cfb_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes256ctr_decrypt_block.c b/test/aes256ctr_decrypt_block.c index 71f9854..9ba7365 100644 --- a/test/aes256ctr_decrypt_block.c +++ b/test/aes256ctr_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, ctr++); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes256ctr_encrypt_block.c b/test/aes256ctr_encrypt_block.c index c0452f1..344decc 100644 --- a/test/aes256ctr_encrypt_block.c +++ b/test/aes256ctr_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -50,13 +50,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, ctr++); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c index c1f84b9..25aa20e 100644 --- a/test/aes256ecb_decrypt_block.c +++ b/test/aes256ecb_decrypt_block.c @@ -23,13 +23,13 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys, decryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); @@ -43,13 +43,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_keys); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c index f12f1a2..b83ff39 100644 --- a/test/aes256ecb_encrypt_block.c +++ b/test/aes256ecb_encrypt_block.c @@ -23,13 +23,13 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 1) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); @@ -42,13 +42,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_keys); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/aes256ofb_decrypt_block.c b/test/aes256ofb_decrypt_block.c index dfd29bc..02d7532 100644 --- a/test/aes256ofb_decrypt_block.c +++ b/test/aes256ofb_decrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&ciphertext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } plaintext = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv); - aesni_print_block128(&plaintext, NULL); + aesni_aes_print_block(&plaintext, NULL); } } diff --git a/test/aes256ofb_encrypt_block.c b/test/aes256ofb_encrypt_block.c index 7d65671..a8434c8 100644 --- a/test/aes256ofb_encrypt_block.c +++ b/test/aes256ofb_encrypt_block.c @@ -23,19 +23,19 @@ int main(int argc, char** argv) for (--argc, ++argv; argc > -1; --argc, ++argv) { AesNI_Block128 plaintext, ciphertext, iv; - AesNI_Block256 key; + AesNI_Aes256_Key key; AesNI_Aes256_RoundKeys encryption_keys; if (argc < 2) exit_with_usage(); - if (aesni_is_error(aesni_parse_block256(&key, *argv, NULL))) + if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL))) { fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv); exit_with_usage(); } - if (aesni_is_error(aesni_parse_block128(&iv, argv[1], NULL))) + if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]); exit_with_usage(); @@ -48,13 +48,13 @@ int main(int argc, char** argv) if (strcmp("--", *argv) == 0) break; - if (aesni_is_error(aesni_parse_block128(&plaintext, *argv, NULL))) + if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL))) { fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv); continue; } ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv); - aesni_print_block128(&ciphertext, NULL); + aesni_aes_print_block(&ciphertext, NULL); } } diff --git a/test/decrypt_block_aes.cpp b/test/decrypt_block_aes.cpp index 6cb9ce7..e0c289a 100644 --- a/test/decrypt_block_aes.cpp +++ b/test/decrypt_block_aes.cpp @@ -35,10 +35,10 @@ int main(int argc, char** argv) exit_with_usage(); AesNI_BoxAlgorithmParams algorithm_params; - aesni::from_string(algorithm_params.aes128_key, argv[0]); + aesni::aes::from_string(algorithm_params.aes128_key, argv[0]); AesNI_BoxBlock iv; - aesni::from_string(iv.aes_block, argv[1]); + aesni::aes::from_string(iv.aes_block, argv[1]); AesNI_Box box; aesni_box_init( @@ -55,7 +55,7 @@ int main(int argc, char** argv) break; AesNI_BoxBlock ciphertext; - aesni::from_string(ciphertext.aes_block, argv[0]); + aesni::aes::from_string(ciphertext.aes_block, argv[0]); AesNI_BoxBlock plaintext; aesni_box_decrypt( @@ -64,7 +64,7 @@ int main(int argc, char** argv) &plaintext, aesni::ErrorDetailsThrowsInDestructor()); - std::cout << plaintext.aes_block << "\n"; + std::cout << aesni::aes::to_string(plaintext.aes_block) << "\n"; } } diff --git a/test/encrypt_block_aes.cpp b/test/encrypt_block_aes.cpp index f15ddda..8be1fef 100644 --- a/test/encrypt_block_aes.cpp +++ b/test/encrypt_block_aes.cpp @@ -35,10 +35,10 @@ int main(int argc, char** argv) exit_with_usage(); AesNI_BoxAlgorithmParams algorithm_params; - aesni::from_string(algorithm_params.aes128_key, argv[0]); + aesni::aes::from_string(algorithm_params.aes128_key, argv[0]); AesNI_BoxBlock iv; - aesni::from_string(iv.aes_block, argv[1]); + aesni::aes::from_string(iv.aes_block, argv[1]); AesNI_Box box; aesni_box_init( @@ -55,7 +55,7 @@ int main(int argc, char** argv) break; AesNI_BoxBlock plaintext; - aesni::from_string(plaintext.aes_block, argv[0]); + aesni::aes::from_string(plaintext.aes_block, argv[0]); AesNI_BoxBlock ciphertext; aesni_box_encrypt( @@ -64,7 +64,7 @@ int main(int argc, char** argv) &ciphertext, aesni::ErrorDetailsThrowsInDestructor()); - std::cout << ciphertext.aes_block << "\n"; + std::cout << aesni::aes::to_string(ciphertext.aes_block) << "\n"; } } |