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 91A744381B; Fri, 5 Jan 2024 01:03:59 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2A2E1402AC; Fri, 5 Jan 2024 01:03:59 +0100 (CET) Received: from NAM12-MW2-obe.outbound.protection.outlook.com (mail-mw2nam12on2073.outbound.protection.outlook.com [40.107.244.73]) by mails.dpdk.org (Postfix) with ESMTP id D3EB940267 for ; Fri, 5 Jan 2024 01:03:56 +0100 (CET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dVQSA0qrGVcb421bKrk2oG/KCSJvnSWgcThSOw37qfKNyi/0niTu0zqS2YW63dyRofWbJc5NchxdNNzD4EIPR+HOXe+R4mNfM9HTSf6Wfj8yvmP8jCs6k7XT4woh5TrMTh/g6geSuAaR9TZMq98SSXoyePySLtYBma5Df5eEBgl+ludKtxksNsTquxphJPRwr4guW/g1PM0gqLOHWjFNqdkRfhC4silzAgtRWUVH4NHe6iXnNfqztRHLoTJF4+UWktA61VqNRwyeXF+FIUluOBIhnMJw4NdOS2KlFO/XQ/6zYdlxeHa5E5FRXr3ZSe4M9n8tzJEMfhYesURxA8pXFg== 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=i59gvOtga3vrGXUxwoyG6+WRPzzPu2iYNqQKOBz+ngU=; b=TqpssOoSLE8owNjxX82vTZKwtGD84T3f8wey39yuZgZ2ie8FWP51z59JRzmckzlHKKw7CjPqWlAE3P3bakDlPQhJQfCZw0YloqP9N82gnAIDw6VowaYv5ePeasqa7VmbpmOpJHyOXDX316JLokufkytrbR2u/m6P6GhVGSVyqS4KyU6OlUgF+KE65iwRa/VrA/Y/2CUGkqkvjxBeh/dgx6C2Z3HlGkFpMiQE8FtJrI9oDRLjrDrXgoZeupf8+HYxwrO/jcKdKglMGy83GOSrKxwQaAYE48koMyGgWz7oSI/I9sVI7bGy0EGtIfRhl17zm7DGbDt3c5PpjwFnXY7ZiQ== 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=i59gvOtga3vrGXUxwoyG6+WRPzzPu2iYNqQKOBz+ngU=; b=qlVQhMpJLkzOuk/FFcYs9lmqAXZ6Q1HJ508ORTnMsyINXrI3NMezvs/+7FQsE+YUQrwvUm3QFZGKW7OWvV5maUS36vDEBQaimF0SeOgYvGis+p5zebLyA3stwRQINiKEX5VyK/g98Z6UN61eTZCWP+YAfgmi2TqECMqyz3r9bVEw6Y1taQqxtlsMYZgI1vr9CXl34RvMyu2pI8al44su6dh8rFkoIuo2Wm/7NWT32S7r5qHW1RgMpmDiK0n7ngQjGpmQ7NeOVsJbUgaquWWjB9BbvkmrphloL0ZPti+7LCV2wAHqfCX/fPS6Hcw1bktzA5ZCcqerzqvrsHfG/Fa78g== Received: from MW4PR04CA0058.namprd04.prod.outlook.com (2603:10b6:303:6a::33) by SN7PR12MB8170.namprd12.prod.outlook.com (2603:10b6:806:32c::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.15; Fri, 5 Jan 2024 00:03:53 +0000 Received: from CO1PEPF000044FC.namprd21.prod.outlook.com (2603:10b6:303:6a:cafe::62) by MW4PR04CA0058.outlook.office365.com (2603:10b6:303:6a::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.13 via Frontend Transport; Fri, 5 Jan 2024 00:03:53 +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 CO1PEPF000044FC.mail.protection.outlook.com (10.167.241.202) 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:53 +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:42 -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:40 -0800 From: Suanming Mou To: , CC: Subject: [PATCH v2 1/2] app/test-crypto-perf: fix invalid memcmp results Date: Fri, 5 Jan 2024 08:03:22 +0800 Message-ID: <20240105000323.903764-1-suanmingm@nvidia.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240103035605.720256-1-suanmingm@nvidia.com> References: <20240103035605.720256-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: CO1PEPF000044FC:EE_|SN7PR12MB8170:EE_ X-MS-Office365-Filtering-Correlation-Id: daeabe8a-c3e1-45c4-8c2f-08dc0d81cdee X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: FKAcKODc5vNpqoBxHES4mv47aCbH1Gr8h+tmGVnuprq771HlF8lBxz60zBk0G5iYba7lBBjhcELmM3LOo/KMCMLJPAv8WJl8FOaSHLPOIrufcaAp/fHbI9OnAFilMnGn7NLdi94qJFC9FK9faVmw+eL3jyCutBnA/qkAhvS1R/k0AUNbPn7ema40amwWWElpCJJHbM8mP1JdfSBhGWvuOjv8eFyodqmLliFGmOwRjUixXtapdezmc944mBJ7cYC0d93rB40GI002cZyKDhni6Z3tdv3ww+y2m72SHcgFg0bQ68lYjwGpXrTBM/noA/Fxu4SPU9ergMxC61yzJow4UnIa0AaMeL/yP43+CKllCFxl0EkY2he1JHlGKPbNVh7tWG0BAmcxFh7meXWbtu4UF/SpHu53346STqs7GCUuWlUz23EKqlSTIjbUDHMFZSGTMFMO1UNQZt7NzxeaKjXeS6/9sy8CxaDAxf+lo24zyCFaBku0Qky4vyT4kvnJoB00ZT/Fjy60MUOeEUCnN/GJhuaNhoav3Et4v724DGyFXvFSd2MtQi94wpowQgwqsV8nVtOuL1/MTHBsLahXSZqa9P/5wb+LQyOds1f8NZG+0C2BCZ/zhTmxz8bmkaj7vkyJ1dVm51bhRmE1t7EnENOC9fBU6Zc+RgNoXYP04XhyxeercAb03593eI0L74ZX8saqB0ge6iTJgRaWu+rW6z1F8YfJRyKqyMy94QqR8M5rZrAy6FgL0opmPUKrILMKMnjpUM/ImE840JpVj3ivrM2p4Q== 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)(346002)(376002)(396003)(136003)(39860400002)(230922051799003)(186009)(64100799003)(451199024)(1800799012)(82310400011)(36840700001)(40470700004)(46966006)(55016003)(40480700001)(40460700003)(2616005)(83380400001)(6286002)(426003)(16526019)(336012)(1076003)(26005)(41300700001)(86362001)(356005)(36756003)(7696005)(7636003)(82740400003)(5660300002)(36860700001)(47076005)(2906002)(6666004)(110136005)(316002)(70206006)(4326008)(70586007)(478600001)(8936002)(8676002)(309714004); DIR:OUT; SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2024 00:03:53.5735 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: daeabe8a-c3e1-45c4-8c2f-08dc0d81cdee 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: CO1PEPF000044FC.namprd21.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR12MB8170 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 function memcmp() returns an integer less than, equal to, or greater than zero. In current code, if the first memcmp() returns less than zero and the second memcmp() returns greater than zero, the sum of results may still be 0 and indicates verify succussed. This commit converts the return value to be zero or greater than zero. That will make sure the sum of results be correct. Fixes: df52cb3b6e13 ("app/crypto-perf: move verify as single test type") Signed-off-by: Suanming Mou Acked-by: Anoob Joseph --- app/test-crypto-perf/cperf_test_verify.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_verify.c b/app/test-crypto-perf/cperf_test_verify.c index a6c0ffe813..8aa714b969 100644 --- a/app/test-crypto-perf/cperf_test_verify.c +++ b/app/test-crypto-perf/cperf_test_verify.c @@ -186,18 +186,18 @@ cperf_verify_op(struct rte_crypto_op *op, if (cipher == 1) { if (options->cipher_op == RTE_CRYPTO_CIPHER_OP_ENCRYPT) - res += memcmp(data + cipher_offset, + res += !!memcmp(data + cipher_offset, vector->ciphertext.data, options->test_buffer_size); else - res += memcmp(data + cipher_offset, + res += !!memcmp(data + cipher_offset, vector->plaintext.data, options->test_buffer_size); } if (auth == 1) { if (options->auth_op == RTE_CRYPTO_AUTH_OP_GENERATE) - res += memcmp(data + auth_offset, + res += !!memcmp(data + auth_offset, vector->digest.data, options->digest_sz); } -- 2.34.1