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 E45B8A09E7; Wed, 19 Oct 2022 18:54:37 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5126D42C1E; Wed, 19 Oct 2022 18:54:33 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A6CFF42C15 for ; Wed, 19 Oct 2022 18:54:29 +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 29J8B0dG010462; Wed, 19 Oct 2022 09:54:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=VDCN6AHeBRJWR7P1fqPpk4dxbs4Cjb3gRHHdR8sOPNE=; b=f69caot+Kq52H0bXb0JKY3JkKAFHlSKMSzFVo2cvpQpBkkLvDmSd0PXIWF2SC/hGhnqL 28Nt/9VisaTOPECsh+T6VvoqKO7iEKCuhZ9eRMPSxdsuWH/PmWcUFPNs1ANNo9MdhdI4 eSDnmz+wPwsvBPlpXRMJelYLxNBadDi1KVZZcaXgyNElSWIkF1cUOX7mk2tF4twAzpsT rJF1tYxVDkJYiMlbf0q/cwOh/8hRV9gnHpoBC0b+3pIL+nEOpEbmL0iw7nvlZiS+Cwgj zOepbxLSSemcdghPSk/DybIKCYs49wdkCl93ApxrOTWSZO8D7SC6BckjuDeVbZ6LMduq OQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3kadg5a7bm-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 19 Oct 2022 09:54:28 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Wed, 19 Oct 2022 09:54:27 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Wed, 19 Oct 2022 09:54:27 -0700 Received: from hyd1554.marvell.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id 258F93F7097; Wed, 19 Oct 2022 09:54:24 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal , Fan Zhang , Ciara Power CC: Vidya Sagar Velumuri , Anoob Joseph , Subject: [PATCH 2/6] test/security: add unit tests for auth algo MD5 Date: Wed, 19 Oct 2022 22:24:14 +0530 Message-ID: <20221019165418.1970445-3-ktejasree@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221019165418.1970445-1-ktejasree@marvell.com> References: <20221019165418.1970445-1-ktejasree@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: wumorPxziO8SfeHZx9jrPB_MWziTFlhY X-Proofpoint-ORIG-GUID: wumorPxziO8SfeHZx9jrPB_MWziTFlhY X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.895,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2022-10-19_09,2022-10-19_04,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: Vidya Sagar Velumuri Add unit test cases for MD5 auth algo. Add the test vectors for MD5 auth algo. Signed-off-by: Vidya Sagar Velumuri --- app/test/test_cryptodev_security_ipsec.h | 6 + ...st_cryptodev_security_ipsec_test_vectors.h | 107 ++++++++++++++++++ app/test/test_security_inline_proto.c | 11 ++ 3 files changed, 124 insertions(+) diff --git a/app/test/test_cryptodev_security_ipsec.h b/app/test/test_cryptodev_security_ipsec.h index 95e86a05e0..9147d1c0d6 100644 --- a/app/test/test_cryptodev_security_ipsec.h +++ b/app/test/test_cryptodev_security_ipsec.h @@ -193,6 +193,12 @@ static const struct crypto_param auth_list[] = { .type = RTE_CRYPTO_SYM_XFORM_AUTH, .alg.auth = RTE_CRYPTO_AUTH_NULL, }, + { + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .alg.auth = RTE_CRYPTO_AUTH_MD5_HMAC, + .key_length = 12, + .digest_length = 12, + }, { .type = RTE_CRYPTO_SYM_XFORM_AUTH, .alg.auth = RTE_CRYPTO_AUTH_SHA256_HMAC, diff --git a/app/test/test_cryptodev_security_ipsec_test_vectors.h b/app/test/test_cryptodev_security_ipsec_test_vectors.h index 18ffceddce..2686bbeb62 100644 --- a/app/test/test_cryptodev_security_ipsec_test_vectors.h +++ b/app/test/test_cryptodev_security_ipsec_test_vectors.h @@ -633,6 +633,113 @@ struct ipsec_test_data pkt_aes_256_gcm_v6 = { }, }; +struct ipsec_test_data pkt_aes_128_cbc_md5 = { + .key = { + .data = { + 0x00, 0x04, 0x05, 0x01, 0x23, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x0a, 0x0b, 0x0c, 0x0f, 0x00, 0x00, + }, + }, + .auth_key = { + .data = { + 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, + 0x10, 0x30, 0x40, 0x00, 0x01, 0x02, 0x03, 0x04, + }, + }, + .input_text = { + .data = { + /* IP */ + 0x45, 0x00, 0x00, 0x32, 0x00, 0x01, 0x00, 0x00, + 0x1f, 0x11, 0x17, 0x8b, 0xc0, 0xa8, 0x01, 0x6f, + 0xc0, 0xa8, 0x01, 0x70, + + /* UDP */ + 0x00, 0x09, 0x00, 0x09, 0x00, 0x1e, 0x00, 0x00, + 0xbe, 0x9b, 0xe9, 0x55, 0x00, 0x00, 0x00, 0x21, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + }, + .len = 50, + }, + .output_text = { + .data = { + /* IP - outer header */ + 0x45, 0x00, 0x00, 0x78, 0x00, 0x01, 0x00, 0x00, + 0x40, 0x32, 0x52, 0x51, 0x14, 0x00, 0x00, 0x01, + 0x14, 0x00, 0x00, 0x02, + + /* ESP */ + 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x01, + + /* IV */ + 0x34, 0x12, 0x67, 0x45, 0xff, 0xff, 0x00, 0x00, + 0x20, 0xbf, 0xe8, 0x39, 0x00, 0x00, 0x00, 0x00, + + /* Data */ + 0x67, 0xb5, 0x46, 0x6e, 0x78, 0x17, 0xd3, 0x5a, + 0xac, 0x62, 0x62, 0x62, 0xb0, 0x57, 0x9b, 0x09, + 0x19, 0x4f, 0x06, 0x59, 0xc8, 0xb0, 0x30, 0x65, + 0x1f, 0x45, 0x57, 0x41, 0x72, 0x17, 0x28, 0xe9, + 0xad, 0x50, 0xbe, 0x44, 0x1d, 0x2d, 0x9a, 0xd0, + 0x48, 0x75, 0x0d, 0x1c, 0x8d, 0x24, 0xa8, 0x6f, + 0x6b, 0x24, 0xb6, 0x5d, 0x43, 0x1e, 0x55, 0xf0, + 0xf7, 0x14, 0x1f, 0xf2, 0x61, 0xd4, 0xe0, 0x30, + 0xff, 0xd7, 0x3f, 0xb4, 0x7c, 0x30, 0xdb, 0xeb, + 0xf3, 0x95, 0xbf, 0xcd, + }, + .len = 120, + }, + .iv = { + .data = { + 0x34, 0x12, 0x67, 0x45, 0xff, 0xff, 0x00, 0x00, + 0x20, 0xbf, 0xe8, 0x39, 0x00, 0x00, 0x00, 0x00, + }, + }, + + .ipsec_xform = { + .spi = 60, + .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, + .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 = false, + + .xform = { + .chain.cipher = { + .next = NULL, + .type = RTE_CRYPTO_SYM_XFORM_CIPHER, + .cipher = { + .op = RTE_CRYPTO_CIPHER_OP_ENCRYPT, + .algo = RTE_CRYPTO_CIPHER_AES_CBC, + .key.length = 16, + .iv.length = 16, + }, + }, + .chain.auth = { + .next = NULL, + .type = RTE_CRYPTO_SYM_XFORM_AUTH, + .auth = { + .op = RTE_CRYPTO_AUTH_OP_GENERATE, + .algo = RTE_CRYPTO_AUTH_MD5_HMAC, + .key.length = 16, + .digest_length = 12, + }, + }, + }, +}; + struct ipsec_test_data pkt_aes_128_cbc_hmac_sha256 = { .key = { .data = { diff --git a/app/test/test_security_inline_proto.c b/app/test/test_security_inline_proto.c index 289778d9be..feef54f538 100644 --- a/app/test/test_security_inline_proto.c +++ b/app/test/test_security_inline_proto.c @@ -71,6 +71,7 @@ extern struct ipsec_test_data pkt_des_cbc_hmac_sha256; extern struct ipsec_test_data pkt_des_cbc_hmac_sha384; extern struct ipsec_test_data pkt_des_cbc_hmac_sha512; extern struct ipsec_test_data pkt_des_cbc_hmac_sha256_v6; +extern struct ipsec_test_data pkt_aes_128_cbc_md5; static struct rte_mempool *mbufpool; static struct rte_mempool *sess_pool; @@ -2577,6 +2578,11 @@ static struct unit_test_suite inline_ipsec_testsuite = { "Outbound known vector (ESP tunnel mode IPv4 AES-GCM 256)", ut_setup_inline_ipsec, ut_teardown_inline_ipsec, test_ipsec_inline_proto_known_vec, &pkt_aes_256_gcm), + TEST_CASE_NAMED_WITH_DATA( + "Outbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])", + ut_setup_inline_ipsec, ut_teardown_inline_ipsec, + test_ipsec_inline_proto_known_vec, + &pkt_aes_128_cbc_md5), TEST_CASE_NAMED_WITH_DATA( "Outbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])", ut_setup_inline_ipsec, ut_teardown_inline_ipsec, @@ -2669,6 +2675,11 @@ static struct unit_test_suite inline_ipsec_testsuite = { "Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128)", ut_setup_inline_ipsec, ut_teardown_inline_ipsec, test_ipsec_inline_proto_known_vec_inb, &pkt_aes_128_cbc_null), + TEST_CASE_NAMED_WITH_DATA( + "Inbound known vector (ESP tunnel mode IPv4 AES-CBC MD5 [12B ICV])", + ut_setup_inline_ipsec, ut_teardown_inline_ipsec, + test_ipsec_inline_proto_known_vec_inb, + &pkt_aes_128_cbc_md5), TEST_CASE_NAMED_WITH_DATA( "Inbound known vector (ESP tunnel mode IPv4 AES-CBC 128 HMAC-SHA256 [16B ICV])", ut_setup_inline_ipsec, ut_teardown_inline_ipsec, -- 2.25.1