@@ -15292,6 +15292,10 @@ static struct unit_test_suite ipsec_proto_testsuite = {
"Outbound known vector (ESP tunnel mode IPv4 AES-GCM 256)",
ut_setup_security, ut_teardown,
test_ipsec_proto_known_vec, &pkt_aes_256_gcm),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Outbound known vector (ESP tunnel mode IPv4 AES-CCM 256)",
+ ut_setup_security, ut_teardown,
+ test_ipsec_proto_known_vec, &pkt_aes_256_ccm),
TEST_CASE_NAMED_WITH_DATA(
"Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])",
ut_setup_security, ut_teardown,
@@ -15353,6 +15357,10 @@ static struct unit_test_suite ipsec_proto_testsuite = {
"Inbound known vector (ESP tunnel mode IPv4 AES-GCM 256)",
ut_setup_security, ut_teardown,
test_ipsec_proto_known_vec_inb, &pkt_aes_256_gcm),
+ TEST_CASE_NAMED_WITH_DATA(
+ "Inbound known vector (ESP tunnel mode IPv4 AES-CCM 256)",
+ ut_setup_security, ut_teardown,
+ test_ipsec_proto_known_vec_inb, &pkt_aes_256_ccm),
TEST_CASE_NAMED_WITH_DATA(
"Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)",
ut_setup_security, ut_teardown,
@@ -392,6 +392,9 @@ test_ipsec_td_prepare(const struct crypto_param *param1,
else
memcpy(td, &pkt_aes_256_gcm, sizeof(*td));
+ if (param1->alg.aead == RTE_CRYPTO_AEAD_AES_CCM)
+ td->salt.len = 3;
+
td->aead = true;
td->xform.aead.aead.algo = param1->alg.aead;
td->xform.aead.aead.key.length = param1->key_length;
@@ -132,6 +132,11 @@ static const struct crypto_param aead_list[] = {
{
.type = RTE_CRYPTO_SYM_XFORM_AEAD,
.alg.aead = RTE_CRYPTO_AEAD_AES_GCM,
+ .key_length = 32,
+ },
+ {
+ .type = RTE_CRYPTO_SYM_XFORM_AEAD,
+ .alg.aead = RTE_CRYPTO_AEAD_AES_CCM,
.key_length = 32
},
};
@@ -325,6 +325,107 @@ struct ipsec_test_data pkt_aes_256_gcm = {
},
};
+struct ipsec_test_data pkt_aes_256_ccm = {
+ .key = {
+ .data = {
+ 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67, 0x68,
+ 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f, 0x70,
+ 0x61, 0x62, 0x63, 0x64, 0x61, 0x62, 0x63, 0x64,
+ 0x65, 0x66, 0x67, 0x68, 0x69, 0x6a, 0x6b, 0x6c,
+ },
+ },
+ .input_text = {
+ .data = {
+ /* IP */
+ 0x45, 0x00, 0x00, 0x2E, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x11, 0x5F, 0xBC, 0x0D, 0x00, 0x00, 0x02,
+ 0x0E, 0x00, 0x00, 0x01,
+
+ /* UDP */
+ 0x04, 0x01, 0x04, 0x01, 0x00, 0x1A, 0xA0, 0x79,
+ 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
+ 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78, 0x78,
+ 0x78, 0x78,
+ },
+ .len = 46,
+ },
+ .output_text = {
+ .data = {
+ /* IP - outer header */
+ 0x45, 0x00, 0x00, 0x64, 0x00, 0x01, 0x00, 0x00,
+ 0x40, 0x32, 0x76, 0x65, 0x02, 0x00, 0x00, 0x01,
+ 0x02, 0x00, 0x00, 0x02,
+
+ /* ESP */
+ 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01,
+
+ /* IV */
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0xBB, 0x81,
+
+ /* Data */
+ 0xB4, 0x12, 0x67, 0x79, 0x79, 0x9A, 0xCB, 0xC5,
+ 0x94, 0xF9, 0xA3, 0x95, 0xAC, 0x06, 0x8B, 0xEE,
+ 0x20, 0x69, 0xE8, 0xD9, 0x4A, 0xC2, 0xAA, 0xA0,
+ 0xD4, 0xEE, 0xF6, 0xAE, 0x08, 0xF8, 0x3F, 0xE6,
+ 0x88, 0x1F, 0x5C, 0xD7, 0x8D, 0x9D, 0x30, 0x02,
+ 0x36, 0xEA, 0x10, 0x5B, 0xB0, 0x30, 0x97, 0xBF,
+ 0xFA, 0x89, 0x36, 0x53, 0x96, 0xD7, 0x43, 0x8C,
+ 0x4D, 0x87, 0xFD, 0x8E, 0x45, 0x49, 0x34, 0x80,
+ },
+ .len = 100,
+ },
+ .salt = {
+ .data = {
+ 0x6d, 0x6e, 0x6f
+ },
+ .len = 3,
+ },
+
+ .iv = {
+ .data = {
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x58, 0xBB, 0x81,
+ },
+ },
+
+ .ipsec_xform = {
+ .spi = 0x00000100,
+ .options.esn = 0,
+ .options.udp_encap = 0,
+ .options.copy_dscp = 0,
+ .options.copy_flabel = 0,
+ .options.copy_df = 0,
+ .options.dec_ttl = 0,
+ .options.ecn = 0,
+ .options.stats = 0,
+ .options.tunnel_hdr_verify = 0,
+ .options.ip_csum_enable = 0,
+ .options.l4_csum_enable = 0,
+ .direction = RTE_SECURITY_IPSEC_SA_DIR_EGRESS,
+ .proto = RTE_SECURITY_IPSEC_SA_PROTO_ESP,
+ .mode = RTE_SECURITY_IPSEC_SA_MODE_TUNNEL,
+ .tunnel.type = RTE_SECURITY_IPSEC_TUNNEL_IPV4,
+ .replay_win_sz = 0,
+ },
+
+ .aead = true,
+
+ .xform = {
+ .aead = {
+ .next = NULL,
+ .type = RTE_CRYPTO_SYM_XFORM_AEAD,
+ .aead = {
+ .op = RTE_CRYPTO_AEAD_OP_ENCRYPT,
+ .algo = RTE_CRYPTO_AEAD_AES_CCM,
+ .key.length = 32,
+ .iv.length = 12,
+ .iv.offset = IV_OFFSET,
+ .digest_length = 16,
+ .aad_length = 12,
+ },
+ },
+ },
+};
+
/* Known vectors for AES-CBC
* https://datatracker.ietf.org/doc/html/rfc3602#section-4
*/