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 337684381B; Fri, 5 Jan 2024 01:04:05 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B6DEE402E0; Fri, 5 Jan 2024 01:04:00 +0100 (CET) Received: from NAM10-MW2-obe.outbound.protection.outlook.com (mail-mw2nam10on2055.outbound.protection.outlook.com [40.107.94.55]) by mails.dpdk.org (Postfix) with ESMTP id 9172A40267 for ; Fri, 5 Jan 2024 01:03:58 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=fTHuU2LVF5RMEKwxj6yiFgDe5JwvRpN4raZTw1s7n8LXVAlwEVVZHkrmHMG/XhEb4Jn0dXWLViYy4kB8B/jqMsbc6+FcHir3sTll3LB4PMoA5m20OQ+lrkg0ilLuP2iy3UjK0TTMRTUAlHsj91+jTSwcVp77dM/B14wYni/09BlOAyfttm91kgjSBqRaLMQy8WUreKEt/a5N0mv6FYiyPWuhMWCYJL+VtcHbh10tgI0EzeXyygTVAWEvdld6SrItlRHaJvXmm6yPlryVGqacIgJQ6PYcUKGzX2CsrEtyoObmX+MmDdB9ftJMg2N1jP7+5AKoJG6xRIlXLF7bIO8GHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=UrQ1HFRL80K0tK/9Abm8Iv+BZPYLMqKUfYS8+JjehHo=; b=OCpDsb//F+52fa4M1u2hNEMrzDy7iEJWv8pO3wBw0QlEPppgZx0xVQVE6Xfr7y0PoJFRvNJTb7owqn/yaIkN4xL5gJAwsF/Jd7J807rBsitcQOWThMIMrIE/YIjFWaq31ldK8/lBsjKuVwXucvggWwC6Y3lOga2MshiEIi7UCLdLjtss0AdyLbjsfb2OosXtZHaO1oNVaUwlZw6MyLz4vvSvIr/LA1y9D5HOigGcZrlSrtGWGEeK5y7gbg5INMUwG93o5MMfLo8aP7AbI0pauIp7GEyiBs5K6BIIKKEq1NfzdWAg3nolOsmviYum8u1o9qY1kDG9fbUhNnWtndudsQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.117.161) smtp.rcpttodomain=marvell.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UrQ1HFRL80K0tK/9Abm8Iv+BZPYLMqKUfYS8+JjehHo=; b=kK3xtlPWZnz/prvSI6SB3tgruQpKAjwkRKh7PCTCmxfRGyJ4e8lu6BG2hkZaHPa4OkFtg5YiIcl10dsH+YDLwWRHoS1CWlf/ZR6ZScFP3QqxZKBsZrkHP9hZqnbKebOODriOPIUAEdv2sOWczHDVnagkbFrTaRL8eNS9g4AtQKg7RAVMrUYaDvbf+aNh2euC5lddnSYgMxn4zuHlKKGhWw6+t/RcLEwmrvJOXWJ71Gcne05y3qsvvOP2BmfZoTki+/uRl7HjmRKrQK5GX39qFiLo3f/7w27yCCDT+2kSe4qvEw18nYr1x+tE3JvBLMausgzLV10RJDTBMrLEuIYkSw== Received: from MW4PR03CA0109.namprd03.prod.outlook.com (2603:10b6:303:b7::24) by CH2PR12MB4039.namprd12.prod.outlook.com (2603:10b6:610:a8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16; Fri, 5 Jan 2024 00:03:55 +0000 Received: from CO1PEPF000044F9.namprd21.prod.outlook.com (2603:10b6:303:b7:cafe::c2) by MW4PR03CA0109.outlook.office365.com (2603:10b6:303:b7::24) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.16 via Frontend Transport; Fri, 5 Jan 2024 00:03:55 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.117.161) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.117.161 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.117.161; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.117.161) by CO1PEPF000044F9.mail.protection.outlook.com (10.167.241.199) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.1 via Frontend Transport; Fri, 5 Jan 2024 00:03:55 +0000 Received: from rnnvmail201.nvidia.com (10.129.68.8) by mail.nvidia.com (10.129.200.67) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 4 Jan 2024 16:03:44 -0800 Received: from nvidia.com (10.126.230.35) by rnnvmail201.nvidia.com (10.129.68.8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Thu, 4 Jan 2024 16:03:42 -0800 From: Suanming Mou To: , CC: Subject: [PATCH v2 2/2] app/test-crypto-perf: fix encrypt operation verify Date: Fri, 5 Jan 2024 08:03:23 +0800 Message-ID: <20240105000323.903764-2-suanmingm@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240105000323.903764-1-suanmingm@nvidia.com> References: <20240103035605.720256-1-suanmingm@nvidia.com> <20240105000323.903764-1-suanmingm@nvidia.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.126.230.35] X-ClientProxiedBy: rnnvmail203.nvidia.com (10.129.68.9) To rnnvmail201.nvidia.com (10.129.68.8) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044F9:EE_|CH2PR12MB4039:EE_ X-MS-Office365-Filtering-Correlation-Id: 7efe8e29-db3a-4382-f392-08dc0d81ceef X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: yqty5HXSXkZIqqpomW1y7VfAk+1yL3fFqkuGORKzmOrdGOj33ldWtoc7m+9ty/v7gXuO/YGl8CswhJPsp5XChTfo7+WjC2MVhlXfbiHzNrUymDQ/YgWDpg1KqIj7AustbySotCWPU7EfrbhfmyG7kYe7fvEPk+liTdlsEwL78zz+jvh5tAwSwF3apulYWg0bG90hbrLUw4Fu1dbLxq0zOP44cOud9piYIgZodo3lR9cY90+5Lh+Mine/CQhMEHRrPY5/sRFwH949txuFI0ZYS6BnlBpz2QxpN2KY1SLXFJLkpYz/VTadPY4S9A8xHzn/vS1Wk16ZsClkXdn1P/2Vz9b5+yYnAJ3sw8dIq1JXbo7Xe33CN2MLWUrRfo8KFlAs5bxFITHx1VHqHLdyLIUWgQB7BvkPOA2G5Iw+Z5lk8o5522e01bzkKixcREf0hDMcPTLKbF+eylf4/cQXE88iBMoH1UvUKNkAaL5Cbk0LCEI3SzlQpaN/SyvykREJDm/k/jzKo54DlHRhL2P0XH04RtK8ePGvylI2c9BtqKml6dGUpdBNOiN6W6Wr5wl3tLQAP/+7zCl1tj+EAkz6tTfUEVNC3gwnln8aIqyOBaeUaOK46yRwcgD/ZsCRUYuVI7BnVbHOVJy6/cOPX6pjMPe9RoV1lcNABZwzkwrfyQwpPinXgDKGVYnC/OvomelhjyTMWj30xgtfpQw4e4RlDOnj9a0UdLMXEQ8e89c9FNZZFhaw/4sSORzr+NWsz4hyrk7+3yeH4kN0nqvK86xt+5zUFA== X-Forefront-Antispam-Report: CIP:216.228.117.161; CTRY:US; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:mail.nvidia.com; PTR:dc6edge2.nvidia.com; CAT:NONE; SFS:(13230031)(4636009)(39860400002)(346002)(136003)(376002)(396003)(230922051799003)(451199024)(1800799012)(82310400011)(186009)(64100799003)(40470700004)(36840700001)(46966006)(36860700001)(70586007)(70206006)(8676002)(8936002)(36756003)(110136005)(82740400003)(4326008)(316002)(6666004)(478600001)(41300700001)(83380400001)(7696005)(2616005)(336012)(6286002)(16526019)(426003)(1076003)(26005)(47076005)(15650500001)(5660300002)(2906002)(356005)(7636003)(55016003)(86362001)(40480700001)(40460700003)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 00:03:55.2760 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7efe8e29-db3a-4382-f392-08dc0d81ceef X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a; Ip=[216.228.117.161]; Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044F9.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH2PR12MB4039 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 AEAD uses RTE_CRYPTO_AEAD_OP_* with aead_op and CIPHER uses RTE_CRYPTO_CIPHER_OP_* with cipher_op in current code. This commit aligns aead_op and cipher_op operation to fix incorrect AEAD verification. Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type") Signed-off-by: Suanming Mou --- v2: align auth/cipher to bool. --- app/test-crypto-perf/cperf_test_verify.c | 55 ++++++++++++------------ 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index 8aa714b969..2b0d3f142b 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -111,8 +111,10 @@ cperf_verify_op(struct rte_crypto_op *op, uint32_t len; uint16_t nb_segs; uint8_t *data; - uint32_t cipher_offset, auth_offset; - uint8_t cipher, auth; + uint32_t cipher_offset, auth_offset = 0; + bool cipher = false; + bool digest_verify = false; + bool is_encrypt = false; int res = 0; if (op->status != RTE_CRYPTO_OP_STATUS_SUCCESS) @@ -150,42 +152,43 @@ cperf_verify_op(struct rte_crypto_op *op, switch (options->op_type) { case CPERF_CIPHER_ONLY: - cipher = 1; + cipher = true; cipher_offset = 0; - auth = 0; - auth_offset = 0; - break; - case CPERF_CIPHER_THEN_AUTH: - cipher = 1; - cipher_offset = 0; - auth = 1; - auth_offset = options->test_buffer_size; + is_encrypt = options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT; break; case CPERF_AUTH_ONLY: - cipher = 0; cipher_offset = 0; - auth = 1; - auth_offset = options->test_buffer_size; + if (options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) { + auth_offset = options->test_buffer_size; + digest_verify = true; + } break; + case CPERF_CIPHER_THEN_AUTH: case CPERF_AUTH_THEN_CIPHER: - cipher = 1; + cipher = true; cipher_offset = 0; - auth = 1; - auth_offset = options->test_buffer_size; + if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) { + auth_offset = options->test_buffer_size; + digest_verify = true; + is_encrypt = true; + } break; case CPERF_AEAD: - cipher = 1; + cipher = true; cipher_offset = 0; - auth = 1; - auth_offset = options->test_buffer_size; + if (options->aead_op == RTE_CRYPTO_AEAD_OP_ENCRYPT) { + auth_offset = options->test_buffer_size; + digest_verify = true; + is_encrypt = true; + } break; default: res = 1; goto out; } - if (cipher == 1) { - if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) + if (cipher) { + if (is_encrypt) res += !!memcmp(data + cipher_offset, vector->ciphertext.data, options->test_buffer_size); @@ -195,12 +198,8 @@ cperf_verify_op(struct rte_crypto_op *op, options->test_buffer_size); } - if (auth == 1) { - if (options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) - res += !!memcmp(data + auth_offset, - vector->digest.data, - options->digest_sz); - } + if (digest_verify) + res += !!memcmp(data + auth_offset, vector->digest.data, options->digest_sz); out: rte_free(data); -- 2.34.1