aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-06-16 13:57:44 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-06-16 13:57:44 +0300
commite625f0aa58f341981ea8cba99660ae7c1eac1b05 (patch)
tree8e7bf55d7a9cf8ddcbed6be3b6402e1b774c29e4
parentutils/cxx/ -> cxx/ (diff)
downloadaes-tools-e625f0aa58f341981ea8cba99660ae7c1eac1b05.tar.gz
aes-tools-e625f0aa58f341981ea8cba99660ae7c1eac1b05.zip
handle block formatting/printing functions errors
Diffstat (limited to '')
-rw-r--r--examples/aes128cbc.c76
-rw-r--r--examples/aes128cfb.c70
-rw-r--r--examples/aes128ctr.c52
-rw-r--r--examples/aes128ecb.c49
-rw-r--r--examples/aes128ofb.c70
-rw-r--r--examples/aes192cbc.c76
-rw-r--r--examples/aes192cfb.c70
-rw-r--r--examples/aes192ctr.c52
-rw-r--r--examples/aes192ecb.c49
-rw-r--r--examples/aes192ofb.c70
-rw-r--r--examples/aes256cbc.c76
-rw-r--r--examples/aes256cfb.c70
-rw-r--r--examples/aes256ctr.c52
-rw-r--r--examples/aes256ecb.c49
-rw-r--r--examples/aes256ofb.c70
-rw-r--r--include/aesni/data.h24
-rw-r--r--src/data.c166
-rw-r--r--test/aes128cbc_decrypt_block.c2
-rw-r--r--test/aes128cbc_encrypt_block.c2
-rw-r--r--test/aes128cfb_decrypt_block.c2
-rw-r--r--test/aes128cfb_encrypt_block.c2
-rw-r--r--test/aes128ctr_decrypt_block.c2
-rw-r--r--test/aes128ctr_encrypt_block.c2
-rw-r--r--test/aes128ecb_decrypt_block.c2
-rw-r--r--test/aes128ecb_encrypt_block.c2
-rw-r--r--test/aes128ofb_decrypt_block.c2
-rw-r--r--test/aes128ofb_encrypt_block.c2
-rw-r--r--test/aes192cbc_decrypt_block.c2
-rw-r--r--test/aes192cbc_encrypt_block.c2
-rw-r--r--test/aes192cfb_decrypt_block.c2
-rw-r--r--test/aes192cfb_encrypt_block.c2
-rw-r--r--test/aes192ctr_decrypt_block.c2
-rw-r--r--test/aes192ctr_encrypt_block.c2
-rw-r--r--test/aes192ecb_decrypt_block.c2
-rw-r--r--test/aes192ecb_encrypt_block.c2
-rw-r--r--test/aes192ofb_decrypt_block.c2
-rw-r--r--test/aes192ofb_encrypt_block.c2
-rw-r--r--test/aes256cbc_decrypt_block.c2
-rw-r--r--test/aes256cbc_encrypt_block.c2
-rw-r--r--test/aes256cfb_decrypt_block.c2
-rw-r--r--test/aes256cfb_encrypt_block.c2
-rw-r--r--test/aes256ctr_decrypt_block.c2
-rw-r--r--test/aes256ctr_encrypt_block.c2
-rw-r--r--test/aes256ecb_decrypt_block.c2
-rw-r--r--test/aes256ecb_encrypt_block.c2
-rw-r--r--test/aes256ofb_decrypt_block.c2
-rw-r--r--test/aes256ofb_encrypt_block.c2
47 files changed, 920 insertions, 281 deletions
diff --git a/examples/aes128cbc.c b/examples/aes128cbc.c
index b2eb14a..5d828a3 100644
--- a/examples/aes128cbc.c
+++ b/examples/aes128cbc.c
@@ -19,48 +19,92 @@ int main()
key = aesni_make_block128(0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block128(&key).str);
- aesni_print_block128_as_matrix(&key);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block128_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule128(key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cbc128(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
aesni_invert_key_schedule128(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_cbc128(cipher, &inverted_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes128cfb.c b/examples/aes128cfb.c
index 31ad748..06c77b3 100644
--- a/examples/aes128cfb.c
+++ b/examples/aes128cfb.c
@@ -19,41 +19,81 @@ int main()
key = aesni_make_block128(0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block128(&key).str);
- aesni_print_block128_as_matrix(&key);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block128_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule128(key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cfb128(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_cfb128(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes128ctr.c b/examples/aes128ctr.c
index 1efe4e2..a9bcda6 100644
--- a/examples/aes128ctr.c
+++ b/examples/aes128ctr.c
@@ -19,33 +19,63 @@ int main()
key = aesni_make_block128(0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block128(&key).str);
- aesni_print_block128_as_matrix(&key);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block128_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule128(key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ctr128(plain, &key_schedule, iv, 0);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
decrypted = aesni_decrypt_block_ctr128(cipher, &key_schedule, iv, 0);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes128ecb.c b/examples/aes128ecb.c
index 4f999d4..6c98f32 100644
--- a/examples/aes128ecb.c
+++ b/examples/aes128ecb.c
@@ -18,36 +18,65 @@ int main()
plain = aesni_make_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100);
key = aesni_make_block128(0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block128(&key).str);
- aesni_print_block128_as_matrix(&key);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block128_as_matrix(&key, NULL);
+ }
aesni_expand_key_schedule128(key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ecb128(plain, &key_schedule);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
aesni_invert_key_schedule128(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_ecb128(cipher, &inverted_schedule);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes128ofb.c b/examples/aes128ofb.c
index 49a97ed..541ec41 100644
--- a/examples/aes128ofb.c
+++ b/examples/aes128ofb.c
@@ -19,41 +19,81 @@ int main()
key = aesni_make_block128(0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block128(&key).str);
- aesni_print_block128_as_matrix(&key);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block128_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule128(key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 11; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ofb128(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_ofb128(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes192cbc.c b/examples/aes192cbc.c
index 67adf95..c17ec0f 100644
--- a/examples/aes192cbc.c
+++ b/examples/aes192cbc.c
@@ -20,48 +20,92 @@ int main()
key = aesni_make_block192(0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block192(&key).str);
- aesni_print_block192_as_matrix(&key);
+
+ {
+ AesNI_BlockString192 str;
+ aesni_format_block192(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block192_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule192(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cbc192(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
aesni_invert_key_schedule192(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_cbc192(cipher, &inverted_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes192cfb.c b/examples/aes192cfb.c
index d5bf554..17480e3 100644
--- a/examples/aes192cfb.c
+++ b/examples/aes192cfb.c
@@ -20,41 +20,81 @@ int main()
key = aesni_make_block192(0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block192(&key).str);
- aesni_print_block192_as_matrix(&key);
+
+ {
+ AesNI_BlockString192 str;
+ aesni_format_block192(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block192_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule192(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cfb192(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_cfb192(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes192ctr.c b/examples/aes192ctr.c
index 3ce7c76..82b41cf 100644
--- a/examples/aes192ctr.c
+++ b/examples/aes192ctr.c
@@ -20,33 +20,63 @@ int main()
key = aesni_make_block192(0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block192(&key).str);
- aesni_print_block192_as_matrix(&key);
+
+ {
+ AesNI_BlockString192 str;
+ aesni_format_block192(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block192_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule192(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ctr192(plain, &key_schedule, iv, 0);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
decrypted = aesni_decrypt_block_ctr192(cipher, &key_schedule, iv, 0);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes192ecb.c b/examples/aes192ecb.c
index 775ca7d..bdc048c 100644
--- a/examples/aes192ecb.c
+++ b/examples/aes192ecb.c
@@ -19,36 +19,65 @@ int main()
plain = aesni_make_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100);
key = aesni_make_block192(0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block192(&key).str);
- aesni_print_block192_as_matrix(&key);
+
+ {
+ AesNI_BlockString192 str;
+ aesni_format_block192(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block192_as_matrix(&key, NULL);
+ }
aesni_expand_key_schedule192(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ecb192(plain, &key_schedule);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
aesni_invert_key_schedule192(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_ecb192(cipher, &inverted_schedule);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes192ofb.c b/examples/aes192ofb.c
index 33e9429..de347ae 100644
--- a/examples/aes192ofb.c
+++ b/examples/aes192ofb.c
@@ -20,41 +20,81 @@ int main()
key = aesni_make_block192(0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block192(&key).str);
- aesni_print_block192_as_matrix(&key);
+
+ {
+ AesNI_BlockString192 str;
+ aesni_format_block192(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block192_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule192(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 13; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ofb192(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_ofb192(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes256cbc.c b/examples/aes256cbc.c
index 3af1015..f62fc84 100644
--- a/examples/aes256cbc.c
+++ b/examples/aes256cbc.c
@@ -20,48 +20,92 @@ int main()
key = aesni_make_block256(0x1f1e1d1c, 0x1b1a1918, 0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block256(&key).str);
- aesni_print_block256_as_matrix(&key);
+
+ {
+ AesNI_BlockString256 str;
+ aesni_format_block256(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block256_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule256(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cbc256(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
aesni_invert_key_schedule256(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_cbc256(cipher, &inverted_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes256cfb.c b/examples/aes256cfb.c
index 6ee1134..950585d 100644
--- a/examples/aes256cfb.c
+++ b/examples/aes256cfb.c
@@ -20,41 +20,81 @@ int main()
key = aesni_make_block256(0x1f1e1d1c, 0x1b1a1918, 0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block256(&key).str);
- aesni_print_block256_as_matrix(&key);
+
+ {
+ AesNI_BlockString256 str;
+ aesni_format_block256(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block256_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule256(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_cfb256(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_cfb256(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/examples/aes256ctr.c b/examples/aes256ctr.c
index 05c5090..efb36e4 100644
--- a/examples/aes256ctr.c
+++ b/examples/aes256ctr.c
@@ -20,33 +20,63 @@ int main()
key = aesni_make_block256(0x1f1e1d1c, 0x1b1a1918, 0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block256(&key).str);
- aesni_print_block256_as_matrix(&key);
+
+ {
+ AesNI_BlockString256 str;
+ aesni_format_block256(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block256_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule256(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ctr256(plain, &key_schedule, iv, 0);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
decrypted = aesni_decrypt_block_ctr256(cipher, &key_schedule, iv, 0);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes256ecb.c b/examples/aes256ecb.c
index ead4c15..ddb90ca 100644
--- a/examples/aes256ecb.c
+++ b/examples/aes256ecb.c
@@ -19,36 +19,65 @@ int main()
plain = aesni_make_block128(0xffeeddcc, 0xbbaa9988, 0x77665544, 0x33221100);
key = aesni_make_block256(0x1f1e1d1c, 0x1b1a1918, 0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block256(&key).str);
- aesni_print_block256_as_matrix(&key);
+
+ {
+ AesNI_BlockString256 str;
+ aesni_format_block256(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block256_as_matrix(&key, NULL);
+ }
aesni_expand_key_schedule256(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ecb256(plain, &key_schedule);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
aesni_invert_key_schedule256(&key_schedule, &inverted_schedule);
printf("\n");
printf("Inverted key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&inverted_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &inverted_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
decrypted = aesni_decrypt_block_ecb256(cipher, &inverted_schedule);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
return 0;
}
diff --git a/examples/aes256ofb.c b/examples/aes256ofb.c
index 098b321..8a7bf32 100644
--- a/examples/aes256ofb.c
+++ b/examples/aes256ofb.c
@@ -20,41 +20,81 @@ int main()
key = aesni_make_block256(0x1f1e1d1c, 0x1b1a1918, 0x17161514, 0x13121110, 0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100);
iv = aesni_make_block128(0xfedcba98, 0x76543210, 0xfedcba98, 0x76543210);
- printf("Plain: %s\n", aesni_format_block128(&plain).str);
- aesni_print_block128_as_matrix(&plain);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &plain, NULL);
+ printf("Plain: %s\n", str.str);
+ aesni_print_block128_as_matrix(&plain, NULL);
+ }
printf("\n");
- printf("Key: %s\n", aesni_format_block256(&key).str);
- aesni_print_block256_as_matrix(&key);
+
+ {
+ AesNI_BlockString256 str;
+ aesni_format_block256(&str, &key, NULL);
+ printf("Key: %s\n", str.str);
+ aesni_print_block256_as_matrix(&key, NULL);
+ }
printf("\n");
- printf("Initialization vector: %s\n", aesni_format_block128(&iv).str);
- aesni_print_block128_as_matrix(&iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &iv, NULL);
+ printf("Initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&iv, NULL);
+ }
aesni_expand_key_schedule256(&key, &key_schedule);
printf("\n");
printf("Key schedule:\n");
for (int i = 0; i < 15; ++i)
- printf("\t[%d]: %s\n", i, aesni_format_block128(&key_schedule.keys[i]).str);
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &key_schedule.keys[i], NULL);
+ printf("\t[%d]: %s\n", i, str.str);
+ }
cipher = aesni_encrypt_block_ofb256(plain, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Cipher: %s\n", aesni_format_block128(&cipher).str);
- aesni_print_block128_as_matrix(&cipher);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &cipher, NULL);
+ printf("Cipher: %s\n", str.str);
+ aesni_print_block128_as_matrix(&cipher, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
decrypted = aesni_decrypt_block_ofb256(cipher, &key_schedule, iv, &next_iv);
+
printf("\n");
- printf("Decrypted: %s\n", aesni_format_block128(&decrypted).str);
- aesni_print_block128_as_matrix(&decrypted);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &decrypted, NULL);
+ printf("Decrypted: %s\n", str.str);
+ aesni_print_block128_as_matrix(&decrypted, NULL);
+ }
printf("\n");
- printf("Next initialization vector: %s\n", aesni_format_block128(&next_iv).str);
- aesni_print_block128_as_matrix(&next_iv);
+
+ {
+ AesNI_BlockString128 str;
+ aesni_format_block128(&str, &next_iv, NULL);
+ printf("Next initialization vector: %s\n", str.str);
+ aesni_print_block128_as_matrix(&next_iv, NULL);
+ }
return 0;
}
diff --git a/include/aesni/data.h b/include/aesni/data.h
index 188b3e4..6f4da76 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -222,25 +222,25 @@ typedef struct { char str[33]; } AesNI_BlockString128;
typedef struct { char str[49]; } AesNI_BlockString192;
typedef struct { char str[65]; } AesNI_BlockString256;
-AesNI_BlockString128 aesni_format_block128(AesNI_Block128*);
-AesNI_BlockString192 aesni_format_block192(AesNI_Block192*);
-AesNI_BlockString256 aesni_format_block256(AesNI_Block256*);
+AesNI_StatusCode aesni_format_block128(AesNI_BlockString128*, const AesNI_Block128*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_format_block192(AesNI_BlockString192*, const AesNI_Block192*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_format_block256(AesNI_BlockString256*, const AesNI_Block256*, AesNI_ErrorDetails*);
typedef struct { char str[49]; } AesNI_BlockMatrixString128;
typedef struct { char str[73]; } AesNI_BlockMatrixString192;
typedef struct { char str[97]; } AesNI_BlockMatrixString256;
-AesNI_BlockMatrixString128 aesni_format_block128_as_matrix(AesNI_Block128*);
-AesNI_BlockMatrixString192 aesni_format_block192_as_matrix(AesNI_Block192*);
-AesNI_BlockMatrixString256 aesni_format_block256_as_matrix(AesNI_Block256*);
+AesNI_StatusCode aesni_format_block128_as_matrix(AesNI_BlockMatrixString128*, const AesNI_Block128*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_format_block192_as_matrix(AesNI_BlockMatrixString192*, const AesNI_Block192*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_format_block256_as_matrix(AesNI_BlockMatrixString256*, const AesNI_Block256*, AesNI_ErrorDetails*);
-void aesni_print_block128(AesNI_Block128*);
-void aesni_print_block192(AesNI_Block192*);
-void aesni_print_block256(AesNI_Block256*);
+AesNI_StatusCode aesni_print_block128(const AesNI_Block128*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_print_block192(const AesNI_Block192*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_print_block256(const AesNI_Block256*, AesNI_ErrorDetails*);
-void aesni_print_block128_as_matrix(AesNI_Block128*);
-void aesni_print_block192_as_matrix(AesNI_Block192*);
-void aesni_print_block256_as_matrix(AesNI_Block256*);
+AesNI_StatusCode aesni_print_block128_as_matrix(const AesNI_Block128*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_print_block192_as_matrix(const AesNI_Block192*, AesNI_ErrorDetails*);
+AesNI_StatusCode aesni_print_block256_as_matrix(const AesNI_Block256*, AesNI_ErrorDetails*);
AesNI_StatusCode aesni_parse_block128(
AesNI_Block128* dest,
diff --git a/src/data.c b/src/data.c
index b596118..ef2d7f3 100644
--- a/src/data.c
+++ b/src/data.c
@@ -14,12 +14,17 @@
#include <stdio.h>
#include <string.h>
-AesNI_BlockString128 aesni_format_block128(AesNI_Block128* block)
+AesNI_StatusCode aesni_format_block128(AesNI_BlockString128* str, const AesNI_Block128* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockString128 result;
- char *cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
__declspec(align(16)) unsigned char bytes[16];
aesni_store_block128_aligned(bytes, *block);
@@ -28,15 +33,20 @@ AesNI_BlockString128 aesni_format_block128(AesNI_Block128* block)
sprintf(cursor, "%02x", bytes[i]);
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-AesNI_BlockString192 aesni_format_block192(AesNI_Block192* block)
+AesNI_StatusCode aesni_format_block192(AesNI_BlockString192* str, const AesNI_Block192* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockString192 result;
- char *cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
{
__declspec(align(16)) unsigned char bytes[16];
@@ -55,15 +65,20 @@ AesNI_BlockString192 aesni_format_block192(AesNI_Block192* block)
}
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-AesNI_BlockString256 aesni_format_block256(AesNI_Block256* block)
+AesNI_StatusCode aesni_format_block256(AesNI_BlockString256* str, const AesNI_Block256* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockString256 result;
- char *cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
{
__declspec(align(16)) unsigned char bytes[16];
@@ -82,15 +97,20 @@ AesNI_BlockString256 aesni_format_block256(AesNI_Block256* block)
}
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-AesNI_BlockMatrixString128 aesni_format_block128_as_matrix(AesNI_Block128* block)
+AesNI_StatusCode aesni_format_block128_as_matrix(AesNI_BlockMatrixString128* str, const AesNI_Block128* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockMatrixString128 result;
- char* cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
__declspec(align(16)) unsigned char bytes[4][4];
aesni_store_block128_aligned(bytes, *block);
@@ -103,19 +123,24 @@ AesNI_BlockMatrixString128 aesni_format_block128_as_matrix(AesNI_Block128* block
}
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-AesNI_BlockMatrixString192 aesni_format_block192_as_matrix(AesNI_Block192* block)
+AesNI_StatusCode aesni_format_block192_as_matrix(AesNI_BlockMatrixString192* str, const AesNI_Block192* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockMatrixString192 result;
- char* cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
__declspec(align(16)) unsigned char bytes[8][4];
aesni_store_block128_aligned(bytes, block->lo);
- aesni_store_block128_aligned(bytes + 16, block->hi);
+ aesni_store_block128_aligned(bytes + 4, block->hi);
for (int i = 0; i < 4; ++i, cursor += 3)
{
@@ -125,19 +150,24 @@ AesNI_BlockMatrixString192 aesni_format_block192_as_matrix(AesNI_Block192* block
}
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-AesNI_BlockMatrixString256 aesni_format_block256_as_matrix(AesNI_Block256* block)
+AesNI_StatusCode aesni_format_block256_as_matrix(AesNI_BlockMatrixString256* str, const AesNI_Block256* block, AesNI_ErrorDetails* err_details)
{
+ assert(str);
assert(block);
- AesNI_BlockMatrixString256 result;
- char* cursor = result.str;
+ if (str == NULL)
+ return aesni_make_null_argument_error(err_details, "str");
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ char* cursor = str->str;
__declspec(align(16)) unsigned char bytes[8][4];
aesni_store_block128_aligned(bytes, block->lo);
- aesni_store_block128_aligned(bytes + 16, block->hi);
+ aesni_store_block128_aligned(bytes + 4, block->hi);
for (int i = 0; i < 4; ++i, cursor += 3)
{
@@ -147,49 +177,109 @@ AesNI_BlockMatrixString256 aesni_format_block256_as_matrix(AesNI_Block256* block
}
*cursor = '\0';
- return result;
+ return aesni_initialize_error_details(err_details);
}
-void aesni_print_block128(AesNI_Block128* block)
+AesNI_StatusCode aesni_print_block128(const AesNI_Block128* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s\n", aesni_format_block128(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockString128 str;
+
+ if (aesni_is_error(ec = aesni_format_block128(&str, block, err_details)))
+ return ec;
+
+ printf("%s\n", str.str);
+ return ec;
}
-void aesni_print_block192(AesNI_Block192* block)
+AesNI_StatusCode aesni_print_block192(const AesNI_Block192* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s\n", aesni_format_block192(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockString192 str;
+
+ if (aesni_is_error(ec = aesni_format_block192(&str, block, err_details)))
+ return ec;
+
+ printf("%s\n", str.str);
+ return ec;
}
-void aesni_print_block256(AesNI_Block256* block)
+AesNI_StatusCode aesni_print_block256(const AesNI_Block256* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s\n", aesni_format_block256(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockString256 str;
+
+ if (aesni_is_error(ec = aesni_format_block256(&str, block, err_details)))
+ return ec;
+
+ printf("%s\n", str.str);
+ return ec;
}
-void aesni_print_block128_as_matrix(AesNI_Block128* block)
+AesNI_StatusCode aesni_print_block128_as_matrix(const AesNI_Block128* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s", aesni_format_block128_as_matrix(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockMatrixString128 str;
+
+ if (aesni_is_error(ec = aesni_format_block128_as_matrix(&str, block, err_details)))
+ return ec;
+
+ printf("%s", str.str);
+ return ec;
}
-void aesni_print_block192_as_matrix(AesNI_Block192* block)
+AesNI_StatusCode aesni_print_block192_as_matrix(const AesNI_Block192* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s", aesni_format_block192_as_matrix(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockMatrixString192 str;
+
+ if (aesni_is_error(ec = aesni_format_block192_as_matrix(&str, block, err_details)))
+ return ec;
+
+ printf("%s", str.str);
+ return ec;
}
-void aesni_print_block256_as_matrix(AesNI_Block256* block)
+AesNI_StatusCode aesni_print_block256_as_matrix(const AesNI_Block256* block, AesNI_ErrorDetails* err_details)
{
assert(block);
- printf("%s", aesni_format_block256_as_matrix(block).str);
+ if (block == NULL)
+ return aesni_make_null_argument_error(err_details, "block");
+
+ AesNI_StatusCode ec = aesni_initialize_error_details(err_details);
+ AesNI_BlockMatrixString256 str;
+
+ if (aesni_is_error(ec = aesni_format_block256_as_matrix(&str, block, err_details)))
+ return ec;
+
+ printf("%s", str.str);
+ return ec;
}
AesNI_StatusCode aesni_parse_block128(
diff --git a/test/aes128cbc_decrypt_block.c b/test/aes128cbc_decrypt_block.c
index f702e4a..933c279 100644
--- a/test/aes128cbc_decrypt_block.c
+++ b/test/aes128cbc_decrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cbc128(cipher, &inverted_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes128cbc_encrypt_block.c b/test/aes128cbc_encrypt_block.c
index 7ee7734..109dfc1 100644
--- a/test/aes128cbc_encrypt_block.c
+++ b/test/aes128cbc_encrypt_block.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cbc128(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes128cfb_decrypt_block.c b/test/aes128cfb_decrypt_block.c
index e84e5fa..4f4803a 100644
--- a/test/aes128cfb_decrypt_block.c
+++ b/test/aes128cfb_decrypt_block.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cfb128(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes128cfb_encrypt_block.c b/test/aes128cfb_encrypt_block.c
index 9ef1df4..90a1a4b 100644
--- a/test/aes128cfb_encrypt_block.c
+++ b/test/aes128cfb_encrypt_block.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cfb128(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes128ctr_decrypt_block.c b/test/aes128ctr_decrypt_block.c
index 354626a..54c8375 100644
--- a/test/aes128ctr_decrypt_block.c
+++ b/test/aes128ctr_decrypt_block.c
@@ -55,7 +55,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ctr128(cipher, &key_schedule, iv, ctr++);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes128ctr_encrypt_block.c b/test/aes128ctr_encrypt_block.c
index 3bab709..d5cec3b 100644
--- a/test/aes128ctr_encrypt_block.c
+++ b/test/aes128ctr_encrypt_block.c
@@ -55,7 +55,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ctr128(plain, &key_schedule, iv, ctr++);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes128ecb_decrypt_block.c b/test/aes128ecb_decrypt_block.c
index 7b34641..f470ecc 100644
--- a/test/aes128ecb_decrypt_block.c
+++ b/test/aes128ecb_decrypt_block.c
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ecb128(cipher, &inverted_schedule);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes128ecb_encrypt_block.c b/test/aes128ecb_encrypt_block.c
index 502cc65..be86d05 100644
--- a/test/aes128ecb_encrypt_block.c
+++ b/test/aes128ecb_encrypt_block.c
@@ -47,7 +47,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ecb128(plain, &key_schedule);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes128ofb_decrypt_block.c b/test/aes128ofb_decrypt_block.c
index ac29f05..b8a6880 100644
--- a/test/aes128ofb_decrypt_block.c
+++ b/test/aes128ofb_decrypt_block.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ofb128(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes128ofb_encrypt_block.c b/test/aes128ofb_encrypt_block.c
index e25aac8..a64fa31 100644
--- a/test/aes128ofb_encrypt_block.c
+++ b/test/aes128ofb_encrypt_block.c
@@ -53,7 +53,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ofb128(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes192cbc_decrypt_block.c b/test/aes192cbc_decrypt_block.c
index 8a034ba..2ee439f 100644
--- a/test/aes192cbc_decrypt_block.c
+++ b/test/aes192cbc_decrypt_block.c
@@ -55,7 +55,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cbc192(cipher, &inverted_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes192cbc_encrypt_block.c b/test/aes192cbc_encrypt_block.c
index 6d8f15e..ffd164e 100644
--- a/test/aes192cbc_encrypt_block.c
+++ b/test/aes192cbc_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cbc192(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes192cfb_decrypt_block.c b/test/aes192cfb_decrypt_block.c
index 13abb88..4bd04bd 100644
--- a/test/aes192cfb_decrypt_block.c
+++ b/test/aes192cfb_decrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cfb192(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes192cfb_encrypt_block.c b/test/aes192cfb_encrypt_block.c
index 19137b2..6248e94 100644
--- a/test/aes192cfb_encrypt_block.c
+++ b/test/aes192cfb_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cfb192(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes192ctr_decrypt_block.c b/test/aes192ctr_decrypt_block.c
index ce90f3a..6d0387e 100644
--- a/test/aes192ctr_decrypt_block.c
+++ b/test/aes192ctr_decrypt_block.c
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ctr192(cipher, &key_schedule, iv, ctr++);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes192ctr_encrypt_block.c b/test/aes192ctr_encrypt_block.c
index 5258efa..d0780c1 100644
--- a/test/aes192ctr_encrypt_block.c
+++ b/test/aes192ctr_encrypt_block.c
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ctr192(plain, &key_schedule, iv, ctr++);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes192ecb_decrypt_block.c b/test/aes192ecb_decrypt_block.c
index 5d209ae..399e00c 100644
--- a/test/aes192ecb_decrypt_block.c
+++ b/test/aes192ecb_decrypt_block.c
@@ -49,7 +49,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ecb192(cipher, &inverted_schedule);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes192ecb_encrypt_block.c b/test/aes192ecb_encrypt_block.c
index 82f6821..051efc3 100644
--- a/test/aes192ecb_encrypt_block.c
+++ b/test/aes192ecb_encrypt_block.c
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ecb192(plain, &key_schedule);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes192ofb_decrypt_block.c b/test/aes192ofb_decrypt_block.c
index 64bb708..0cc1501 100644
--- a/test/aes192ofb_decrypt_block.c
+++ b/test/aes192ofb_decrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ofb192(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes192ofb_encrypt_block.c b/test/aes192ofb_encrypt_block.c
index 986ac37..8282c23 100644
--- a/test/aes192ofb_encrypt_block.c
+++ b/test/aes192ofb_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ofb192(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes256cbc_decrypt_block.c b/test/aes256cbc_decrypt_block.c
index 89ead21..b3b15ce 100644
--- a/test/aes256cbc_decrypt_block.c
+++ b/test/aes256cbc_decrypt_block.c
@@ -55,7 +55,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cbc256(cipher, &inverted_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes256cbc_encrypt_block.c b/test/aes256cbc_encrypt_block.c
index f6e067e..cb3be83 100644
--- a/test/aes256cbc_encrypt_block.c
+++ b/test/aes256cbc_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cbc256(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes256cfb_decrypt_block.c b/test/aes256cfb_decrypt_block.c
index 249f413..cfdfb4b 100644
--- a/test/aes256cfb_decrypt_block.c
+++ b/test/aes256cfb_decrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_cfb256(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes256cfb_encrypt_block.c b/test/aes256cfb_encrypt_block.c
index 7713db5..0a73528 100644
--- a/test/aes256cfb_encrypt_block.c
+++ b/test/aes256cfb_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_cfb256(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes256ctr_decrypt_block.c b/test/aes256ctr_decrypt_block.c
index e2669e6..6e7f875 100644
--- a/test/aes256ctr_decrypt_block.c
+++ b/test/aes256ctr_decrypt_block.c
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ctr256(cipher, &key_schedule, iv, ctr++);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes256ctr_encrypt_block.c b/test/aes256ctr_encrypt_block.c
index 7d1d8e7..667b593 100644
--- a/test/aes256ctr_encrypt_block.c
+++ b/test/aes256ctr_encrypt_block.c
@@ -56,7 +56,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ctr256(plain, &key_schedule, iv, ctr++);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes256ecb_decrypt_block.c b/test/aes256ecb_decrypt_block.c
index 134b33f..0ea066a 100644
--- a/test/aes256ecb_decrypt_block.c
+++ b/test/aes256ecb_decrypt_block.c
@@ -49,7 +49,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ecb256(cipher, &inverted_schedule);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes256ecb_encrypt_block.c b/test/aes256ecb_encrypt_block.c
index 3d0a8ee..289c82f 100644
--- a/test/aes256ecb_encrypt_block.c
+++ b/test/aes256ecb_encrypt_block.c
@@ -48,7 +48,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ecb256(plain, &key_schedule);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}
diff --git a/test/aes256ofb_decrypt_block.c b/test/aes256ofb_decrypt_block.c
index 1033df7..e323d79 100644
--- a/test/aes256ofb_decrypt_block.c
+++ b/test/aes256ofb_decrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
plain = aesni_decrypt_block_ofb256(cipher, &key_schedule, iv, &iv);
- aesni_print_block128(&plain);
+ aesni_print_block128(&plain, NULL);
}
}
diff --git a/test/aes256ofb_encrypt_block.c b/test/aes256ofb_encrypt_block.c
index 71dfea9..7a185eb 100644
--- a/test/aes256ofb_encrypt_block.c
+++ b/test/aes256ofb_encrypt_block.c
@@ -54,7 +54,7 @@ int main(int argc, char** argv)
continue;
}
cipher = aesni_encrypt_block_ofb256(plain, &key_schedule, iv, &iv);
- aesni_print_block128(&cipher);
+ aesni_print_block128(&cipher, NULL);
}
}