From patchwork Tue May 10 12:40:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tejasree Kondoj X-Patchwork-Id: 110973 X-Patchwork-Delegate: gakhil@marvell.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3188AA0093; Tue, 10 May 2022 13:45:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C9EB2406B4; Tue, 10 May 2022 13:45:02 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id A09A44069D for ; Tue, 10 May 2022 13:45:01 +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 24AA8NQu001861; Tue, 10 May 2022 04:45:00 -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=GGYfV3n2q9nEpNevLNYJNX2UDZ1RPSbtXKjztGYduvw=; b=IHmMcdr+/In7mRi5KsoNkxl5/TO2WLHolVWp5RgUUZ3BuJEXzrxJhBphWZa3cbfc+/Mu yBu3NuKIQ+tDrUfM4BgJ9CMECEDOWfW3LUD5bdlUSI5SKLHOg0orNsghuuOh/5Z4b3Ln 4ciBIPX3IiT5StcqJWHhX3+BmJGVneEK7zmAKoEwQjl8ZWX7lAhAq1oanyE+WbFX0XyB TS1B8OYTwJPqqlJ9uXIR+MpG+X5CmY+yzwDQpEBEHae+SwW9Is/3m5+D3oX2RdIzUvR9 VJ9LmfwnYlFcQ5C9q6oppZHuNDqF/oNnY2IdVcHwy88XB1WuMlehlyxshvSPIGgWT6Sv YA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3fyp1braqu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 10 May 2022 04:45:00 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 10 May 2022 04:44:59 -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, 10 May 2022 04:44:59 -0700 Received: from hyd1554T5810.caveonetworks.com.com (unknown [10.29.57.11]) by maili.marvell.com (Postfix) with ESMTP id F2F133F708A; Tue, 10 May 2022 04:44:56 -0700 (PDT) From: Tejasree Kondoj To: Akhil Goyal , Ciara Power CC: Tejasree Kondoj , Anoob Joseph , Fan Zhang , Subject: [PATCH] test/crypto-perf: allow auth generate followed by encryption Date: Tue, 10 May 2022 18:10:45 +0530 Message-ID: <20220510124045.22552-1-ktejasree@marvell.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 X-Proofpoint-GUID: vJILj5Xy0TS6hiPzbcT9vEIXVKJHHEpG X-Proofpoint-ORIG-GUID: vJILj5Xy0TS6hiPzbcT9vEIXVKJHHEpG X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.858,Hydra:6.0.486,FMLib:17.11.64.514 definitions=2022-05-10_01,2022-05-10_01,2022-02-23_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 Allowing auth generation followed by encryption mode. --optype auth-then-cipher can take cipher-op as encrypt and auth-op as generate now. Signed-off-by: Tejasree Kondoj Acked-by: Akhil Goyal --- app/test-crypto-perf/cperf_ops.c | 4 +++ app/test-crypto-perf/cperf_options_parsing.c | 30 ++++++++++++++------ 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/app/test-crypto-perf/cperf_ops.c b/app/test-crypto-perf/cperf_ops.c index cbefce8d6c..93d2744c68 100644 --- a/app/test-crypto-perf/cperf_ops.c +++ b/app/test-crypto-perf/cperf_ops.c @@ -458,6 +458,10 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops, } else sym_op->cipher.data.length = options->test_buffer_size; + if ((options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) && + (options->op_type == CPERF_AUTH_THEN_CIPHER)) + sym_op->cipher.data.length += options->digest_sz; + if (options->cipher_algo == RTE_CRYPTO_CIPHER_SNOW3G_UEA2 || options->cipher_algo == RTE_CRYPTO_CIPHER_KASUMI_F8 || options->cipher_algo == RTE_CRYPTO_CIPHER_ZUC_EEA3) diff --git a/app/test-crypto-perf/cperf_options_parsing.c b/app/test-crypto-perf/cperf_options_parsing.c index 09c98121c8..566255bf2d 100644 --- a/app/test-crypto-perf/cperf_options_parsing.c +++ b/app/test-crypto-perf/cperf_options_parsing.c @@ -1130,6 +1130,20 @@ check_docsis_buffer_length(struct cperf_options *options) } #endif +static bool +is_valid_chained_op(struct cperf_options *options) +{ + if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT && + options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) + return true; + + if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_DECRYPT && + options->auth_op == RTE_CRYPTO_AUTH_OP_VERIFY) + return true; + + return false; +} + int cperf_options_check(struct cperf_options *options) { @@ -1236,6 +1250,14 @@ cperf_options_check(struct cperf_options *options) return -EINVAL; } + if (options->op_type == CPERF_CIPHER_THEN_AUTH || + options->op_type == CPERF_AUTH_THEN_CIPHER) { + if (!is_valid_chained_op(options)) { + RTE_LOG(ERR, USER1, "Invalid chained operation.\n"); + return -EINVAL; + } + } + if (options->op_type == CPERF_CIPHER_THEN_AUTH) { if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_ENCRYPT && options->auth_op != @@ -1244,14 +1266,6 @@ cperf_options_check(struct cperf_options *options) " options: encrypt and generate.\n"); return -EINVAL; } - } else if (options->op_type == CPERF_AUTH_THEN_CIPHER) { - if (options->cipher_op != RTE_CRYPTO_CIPHER_OP_DECRYPT && - options->auth_op != - RTE_CRYPTO_AUTH_OP_VERIFY) { - RTE_LOG(ERR, USER1, "Option auth then cipher must use" - " options: decrypt and verify.\n"); - return -EINVAL; - } } if (options->op_type == CPERF_CIPHER_ONLY ||