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 34507A0C46; Mon, 16 Aug 2021 08:00:51 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 891784114C; Mon, 16 Aug 2021 08:00:48 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 195FA41123 for ; Mon, 16 Aug 2021 08:00:46 +0200 (CEST) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.16.1.2/8.16.0.43) with SMTP id 17FMSmSm017193; Sun, 15 Aug 2021 23:00:46 -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=E4RHCop3usnpjvFIhtaN0++JUxMBFZT3Quvk8sESZzE=; b=ZZQxbSwUMPu8qqw+jSYALFIH/rP4r6+kLY1asSeHO3b1pB2/g0hPyjGOAyFQSzLQDTqZ xbf7VJmNXGDtgVfUQh4Z+GdE5fXSRsscvF9Obc7XoDxF9kzarkty50+U03Km5JfTuc5S yb6DBaJDKCgrHPXjHzAsGV4XEFg9eSwK1BRtGbQZVUS+4x9UPF2GN/RSA5TVNL5esBtP f20frnsGGAshbFv+s6MAwclU7wcGNLUq849i4MN8M50CJMtWgvGpiqgNB5Xi1oauTBz6 Xj2Qj9epAeZPMZdFid72ZYFkLWl1Lvvf8Ld3q7e1g1L2/oYqJbm8KQy44/ttiSrMNj+o kg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com with ESMTP id 3af0pthwjx-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Sun, 15 Aug 2021 23:00:46 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sun, 15 Aug 2021 23:00:44 -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.18 via Frontend Transport; Sun, 15 Aug 2021 23:00:44 -0700 Received: from HY-LT1002.marvell.com (unknown [10.193.36.215]) by maili.marvell.com (Postfix) with ESMTP id 7A2C85B695C; Sun, 15 Aug 2021 23:00:39 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Declan Doherty , Fan Zhang , "Konstantin Ananyev" CC: Anoob Joseph , Jerin Jacob , Archana Muniganti , Tejasree Kondoj , Hemant Agrawal , "Radu Nicolau" , Ciara Power , Date: Mon, 16 Aug 2021 11:29:50 +0530 Message-ID: <1629093590-115-4-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1629093590-115-1-git-send-email-anoobj@marvell.com> References: <1629093590-115-1-git-send-email-anoobj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: hILn4-f6laIHowfD4Vu4S9DSvBDh5i83 X-Proofpoint-ORIG-GUID: hILn4-f6laIHowfD4Vu4S9DSvBDh5i83 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-08-16_02,2021-08-13_02,2020-04-07_01 Subject: [dpdk-dev] [PATCH 3/3] test/crypto: add outbound known vector tests 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 Sender: "dev" Add outbound known vector tests. The tests would be skipped on PMDs which do not support IV provided by application. Signed-off-by: Anoob Joseph Signed-off-by: Tejasree Kondoj --- app/test/test_cryptodev.c | 44 ++++++++++++++++++++++++++++++++ app/test/test_cryptodev_security_ipsec.c | 16 +++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 71e6c1a..dfc49e0 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -8975,6 +8975,22 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], ut_params->op->sym->m_src = ut_params->ibuf; ut_params->op->sym->m_dst = NULL; + /* Copy IV in crypto operation when IV generation is disabled */ + if (dir == RTE_SECURITY_IPSEC_SA_DIR_EGRESS && + ipsec_xform.options.iv_gen_disable == 1) { + uint8_t *iv = rte_crypto_op_ctod_offset(ut_params->op, + uint8_t *, + IV_OFFSET); + int len; + + if (td[i].aead) + len = td[i].xform.aead.aead.iv.length; + else + len = td[i].xform.chain.cipher.cipher.iv.length; + + memcpy(iv, td[i].iv.data, len); + } + /* Process crypto operation */ process_crypto_request(dev_id, ut_params->op); @@ -9012,6 +9028,22 @@ test_ipsec_proto_process(const struct ipsec_test_data td[], } static int +test_ipsec_proto_known_vec(const void *test_data) +{ + struct ipsec_test_data td_outb; + struct ipsec_test_flags flags; + + memset(&flags, 0, sizeof(flags)); + + memcpy(&td_outb, test_data, sizeof(td_outb)); + + /* Disable IV gen to be able to test with known vectors */ + td_outb.ipsec_xform.options.iv_gen_disable = 1; + + return test_ipsec_proto_process(&td_outb, NULL, 1, false, &flags); +} + +static int test_ipsec_proto_known_vec_inb(const void *td_outb) { struct ipsec_test_flags flags; @@ -14003,6 +14035,18 @@ static struct unit_test_suite ipsec_proto_testsuite = { .setup = ipsec_proto_testsuite_setup, .unit_test_cases = { TEST_CASE_NAMED_WITH_DATA( + "Outbound known vector (ESP tunnel mode IPv4 AES-GCM 128)", + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, &pkt_aes_128_gcm), + TEST_CASE_NAMED_WITH_DATA( + "Outbound known vector (ESP tunnel mode IPv4 AES-GCM 192)", + ut_setup_security, ut_teardown, + test_ipsec_proto_known_vec, &pkt_aes_192_gcm), + TEST_CASE_NAMED_WITH_DATA( + "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( "Inbound known vector (ESP tunnel mode IPv4 AES-GCM 128)", ut_setup_security, ut_teardown, test_ipsec_proto_known_vec_inb, &pkt_aes_128_gcm), diff --git a/app/test/test_cryptodev_security_ipsec.c b/app/test/test_cryptodev_security_ipsec.c index 78c7f3a..a0b37e7 100644 --- a/app/test/test_cryptodev_security_ipsec.c +++ b/app/test/test_cryptodev_security_ipsec.c @@ -76,6 +76,15 @@ test_ipsec_sec_caps_verify(struct rte_security_ipsec_xform *ipsec_xform, return -ENOTSUP; } + if ((ipsec_xform->direction == RTE_SECURITY_IPSEC_SA_DIR_EGRESS) && + (ipsec_xform->options.iv_gen_disable == 1) && + (sec_cap->ipsec.options.iv_gen_disable != 1)) { + if (!silent) + RTE_LOG(INFO, USER1, + "Application provided IV is not supported\n"); + return -ENOTSUP; + } + return 0; } @@ -160,9 +169,11 @@ test_ipsec_td_prepare(const struct crypto_param *param1, td->xform.aead.aead.algo = param1->alg.aead; td->xform.aead.aead.key.length = param1->key_length; + + if (flags->iv_gen) + td->ipsec_xform.options.iv_gen_disable = 0; } - RTE_SET_USED(flags); RTE_SET_USED(param2); } @@ -183,6 +194,9 @@ test_ipsec_td_update(struct ipsec_test_data td_inb[], int icv_pos = td_inb[i].input_text.len - 4; td_inb[i].input_text.data[icv_pos] += 1; } + + /* Clear outbound specific flags */ + td_inb[i].ipsec_xform.options.iv_gen_disable = 0; } } -- 2.7.4