aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--test/aes128cbc_decrypt_block.c27
-rw-r--r--test/aes128cbc_encrypt_block.c27
-rw-r--r--test/aes128cfb_decrypt_block.c27
-rw-r--r--test/aes128cfb_encrypt_block.c27
-rw-r--r--test/aes128ctr_decrypt_block.c27
-rw-r--r--test/aes128ctr_encrypt_block.c27
-rw-r--r--test/aes128ecb_decrypt_block.c23
-rw-r--r--test/aes128ecb_encrypt_block.c23
-rw-r--r--test/aes128ofb_decrypt_block.c27
-rw-r--r--test/aes128ofb_encrypt_block.c27
-rw-r--r--test/aes192cbc_decrypt_block.c27
-rw-r--r--test/aes192cbc_encrypt_block.c27
-rw-r--r--test/aes192cfb_decrypt_block.c27
-rw-r--r--test/aes192cfb_encrypt_block.c27
-rw-r--r--test/aes192ctr_decrypt_block.c27
-rw-r--r--test/aes192ctr_encrypt_block.c27
-rw-r--r--test/aes192ecb_decrypt_block.c23
-rw-r--r--test/aes192ecb_encrypt_block.c23
-rw-r--r--test/aes192ofb_decrypt_block.c27
-rw-r--r--test/aes192ofb_encrypt_block.c27
-rw-r--r--test/aes256cbc_decrypt_block.c27
-rw-r--r--test/aes256cbc_encrypt_block.c27
-rw-r--r--test/aes256cfb_decrypt_block.c27
-rw-r--r--test/aes256cfb_encrypt_block.c27
-rw-r--r--test/aes256ctr_decrypt_block.c27
-rw-r--r--test/aes256ctr_encrypt_block.c27
-rw-r--r--test/aes256ecb_decrypt_block.c23
-rw-r--r--test/aes256ecb_encrypt_block.c23
-rw-r--r--test/aes256ofb_decrypt_block.c27
-rw-r--r--test/aes256ofb_encrypt_block.c27
30 files changed, 588 insertions, 198 deletions
diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c
index 763285c..95120e7 100644
--- a/test/aes128cbc_decrypt_block.c
+++ b/test/aes128cbc_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -49,13 +56,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes128_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c
index c9c719d..68f95a3 100644
--- a/test/aes128cbc_encrypt_block.c
+++ b/test/aes128cbc_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes128_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128cfb_decrypt_block.c b/test/aes128cfb_decrypt_block.c
index 2a27056..ef68e44 100644
--- a/test/aes128cfb_decrypt_block.c
+++ b/test/aes128cfb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes128_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128cfb_encrypt_block.c b/test/aes128cfb_encrypt_block.c
index 4c06f9c..6f8fb4d 100644
--- a/test/aes128cfb_encrypt_block.c
+++ b/test/aes128cfb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes128_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ctr_decrypt_block.c b/test/aes128ctr_decrypt_block.c
index e7513b5..85d07f5 100644
--- a/test/aes128ctr_decrypt_block.c
+++ b/test/aes128ctr_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes128_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ctr_encrypt_block.c b/test/aes128ctr_encrypt_block.c
index cbcdbe4..a62f3cd 100644
--- a/test/aes128ctr_encrypt_block.c
+++ b/test/aes128ctr_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes128_encrypt_block_ctr(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c
index c545943..9fbf26d 100644
--- a/test/aes128ecb_decrypt_block.c
+++ b/test/aes128ecb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -43,13 +50,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes128_decrypt_block_ecb(ciphertext, &decryption_keys);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c
index 17bcce1..45a1123 100644
--- a/test/aes128ecb_encrypt_block.c
+++ b/test/aes128ecb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -42,13 +49,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes128_encrypt_block_ecb(plaintext, &encryption_keys);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ofb_decrypt_block.c b/test/aes128ofb_decrypt_block.c
index 06e88a4..e61e70f 100644
--- a/test/aes128ofb_decrypt_block.c
+++ b/test/aes128ofb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes128_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes128ofb_encrypt_block.c b/test/aes128ofb_encrypt_block.c
index e8d7759..6613ca9 100644
--- a/test/aes128ofb_encrypt_block.c
+++ b/test/aes128ofb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes128_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes128_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes128_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c
index d305a10..13edbe4 100644
--- a/test/aes192cbc_decrypt_block.c
+++ b/test/aes192cbc_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -49,13 +56,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes192_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c
index 41b2f2b..d89c12d 100644
--- a/test/aes192cbc_encrypt_block.c
+++ b/test/aes192cbc_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes192_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192cfb_decrypt_block.c b/test/aes192cfb_decrypt_block.c
index 8e282ba..cedc7d0 100644
--- a/test/aes192cfb_decrypt_block.c
+++ b/test/aes192cfb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes192_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192cfb_encrypt_block.c b/test/aes192cfb_encrypt_block.c
index f2d0dcc..357df8d 100644
--- a/test/aes192cfb_encrypt_block.c
+++ b/test/aes192cfb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes192_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ctr_decrypt_block.c b/test/aes192ctr_decrypt_block.c
index 3e4ed94..b094964 100644
--- a/test/aes192ctr_decrypt_block.c
+++ b/test/aes192ctr_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes192_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ctr_encrypt_block.c b/test/aes192ctr_encrypt_block.c
index 12778ea..977c7bf 100644
--- a/test/aes192ctr_encrypt_block.c
+++ b/test/aes192ctr_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes192_encrypt_block_ctr(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c
index bbaaf47..29e7274 100644
--- a/test/aes192ecb_decrypt_block.c
+++ b/test/aes192ecb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -43,13 +50,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes192_decrypt_block_ecb(ciphertext, &decryption_keys);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c
index 87241df..a74759c 100644
--- a/test/aes192ecb_encrypt_block.c
+++ b/test/aes192ecb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -42,13 +49,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes192_encrypt_block_ecb(plaintext, &encryption_keys);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ofb_decrypt_block.c b/test/aes192ofb_decrypt_block.c
index b202e41..eaa9d2a 100644
--- a/test/aes192ofb_decrypt_block.c
+++ b/test/aes192ofb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes192_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes192ofb_encrypt_block.c b/test/aes192ofb_encrypt_block.c
index 4416be8..fed0c5a 100644
--- a/test/aes192ofb_encrypt_block.c
+++ b/test/aes192ofb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes192_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes192_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 192-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes192_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c
index 8a2cbe1..0021007 100644
--- a/test/aes256cbc_decrypt_block.c
+++ b/test/aes256cbc_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -49,13 +56,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes256_decrypt_block_cbc(ciphertext, &decryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c
index d99c203..e01ab95 100644
--- a/test/aes256cbc_encrypt_block.c
+++ b/test/aes256cbc_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes256_encrypt_block_cbc(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256cfb_decrypt_block.c b/test/aes256cfb_decrypt_block.c
index bdaf1dd..9d320a5 100644
--- a/test/aes256cfb_decrypt_block.c
+++ b/test/aes256cfb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes256_decrypt_block_cfb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256cfb_encrypt_block.c b/test/aes256cfb_encrypt_block.c
index a31effc..94e8619 100644
--- a/test/aes256cfb_encrypt_block.c
+++ b/test/aes256cfb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes256_encrypt_block_cfb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ctr_decrypt_block.c b/test/aes256ctr_decrypt_block.c
index 2a1fc8f..a0f9ef0 100644
--- a/test/aes256ctr_decrypt_block.c
+++ b/test/aes256ctr_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes256_decrypt_block_ctr(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ctr_encrypt_block.c b/test/aes256ctr_encrypt_block.c
index 6ca8e2f..fbae884 100644
--- a/test/aes256ctr_encrypt_block.c
+++ b/test/aes256ctr_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes256_encrypt_block_ctr(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c
index 8439044..16ffe77 100644
--- a/test/aes256ecb_decrypt_block.c
+++ b/test/aes256ecb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -43,13 +50,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes256_decrypt_block_ecb(ciphertext, &decryption_keys);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c
index a8da243..01ae7ed 100644
--- a/test/aes256ecb_encrypt_block.c
+++ b/test/aes256ecb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext;
@@ -29,9 +36,9 @@ int main(int argc, char** argv)
if (argc < 1)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
@@ -42,13 +49,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes256_encrypt_block_ecb(plaintext, &encryption_keys);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ofb_decrypt_block.c b/test/aes256ofb_decrypt_block.c
index 9d4cc36..a57c8db 100644
--- a/test/aes256ofb_decrypt_block.c
+++ b/test/aes256ofb_decrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&ciphertext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&ciphertext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
plaintext = aesni_aes256_decrypt_block_ofb(ciphertext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&plaintext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&plaintext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}
diff --git a/test/aes256ofb_encrypt_block.c b/test/aes256ofb_encrypt_block.c
index 0018e9a..7dc01b8 100644
--- a/test/aes256ofb_encrypt_block.c
+++ b/test/aes256ofb_encrypt_block.c
@@ -18,8 +18,15 @@ static void exit_with_usage()
exit(EXIT_FAILURE);
}
+static void print_error(AesNI_StatusCode status)
+{
+ fprintf(stderr, "AesNI error: %s\n", aesni_strerror(status));
+}
+
int main(int argc, char** argv)
{
+ AesNI_StatusCode status = AESNI_SUCCESS;
+
for (--argc, ++argv; argc > -1; --argc, ++argv)
{
AesNI_Block128 plaintext, ciphertext, iv;
@@ -29,15 +36,15 @@ int main(int argc, char** argv)
if (argc < 2)
exit_with_usage();
- if (aesni_is_error(aesni_aes256_parse_key(&key, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes256_parse_key(&key, *argv, NULL)))
{
- fprintf(stderr, "Invalid 256-bit AES block '%s'\n", *argv);
+ print_error(status);
exit_with_usage();
}
- if (aesni_is_error(aesni_aes_parse_block(&iv, argv[1], NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&iv, argv[1], NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", argv[1]);
+ print_error(status);
exit_with_usage();
}
@@ -48,13 +55,19 @@ int main(int argc, char** argv)
if (strcmp("--", *argv) == 0)
break;
- if (aesni_is_error(aesni_aes_parse_block(&plaintext, *argv, NULL)))
+ if (aesni_is_error(status = aesni_aes_parse_block(&plaintext, *argv, NULL)))
{
- fprintf(stderr, "Invalid 128-bit AES block '%s'\n", *argv);
+ print_error(status);
continue;
}
+
ciphertext = aesni_aes256_encrypt_block_ofb(plaintext, &encryption_keys, iv, &iv);
- aesni_aes_print_block(&ciphertext, NULL);
+
+ if (aesni_is_error(status = aesni_aes_print_block(&ciphertext, NULL)))
+ {
+ print_error(status);
+ continue;
+ }
}
}