From patchwork Wed Mar 1 16:39:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Power, Ciara" X-Patchwork-Id: 124614 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 77A2841DAC; Wed, 1 Mar 2023 17:39:52 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 881E542D12; Wed, 1 Mar 2023 17:39:33 +0100 (CET) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mails.dpdk.org (Postfix) with ESMTP id E7D6542BFE; Wed, 1 Mar 2023 17:39:30 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1677688771; x=1709224771; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=HZNV2s4VSJPyxR30T2QPRfkC/IAL0e/+9Viap4Q5tk8=; b=dilqwbTe8ud4d6pUoFHz1rtlvDCSRHxY7nEEhglDXhRxZ4FXcYIz7sj4 IgQB9J6dMDaA6ohc1Lyi0MGWqCiJsLspIivl6IXORR7LSgXbHq5ZSWY0F VdwUH4wJ2p3/Vf2fJy9BMIeDhxW6KzNawKR7ux621R+Mcfb6vgiIYF7Sl yv8icfmEGXGi0qlvatKKUnyyZ1HlFr7+KFDuB3GTCdt8QNhwBeGZry1v0 lTiZ8zti1I7D0M0liCwv8kZnf8EIprMHUDF6UJkoxrhl6FNmDF6xPODgc NknYjJYDpBaHRt3uuwGOdytDIaJsOij8fCX2MUKJYSorO5jST69jGj9Fn A==; X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="362039483" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="362039483" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Mar 2023 08:39:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10636"; a="667922853" X-IronPort-AV: E=Sophos;i="5.98,225,1673942400"; d="scan'208";a="667922853" Received: from silpixa00400355.ir.intel.com (HELO silpixa00400355.ger.corp.intel.com) ([10.237.222.80]) by orsmga007.jf.intel.com with ESMTP; 01 Mar 2023 08:39:27 -0800 From: Ciara Power To: Akhil Goyal , Fan Zhang Cc: dev@dpdk.org, kai.ji@intel.com, pablo.de.lara.guarch@intel.com, Ciara Power , stable@dpdk.org Subject: [PATCH 4/5] test/crypto: fix capability check for ZUC cipher auth Date: Wed, 1 Mar 2023 16:39:15 +0000 Message-Id: <20230301163916.2248543-5-ciara.power@intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230301163916.2248543-1-ciara.power@intel.com> References: <20230301163916.2248543-1-ciara.power@intel.com> MIME-Version: 1.0 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 The cipher-auth test function for ZUC was not using the improved cipher and auth capability check functions. This meant the required key and IV lengths were not being checked, leading to problems with ZUC256 tests running, and failing, on devices that only support ZUC128. Fixes: 27b787132484 ("test/crypto: check cipher parameters") Fixes: f93fce6de4aa ("test/crypto: check auth parameters") Cc: pablo.de.lara.guarch@intel.com Cc: stable@dpdk.org Signed-off-by: Ciara Power --- app/test/test_cryptodev.c | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/app/test/test_cryptodev.c b/app/test/test_cryptodev.c index 9b90bae206..80e98ed2c7 100644 --- a/app/test/test_cryptodev.c +++ b/app/test/test_cryptodev.c @@ -136,6 +136,17 @@ security_proto_supported(enum rte_security_session_action_type action, static int dev_configure_and_start(uint64_t ff_disable); +static int +check_cipher_capability(const struct crypto_testsuite_params *ts_params, + const enum rte_crypto_cipher_algorithm cipher_algo, + const uint16_t key_size, const uint16_t iv_size); + +static int +check_auth_capability(const struct crypto_testsuite_params *ts_params, + const enum rte_crypto_auth_algorithm auth_algo, + const uint16_t key_size, const uint16_t iv_size, + const uint16_t tag_size); + static struct rte_mbuf * setup_test_string(struct rte_mempool *mpool, const char *string, size_t len, uint8_t blocksize) @@ -4761,7 +4772,6 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata) unsigned int plaintext_len; struct rte_cryptodev_info dev_info; - struct rte_cryptodev_sym_capability_idx cap_idx; rte_cryptodev_info_get(ts_params->valid_devs[0], &dev_info); uint64_t feat_flags = dev_info.feature_flags; @@ -4783,19 +4793,14 @@ test_zuc_cipher_auth(const struct wireless_test_data *tdata) return TEST_SKIPPED; /* Check if device supports ZUC EEA3 */ - cap_idx.type = RTE_CRYPTO_SYM_XFORM_CIPHER; - cap_idx.algo.cipher = RTE_CRYPTO_CIPHER_ZUC_EEA3; - - if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], - &cap_idx) == NULL) + if (check_cipher_capability(ts_params, RTE_CRYPTO_CIPHER_ZUC_EEA3, + tdata->key.len, tdata->cipher_iv.len) < 0) return TEST_SKIPPED; /* Check if device supports ZUC EIA3 */ - cap_idx.type = RTE_CRYPTO_SYM_XFORM_AUTH; - cap_idx.algo.auth = RTE_CRYPTO_AUTH_ZUC_EIA3; - - if (rte_cryptodev_sym_capability_get(ts_params->valid_devs[0], - &cap_idx) == NULL) + if (check_auth_capability(ts_params, RTE_CRYPTO_AUTH_ZUC_EIA3, + tdata->key.len, tdata->auth_iv.len, + tdata->digest.len) < 0) return TEST_SKIPPED; /* Create ZUC session */