diff mbox series

[API-NEXT,v4,5/15] validation: crypto: use single definitions for AES key lengths

Message ID 1517331619-18755-6-git-send-email-odpbot@yandex.ru
State New
Headers show
Series [API-NEXT,v4,1/15] api: crypto: add enumeration for AES-CMAC | expand

Commit Message

Github ODP bot Jan. 30, 2018, 5 p.m. UTC
From: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>


Merge defines for AES-CBC/CTR/GCM keys.

Signed-off-by: Dmitry Eremin-Solenikov <dmitry.ereminsolenikov@linaro.org>

---
/** Email created from pull request 434 (lumag:crypto-upd)
 ** https://github.com/Linaro/odp/pull/434
 ** Patch: https://github.com/Linaro/odp/pull/434.patch
 ** Base sha: 5718327018debbb02aacb464493504c95fbe57a3
 ** Merge commit sha: c5d9389a8d3b1a532e290aff4508756a920173ee
 **/
 test/validation/api/crypto/test_vectors.h     | 32 +++++++++++------------
 test/validation/api/crypto/test_vectors_len.h | 37 +++++++--------------------
 2 files changed, 25 insertions(+), 44 deletions(-)
diff mbox series

Patch

diff --git a/test/validation/api/crypto/test_vectors.h b/test/validation/api/crypto/test_vectors.h
index 9c0b844d1..ff69717db 100644
--- a/test/validation/api/crypto/test_vectors.h
+++ b/test/validation/api/crypto/test_vectors.h
@@ -74,7 +74,7 @@  static crypto_test_reference_t tdes_cbc_reference[] = {
 
 static crypto_test_reference_t aes_cbc_reference[] = {
 	{
-		.cipher_key_length = AES128_CBC_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x06, 0xa9, 0x21, 0x40, 0x36, 0xb8, 0xa1, 0x5b,
 				0x51, 0x2e, 0x03, 0xd5, 0x34, 0x12, 0x00, 0x06},
 		.cipher_iv_length = AES_CBC_IV_LEN,
@@ -86,7 +86,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 				0x27, 0x08, 0x94, 0x2d, 0xbe, 0x77, 0x18, 0x1a }
 	},
 	{
-		.cipher_key_length = AES128_CBC_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0xc2, 0x86, 0x69, 0x6d, 0x88, 0x7c, 0x9a, 0xa0,
 				0x61, 0x1b, 0xbb, 0x3e, 0x20, 0x25, 0xa4, 0x5a},
 		.cipher_iv_length = AES_CBC_IV_LEN,
@@ -103,7 +103,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 				0x1b, 0x82, 0x66, 0xbe, 0xa6, 0xd6, 0x1a, 0xb1 }
 	},
 	{
-		.cipher_key_length = AES128_CBC_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x6c, 0x3e, 0xa0, 0x47, 0x76, 0x30, 0xce, 0x21,
 				0xa2, 0xce, 0x33, 0x4a, 0xa7, 0x46, 0xc2, 0xcd},
 		.cipher_iv_length = AES_CBC_IV_LEN,
@@ -119,7 +119,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 				0x85, 0x79, 0x69, 0x5d, 0x83, 0xba, 0x26, 0x84 }
 	},
 	{
-		.cipher_key_length = AES128_CBC_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x56, 0xe4, 0x7a, 0x38, 0xc5, 0x59, 0x89, 0x74,
 				0xbc, 0x46, 0x90, 0x3d, 0xba, 0x29, 0x03, 0x49},
 		.cipher_iv_length = AES_CBC_IV_LEN,
