aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--examples/aes192_example.c1
-rw-r--r--examples/aes256cbc_example.c1
-rw-r--r--examples/aes256ecb_example.c1
-rw-r--r--include/aesni/data.h2
-rw-r--r--src/common.c32
5 files changed, 37 insertions, 0 deletions
diff --git a/examples/aes192_example.c b/examples/aes192_example.c
index c936ab7..eb9b79d 100644
--- a/examples/aes192_example.c
+++ b/examples/aes192_example.c
@@ -25,6 +25,7 @@ int main()
printf("\n");
printf("Key: %s\n", format_aes_block192(&key).str);
printf(" %s\n", format_aes_block192_fips_style(&key).str);
+ print_aes_block192_fips_matrix_style(&key);
cypher = aes192ecb_encrypt(plain, &key);
printf("\n");
diff --git a/examples/aes256cbc_example.c b/examples/aes256cbc_example.c
index 4ce50d9..275b947 100644
--- a/examples/aes256cbc_example.c
+++ b/examples/aes256cbc_example.c
@@ -26,6 +26,7 @@ int main()
printf("\n");
printf("Key: %s\n", format_aes_block256(&key).str);
printf(" %s\n", format_aes_block256_fips_style(&key).str);
+ print_aes_block256_fips_matrix_style(&key);
printf("\n");
printf("Initialization vector: %s\n", format_aes_block128(&iv).str);
diff --git a/examples/aes256ecb_example.c b/examples/aes256ecb_example.c
index fe7f9b9..d7a82ee 100644
--- a/examples/aes256ecb_example.c
+++ b/examples/aes256ecb_example.c
@@ -25,6 +25,7 @@ int main()
printf("\n");
printf("Key: %s\n", format_aes_block256(&key).str);
printf(" %s\n", format_aes_block256_fips_style(&key).str);
+ print_aes_block256_fips_matrix_style(&key);
cypher = aes256ecb_encrypt(plain, &key);
printf("\n");
diff --git a/include/aesni/data.h b/include/aesni/data.h
index 8819214..e0e4563 100644
--- a/include/aesni/data.h
+++ b/include/aesni/data.h
@@ -51,3 +51,5 @@ void print_aes_block192_fips_style(AesBlock192*);
void print_aes_block256_fips_style(AesBlock256*);
void print_aes_block128_fips_matrix_style(AesBlock128*);
+void print_aes_block192_fips_matrix_style(AesBlock192*);
+void print_aes_block256_fips_matrix_style(AesBlock256*);
diff --git a/src/common.c b/src/common.c
index 50d9886..9aed290 100644
--- a/src/common.c
+++ b/src/common.c
@@ -163,3 +163,35 @@ void print_aes_block128_fips_matrix_style(AesBlock128* block)
printf("%02x\n", bytes[3][i]);
}
}
+
+void print_aes_block192_fips_matrix_style(AesBlock192* block)
+{
+ int i, j;
+ __declspec(align(16)) unsigned char bytes[8][4];
+
+ _mm_store_si128((AesBlock128*) bytes, block->lo);
+ _mm_store_si128((AesBlock128*) bytes + 1, block->hi);
+
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 5; ++j)
+ printf("%02x ", bytes[j][i]);
+ printf("%02x\n", bytes[5][i]);
+ }
+}
+
+void print_aes_block256_fips_matrix_style(AesBlock256* block)
+{
+ int i, j;
+ __declspec(align(16)) unsigned char bytes[8][4];
+
+ _mm_store_si128((AesBlock128*) bytes, block->lo);
+ _mm_store_si128((AesBlock128*) bytes + 1, block->hi);
+
+ for (i = 0; i < 4; ++i)
+ {
+ for (j = 0; j < 7; ++j)
+ printf("%02x ", bytes[j][i]);
+ printf("%02x\n", bytes[7][i]);
+ }
+}