From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 45983A00C4; Tue, 26 Jul 2022 12:16:28 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E664A40DDD; Tue, 26 Jul 2022 12:16:27 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 6FC5640695 for ; Tue, 26 Jul 2022 12:16:26 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.5/8.17.1.5) with ESMTP id 26Q12g2m009599; Tue, 26 Jul 2022 03:16:25 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=GNtxvopzrpRDVXLxYYJ6aYtT4Px2siSVK37K3Bx9/Ag=; b=LPM26QKLGx88IDs6PjrsB0bLOyjob7XcH6p6ykCpc6Hw84DQp8gVTZX2lvUtT1bkWDQu IN/kgxxPqe4LuuruWnOHslxEkNp3eacOsTfPvAV4eEB9DKmkt8EZmxBL2OFYdBDNJAiJ pGpzTKtXMghm4ow+OmIXjbbsJLZRdzX/sWjN9dzBt8dxG9Ep2diAouh533NVaxkP3Wux kvnJ3RQNvBoQskxQ/9dRSvAw5J23xWqxTM4P7paAwyjwxkz4+W3jPGLdwWe6uaYLEVqx dCEdgiGx+LgHvamoLshJ8U1IYNees+ClsxRiE6YcKlv0LMUdDGyP23GEuiwGnCN4vrB3 qg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3hj68j1my1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 26 Jul 2022 03:16:25 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Tue, 26 Jul 2022 03:16:23 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.18 via Frontend Transport; Tue, 26 Jul 2022 03:16:23 -0700 Received: from BG-LT92004.corp.innovium.com (unknown [10.28.160.62]) by maili.marvell.com (Postfix) with ESMTP id E90A33F7044; Tue, 26 Jul 2022 03:16:19 -0700 (PDT) From: Anoob Joseph To: , CC: Archana Muniganti , , , , , Subject: [PATCH] test/crypto: add AES-CCM test vectors Date: Tue, 26 Jul 2022 15:46:19 +0530 Message-ID: <20220726101619.1992-1-anoobj@marvell.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: aWQq7D0xiRuK6_SazGMCtDJGdqCQd3ao X-Proofpoint-GUID: aWQq7D0xiRuK6_SazGMCtDJGdqCQd3ao X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.883,Hydra:6.0.517,FMLib:17.11.122.1 definitions=2022-07-26_02,2022-07-26_01,2022-06-22_01 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org From: Archana Muniganti Added ESP tunnel mode known vectors for AES-CCM along with combined mode support. Signed-off-by: Archana Muniganti --- app/test/test_cryptodev.c | 8 ++ app/test/test_cryptodev_security_ipsec.c | 3 + app/test/test_cryptodev_security_ipsec.h | 5 + ...st_cryptodev_security_ipsec_test_vectors.h | 101 ++++++++++++++++++ 4 files changed, 117 insertions(+) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 69a0301de0..ee566a4ee3 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -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, diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c index 6086055af1..3f691f0f56 100644 --- a/app/test/test_cryptodev_security_ipsec.c +++ b/app/test/test_cryptodev_security_ipsec.c @@ -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; diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h index 744dd64a9e..02b08f9f95 100644 --- a/app/test/test_cryptodev_security_ipsec.h +++ b/app/test/test_cryptodev_security_ipsec.h @@ -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 }, }; diff --git a/app/test/test_cryptodev_security_ipsec_test_vectors.h b/app/test/test_cryptodev_security_ipsec_test_vectors.h index 5c5b0445ee..5f775a241a 100644 --- a/app/test/test_cryptodev_security_ipsec_test_vectors.h +++ b/app/test/test_cryptodev_security_ipsec_test_vectors.h @@ -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 */ -- 2.25.1