From: Akhil Goyal <gak...@marvell.com>

Added vectors for TLS 1.2 and DTLS 1.2 using algos
AES-256-CBC and HMAC-SHA384

Signed-off-by: Akhil Goyal <gak...@marvell.com>
---
 app/test/test_cryptodev.c                     |  19 ++
 app/test/test_cryptodev_security_tls_record.h |   2 +
 ...yptodev_security_tls_record_test_vectors.h | 200 ++++++++++++++++++
 3 files changed, 221 insertions(+)

diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c
index 6e860b06b2..44dc99b088 100644
--- a/app/test/test_cryptodev.c
+++ b/app/test/test_cryptodev.c
@@ -17273,6 +17273,10 @@ static struct unit_test_suite 
tls12_record_proto_testsuite  = {
                        "Write record known vector AES-256-CBC-SHA256",
                        ut_setup_security, ut_teardown,
                        test_tls_record_proto_known_vec, 
&tls_test_data_aes_256_cbc_sha256_hmac),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Write record known vector AES-256-CBC-SHA384",
+                       ut_setup_security, ut_teardown,
+                       test_tls_record_proto_known_vec, 
&tls_test_data_aes_256_cbc_sha384_hmac),
                TEST_CASE_NAMED_WITH_DATA(
                        "Write record known vector 3DES-CBC-SHA1-HMAC",
                        ut_setup_security, ut_teardown,
@@ -17316,6 +17320,11 @@ static struct unit_test_suite 
tls12_record_proto_testsuite  = {
                        ut_setup_security, ut_teardown,
                        test_tls_record_proto_known_vec_read,
                        &tls_test_data_aes_256_cbc_sha256_hmac),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Read record known vector AES-256-CBC-SHA384",
+                       ut_setup_security, ut_teardown,
+                       test_tls_record_proto_known_vec_read,
+                       &tls_test_data_aes_256_cbc_sha384_hmac),
                TEST_CASE_NAMED_WITH_DATA(
                        "Read record known vector 3DES-CBC-SHA1-HMAC",
                        ut_setup_security, ut_teardown,
@@ -17397,6 +17406,11 @@ static struct unit_test_suite 
dtls12_record_proto_testsuite  = {
                        ut_setup_security, ut_teardown,
                        test_tls_record_proto_known_vec,
                        &dtls_test_data_aes_256_cbc_sha256_hmac),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Write record known vector AES-256-CBC-SHA384",
+                       ut_setup_security, ut_teardown,
+                       test_tls_record_proto_known_vec,
+                       &dtls_test_data_aes_256_cbc_sha384_hmac),
                TEST_CASE_NAMED_WITH_DATA(
                        "Write record known vector 3DES-CBC-SHA1-HMAC",
                        ut_setup_security, ut_teardown,
@@ -17439,6 +17453,11 @@ static struct unit_test_suite 
dtls12_record_proto_testsuite  = {
                        ut_setup_security, ut_teardown,
                        test_tls_record_proto_known_vec_read,
                        &dtls_test_data_aes_256_cbc_sha256_hmac),
+               TEST_CASE_NAMED_WITH_DATA(
+                       "Read record known vector AES-256-CBC-SHA384",
+                       ut_setup_security, ut_teardown,
+                       test_tls_record_proto_known_vec_read,
+                       &dtls_test_data_aes_256_cbc_sha384_hmac),
                TEST_CASE_NAMED_WITH_DATA(
                        "Read record known vector 3DES-CBC-SHA1-HMAC",
                        ut_setup_security, ut_teardown,
diff --git a/app/test/test_cryptodev_security_tls_record.h 
b/app/test/test_cryptodev_security_tls_record.h
index e7ba31c449..22572537ef 100644
--- a/app/test/test_cryptodev_security_tls_record.h
+++ b/app/test/test_cryptodev_security_tls_record.h
@@ -110,6 +110,7 @@ extern struct tls_record_test_data 
tls_test_data_aes_128_cbc_sha1_hmac;
 extern struct tls_record_test_data tls_test_data_aes_128_cbc_sha256_hmac;
 extern struct tls_record_test_data tls_test_data_aes_256_cbc_sha1_hmac;
 extern struct tls_record_test_data tls_test_data_aes_256_cbc_sha256_hmac;
+extern struct tls_record_test_data tls_test_data_aes_256_cbc_sha384_hmac;
 extern struct tls_record_test_data tls_test_data_3des_cbc_sha1_hmac;
 extern struct tls_record_test_data tls_test_data_null_cipher_sha1_hmac;
 extern struct tls_record_test_data tls_test_data_chacha20_poly1305;
@@ -118,6 +119,7 @@ extern struct tls_record_test_data 
dtls_test_data_aes_128_cbc_sha1_hmac;
 extern struct tls_record_test_data dtls_test_data_aes_128_cbc_sha256_hmac;
 extern struct tls_record_test_data dtls_test_data_aes_256_cbc_sha1_hmac;
 extern struct tls_record_test_data dtls_test_data_aes_256_cbc_sha256_hmac;
+extern struct tls_record_test_data dtls_test_data_aes_256_cbc_sha384_hmac;
 extern struct tls_record_test_data dtls_test_data_3des_cbc_sha1_hmac;
 extern struct tls_record_test_data dtls_test_data_null_cipher_sha1_hmac;
 
diff --git a/app/test/test_cryptodev_security_tls_record_test_vectors.h 
b/app/test/test_cryptodev_security_tls_record_test_vectors.h
index f10f28bb96..27b07cd54a 100644
--- a/app/test/test_cryptodev_security_tls_record_test_vectors.h
+++ b/app/test/test_cryptodev_security_tls_record_test_vectors.h
@@ -1129,6 +1129,107 @@ struct tls_record_test_data 
dtls_test_data_aes_256_cbc_sha256_hmac = {
        .app_type = 0x17,
 };
 
+struct tls_record_test_data dtls_test_data_aes_256_cbc_sha384_hmac = {
+       .key = {
+               .data = {
+                       0x1d, 0xe5, 0x19, 0x18, 0x57, 0xa0, 0xee, 0x79,
+                       0x84, 0x61, 0x92, 0x9d, 0x3d, 0xce, 0x42, 0x92,
+                       0x4a, 0x98, 0x23, 0x3b, 0xf8, 0xec, 0x29, 0x47,
+                       0xb3, 0xae, 0x1f, 0x22, 0xd2, 0x8d, 0xbe, 0x2c,
+               },
+       },
+       .auth_key = {
+               .data = {
+                       0xf8, 0xbd, 0x28, 0xf9, 0x4a, 0xde, 0x1d, 0xde,
+                       0x8c, 0xf5, 0xe9, 0x49, 0x34, 0x2a, 0x1a, 0xd0,
+                       0x0d, 0xe3, 0x64, 0xb2, 0x54, 0xd6, 0xd6, 0x40,
+                       0x90, 0x5d, 0x16, 0xc1, 0xf2, 0x77, 0x14, 0x90,
+                       0xe6, 0xfa, 0xbc, 0x9d, 0xe2, 0x72, 0x12, 0xec,
+                       0xb6, 0x05, 0xec, 0xdd, 0x1d, 0x23, 0xb3, 0x8e,
+               },
+       },
+       .input_text = {
+               .data = {
+                       /* actual plain text */
+                       0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20,
+                       0x44, 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e, 0x32,
+                       0x20, 0x41, 0x45, 0x53, 0x2d, 0x32, 0x35, 0x36,
+                       0x2d, 0x43, 0x42, 0x43, 0x20, 0x53, 0x48, 0x41,
+                       0x33, 0x38, 0x34, 0x20, 0x65, 0x78, 0x61, 0x6d,
+                       0x70, 0x6c, 0x65, 0x20, 0x76, 0x65, 0x63, 0x74,
+                       0x6f, 0x72, 0x0a,
+               },
+               .len = 51,
+       },
+       .output_text = {
+               .data = {
+                       0x17, 0xfe, 0xfd, 0x00, 0x01, 0x00, 0x00, 0x00,
+                       0x00, 0x00, 0x01, 0x00, 0x80,
+                       0x63, 0xe2, 0x70, 0xce, 0x45, 0x93, 0x18, 0xa3,
+                       0xa6, 0xd6, 0xf5, 0x50, 0x9f, 0x07, 0x9d, 0xab,
+                       0x88, 0x41, 0xee, 0x5b, 0x32, 0x1e, 0x85, 0xaf,
+                       0x33, 0x7b, 0x59, 0x8a, 0xe9, 0x41, 0x11, 0x6a,
+                       0xbb, 0x7d, 0x16, 0x6c, 0xbb, 0x66, 0x5e, 0xf5,
+                       0xfb, 0x5f, 0x03, 0xf9, 0x75, 0x7d, 0xb9, 0xff,
+                       0x70, 0xc3, 0x4a, 0x19, 0xe5, 0x25, 0xa0, 0x5d,
+                       0xad, 0x45, 0xef, 0xce, 0xd8, 0x2a, 0xde, 0xf0,
+                       0x0c, 0xca, 0x1c, 0x6b, 0x5a, 0x31, 0x8f, 0x49,
+                       0xff, 0x7d, 0xf3, 0x71, 0x15, 0x06, 0x07, 0x9d,
+                       0x6a, 0x5f, 0x5c, 0xd8, 0x2a, 0xa5, 0x0e, 0x61,
+                       0xde, 0x18, 0x6b, 0x7d, 0xc8, 0x74, 0x58, 0x18,
+                       0xf1, 0xac, 0xde, 0xb9, 0x6d, 0x8a, 0x44, 0xad,
+                       0x10, 0xf8, 0x63, 0x15, 0xcf, 0x25, 0x2f, 0x82,
+                       0x2f, 0xda, 0x74, 0x45, 0x02, 0xda, 0x61, 0x3c,
+                       0x2f, 0xf9, 0xa5, 0x92, 0x2a, 0x7c, 0x5e, 0x5d,
+               },
+               .len = 141,
+       },
+       .iv = {
+               .data = {
+                       0x63, 0xe2, 0x70, 0xce, 0x45, 0x93, 0x18, 0xa3,
+                       0xa6, 0xd6, 0xf5, 0x50, 0x9f, 0x07, 0x9d, 0xab,
+               },
+       },
+
+       .xform = {
+               .chain = {
+                       .auth = {
+                               .next = NULL,
+                               .type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                               .auth = {
+                                       .op = RTE_CRYPTO_AUTH_OP_GENERATE,
+                                       .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
+                                       .key.length = 48,
+                                       .iv.length = 0,
+                                       .iv.offset = 0,
+                                       .digest_length = 48,
+                               },
+                       },
+                       .cipher = {
+                               .next = NULL,
+                               .type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                               .cipher = {
+                                       .op = RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+                                       .algo = RTE_CRYPTO_CIPHER_AES_CBC,
+                                       .key.length = 32,
+                                       .iv.length = 16,
+                                       .iv.offset = IV_OFFSET,
+                               },
+                       },
+               },
+       },
+
+       .tls_record_xform = {
+               .ver = RTE_SECURITY_VERSION_DTLS_1_2,
+               .type = RTE_SECURITY_TLS_SESS_TYPE_WRITE,
+               .dtls_1_2.epoch = 1,
+               .dtls_1_2.seq_no = 1,
+       },
+
+       .aead = false,
+       .app_type = 0x17,
+};
+
 struct tls_record_test_data dtls_test_data_3des_cbc_sha1_hmac = {
        .key = {
                .data = {
@@ -1494,6 +1595,105 @@ struct tls_record_test_data 
tls_test_data_aes_256_cbc_sha256_hmac = {
        .app_type = 0x17,
 };
 
+struct tls_record_test_data tls_test_data_aes_256_cbc_sha384_hmac = {
+       .key = {
+               .data = {
+                       0x48, 0x70, 0xc7, 0x93, 0x77, 0xe3, 0x4c, 0x8c,
+                       0x27, 0x00, 0x64, 0x06, 0x3e, 0xc6, 0x47, 0x64,
+                       0xcc, 0xee, 0xa4, 0x9a, 0x1a, 0xe7, 0x3a, 0xc6,
+                       0xef, 0xe5, 0xe6, 0x2c, 0x15, 0xe3, 0xac, 0x16,
+               },
+       },
+       .auth_key = {
+               .data = {
+                       0x23, 0x95, 0x84, 0x30, 0xaf, 0x2b, 0x07, 0xfe,
+                       0x12, 0x83, 0x87, 0x28, 0x2b, 0x38, 0xb9, 0x02,
+                       0xc0, 0x27, 0x59, 0x3e, 0xa7, 0xbd, 0xce, 0xcb,
+                       0xe1, 0x8a, 0xe9, 0x43, 0x5d, 0xed, 0xb4, 0xf2,
+                       0x11, 0x4d, 0x19, 0xbb, 0x0f, 0x1b, 0x76, 0x86,
+                       0xfb, 0xb5, 0xda, 0xfd, 0x38, 0xfe, 0x7d, 0x02,
+               },
+       },
+       .input_text = {
+               .data = {
+                       /* actual plain text */
+                       0x20, 0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73,
+                       0x20, 0x54, 0x4c, 0x53, 0x20, 0x31, 0x2e, 0x32,
+                       0x20, 0x41, 0x45, 0x53, 0x2d, 0x32, 0x35, 0x36,
+                       0x2d, 0x43, 0x42, 0x43, 0x20, 0x53, 0x48, 0x41,
+                       0x33, 0x38, 0x34, 0x20, 0x65, 0x78, 0x61, 0x6d,
+                       0x70, 0x6c, 0x65, 0x20, 0x76, 0x65, 0x63, 0x74,
+                       0x6f, 0x72, 0x0a,
+               },
+               .len = 51,
+       },
+       .output_text = {
+               .data = {
+                       0x17, 0x03, 0x03, 0x00, 0x80,
+                       0xc4, 0x90, 0xd7, 0x74, 0x5e, 0x26, 0xc8, 0x43,
+                       0x12, 0x45, 0x48, 0xc1, 0x0f, 0xb1, 0x18, 0xd8,
+                       0x1e, 0x5b, 0x1e, 0x50, 0x3e, 0x19, 0x25, 0x41,
+                       0x35, 0xc7, 0x7c, 0x14, 0x99, 0x7b, 0x97, 0x80,
+                       0x60, 0x9d, 0xf8, 0xf1, 0xac, 0x43, 0x7b, 0x5c,
+                       0xb6, 0xe2, 0xc4, 0x8f, 0x3f, 0xd7, 0x1b, 0xd4,
+                       0x61, 0x90, 0x40, 0xe3, 0xd5, 0x60, 0xac, 0xee,
+                       0x62, 0x53, 0x1f, 0x1f, 0x75, 0xf6, 0x2c, 0xda,
+                       0x1a, 0xed, 0x4a, 0x6a, 0x11, 0xeb, 0x9b, 0x1c,
+                       0x39, 0x0d, 0x6e, 0x8a, 0xf8, 0x3d, 0x45, 0x08,
+                       0x3e, 0x24, 0x17, 0x3e, 0xcf, 0x74, 0xcf, 0x6a,
+                       0xcb, 0x37, 0xdf, 0x25, 0xc6, 0xa5, 0xe4, 0x1e,
+                       0x53, 0x28, 0x71, 0xcf, 0xac, 0x1e, 0xad, 0x77,
+                       0x8c, 0xfc, 0x80, 0x19, 0x9c, 0xcc, 0x00, 0x60,
+                       0xc6, 0x82, 0xa0, 0xb8, 0x5e, 0x42, 0xd1, 0xff,
+                       0x14, 0x0a, 0x92, 0x5c, 0xde, 0x8a, 0x15, 0x7a,
+               },
+               .len = 133,
+       },
+       .iv = {
+               .data = {
+                       0xc4, 0x90, 0xd7, 0x74, 0x5e, 0x26, 0xc8, 0x43,
+                       0x12, 0x45, 0x48, 0xc1, 0x0f, 0xb1, 0x18, 0xd8,
+               },
+       },
+
+       .xform = {
+               .chain = {
+                       .auth = {
+                               .next = NULL,
+                               .type = RTE_CRYPTO_SYM_XFORM_AUTH,
+                               .auth = {
+                                       .op = RTE_CRYPTO_AUTH_OP_GENERATE,
+                                       .algo = RTE_CRYPTO_AUTH_SHA384_HMAC,
+                                       .key.length = 48,
+                                       .iv.length = 0,
+                                       .iv.offset = 0,
+                                       .digest_length = 48,
+                               },
+                       },
+                       .cipher = {
+                               .next = NULL,
+                               .type = RTE_CRYPTO_SYM_XFORM_CIPHER,
+                               .cipher = {
+                                       .op = RTE_CRYPTO_CIPHER_OP_ENCRYPT,
+                                       .algo = RTE_CRYPTO_CIPHER_AES_CBC,
+                                       .key.length = 32,
+                                       .iv.length = 16,
+                                       .iv.offset = IV_OFFSET,
+                               },
+                       },
+               },
+       },
+
+       .tls_record_xform = {
+               .ver = RTE_SECURITY_VERSION_TLS_1_2,
+               .type = RTE_SECURITY_TLS_SESS_TYPE_WRITE,
+               .tls_1_2.seq_no = 0x1,
+       },
+
+       .aead = false,
+       .app_type = 0x17,
+};
+
 struct tls_record_test_data tls_test_data_3des_cbc_sha1_hmac = {
        .key = {
                .data = {
-- 
2.25.1

Reply via email to