@@ -144,7 +144,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 				0x49, 0xa5, 0x3e, 0x87, 0xf4, 0xc3, 0xda, 0x55 }
 	},
 	{
-		.cipher_key_length = AES192_CBC_KEY_LEN,
+		.cipher_key_length = AES192_KEY_LEN,
 		.cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
 				0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
 				0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
@@ -162,7 +162,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 				0x53, 0x1c, 0xc6, 0x98, 0x85, 0xc3, 0x00, 0xe6},
 	},
 	{
-		.cipher_key_length = AES256_CBC_KEY_LEN,
+		.cipher_key_length = AES256_KEY_LEN,
 		.cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
 				0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
 				0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
@@ -188,7 +188,7 @@  static crypto_test_reference_t aes_cbc_reference[] = {
 
 static crypto_test_reference_t aes_ctr_reference[] = {
 	{
-		.cipher_key_length = AES128_CTR_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x2b, 0x7e, 0x15, 0x16, 0x28, 0xae, 0xd2, 0xa6,
 				0xab, 0xf7, 0x15, 0x88, 0x09, 0xcf, 0x4f, 0x3c},
 		.cipher_iv_length = AES_CTR_IV_LEN,
@@ -213,7 +213,7 @@  static crypto_test_reference_t aes_ctr_reference[] = {
 				0x79, 0x21, 0x70, 0xa0, 0xf3, 0x00, 0x9c, 0xee }
 	},
 	{
-		.cipher_key_length = AES192_CTR_KEY_LEN,
+		.cipher_key_length = AES192_KEY_LEN,
 		.cipher_key = { 0x8e, 0x73, 0xb0, 0xf7, 0xda, 0x0e, 0x64, 0x52,
 				0xc8, 0x10, 0xf3, 0x2b, 0x80, 0x90, 0x79, 0xe5,
 				0x62, 0xf8, 0xea, 0xd2, 0x52, 0x2c, 0x6b, 0x7b},
@@ -239,7 +239,7 @@  static crypto_test_reference_t aes_ctr_reference[] = {
 				0x5a, 0x97, 0xda, 0xec, 0x58, 0xc6, 0xb0, 0x50 }
 	},
 	{
-		.cipher_key_length = AES256_CTR_KEY_LEN,
+		.cipher_key_length = AES256_KEY_LEN,
 		.cipher_key = { 0x60, 0x3d, 0xeb, 0x10, 0x15, 0xca, 0x71, 0xbe,
 				0x2b, 0x73, 0xae, 0xf0, 0x85, 0x7d, 0x77, 0x81,
 				0x1f, 0x35, 0x2c, 0x07, 0x3b, 0x61, 0x08, 0xd7,
@@ -272,7 +272,7 @@  static crypto_test_reference_t aes_ctr_reference[] = {
  */
 static crypto_test_reference_t aes_gcm_reference[] = {
 	{
-		.cipher_key_length = AES128_GCM_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
 				0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
 		.cipher_iv_length = AES_GCM_IV_LEN,
@@ -305,7 +305,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 			    0x2f, 0xd0, 0x47, 0x96, 0x56, 0x2d, 0xfd, 0xb4  }
 	},
 	{
-		.cipher_key_length = AES128_GCM_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
 				0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08},
 		.cipher_iv_length = AES_GCM_IV_LEN,
@@ -335,7 +335,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 			    0xc3, 0x09, 0xe9, 0xd8, 0x5a, 0x41, 0xad, 0x4a }
 	},
 	{
-		.cipher_key_length = AES128_GCM_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
 				0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00},
 		.cipher_iv_length = AES_GCM_IV_LEN,
@@ -365,7 +365,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 			    0x8a, 0xd2, 0xb6, 0x9e, 0x47, 0x99, 0xc7, 0x1d }
 	},
 	{
-		.cipher_key_length = AES128_GCM_KEY_LEN,
+		.cipher_key_length = AES128_KEY_LEN,
 		.cipher_key = { 0x3d, 0xe0, 0x98, 0x74, 0xb3, 0x88, 0xe6, 0x49,
 				0x19, 0x88, 0xd0, 0xc3, 0x60, 0x7e, 0xae, 0x1f},
 		.cipher_iv_length = AES_GCM_IV_LEN,
@@ -388,7 +388,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 			    0x95, 0xf1, 0x12, 0xe4, 0xe7, 0xd0, 0x5d, 0x35 }
 	},
 	{
-		.cipher_key_length = AES192_GCM_KEY_LEN,
+		.cipher_key_length = AES192_KEY_LEN,
 		.cipher_key = { 0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c,
 				0x6d, 0x6a, 0x8f, 0x94, 0x67, 0x30, 0x83, 0x08,
 				0xfe, 0xff, 0xe9, 0x92, 0x86, 0x65, 0x73, 0x1c},
@@ -413,7 +413,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 			    0x18, 0x02, 0x7b, 0x5b, 0x4c, 0xd7, 0xa6, 0x36 }
 	},
 	{
-		.cipher_key_length = AES256_GCM_KEY_LEN,
+		.cipher_key_length = AES256_KEY_LEN,
 		.cipher_key = { 0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
 				0x34, 0x45, 0x56, 0x67, 0x78, 0x89, 0x9a, 0xab,
 				0xab, 0xbc, 0xcd, 0xde, 0xf0, 0x01, 0x12, 0x23,
@@ -446,7 +446,7 @@  static crypto_test_reference_t aes_gcm_reference[] = {
 
 static crypto_test_reference_t aes_gmac_reference[] = {
 	{
-		.auth_key_length = AES128_GCM_KEY_LEN,
+		.auth_key_length = AES128_KEY_LEN,
 		.auth_key = { 0x4c, 0x80, 0xcd, 0xef, 0xbb, 0x5d, 0x10, 0xda,
 			      0x90, 0x6a, 0xc7, 0x3c, 0x36, 0x13, 0xa6, 0x34},
 		.auth_iv_length = AES_GCM_IV_LEN,
diff --git a/test/validation/api/crypto/test_vectors_len.h b/test/validation/api/crypto/test_vectors_len.h
index 2551b054c..8933017b4 100644
--- a/test/validation/api/crypto/test_vectors_len.h
+++ b/test/validation/api/crypto/test_vectors_len.h
@@ -17,43 +17,24 @@ 
 #define TDES_CBC_KEY_LEN        24
 #define TDES_CBC_IV_LEN         8
 
-/* AES-CBC common */
-#define AES_CBC_IV_LEN         16
-
-/* AES128-CBC */
-#define AES128_CBC_KEY_LEN        16
+/* AES common */
 
-/* AES192-CBC */
-#define AES192_CBC_KEY_LEN        24
+#define AES128_KEY_LEN        16
 
-/* AES256-CBC */
-#define AES256_CBC_KEY_LEN        32
+#define AES192_KEY_LEN        24
 
-/* AES-CBC common */
-#define AES_CTR_IV_LEN         16
+#define AES256_KEY_LEN        32
 
-/* AES128-CTR */
-#define AES128_CTR_KEY_LEN        16
-
-/* AES192-CTR */
-#define AES192_CTR_KEY_LEN        24
+/* AES-CBC */
+#define AES_CBC_IV_LEN         16
 
-/* AES256-CTR */
-#define AES256_CTR_KEY_LEN        32
+/* AES-CTR */
+#define AES_CTR_IV_LEN         16
 
-/* AES-GCM common */
+/* AES-GCM */
 #define AES_GCM_IV_LEN         12
 #define AES_GCM_DIGEST_LEN     16
 
-/* AES128-GCM */
-#define AES128_GCM_KEY_LEN        16
-
-/* AES192-GCM */
-#define AES192_GCM_KEY_LEN        24
-
-/* AES256-GCM */
-#define AES256_GCM_KEY_LEN        32
-
 /* HMAC-MD5 */
 #define HMAC_MD5_KEY_LEN        16
 #define HMAC_MD5_96_CHECK_LEN   12