From patchwork Tue Feb 13 17:34:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13555437 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2041.outbound.protection.outlook.com [40.107.236.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B964660273; Tue, 13 Feb 2024 17:34:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.236.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707845697; cv=fail; b=ieNc7lJBYQ1JredJKtSPs2R7ESE3G67/cTiLQtyYi8zqD1G3ktDd5y4py6iYkhX00EnGYS4LzoOC2n3QzyOy8vFztPCRFHcv6M5i6n+PmjfFNilz08xKGBaJPN8fwyki3SmAPXirzWbTg9G73E6QofaQ3e6Elr/tJxxfmHg3RiI= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707845697; c=relaxed/simple; bh=DQXS6tLUlxjGfgFOIRduZ6eoZcmROQvI73UKGex59QQ=; h=From:To:CC:Subject:Date:Message-ID:MIME-Version:Content-Type; b=C9y936BWJfXxfRYT7ncGcNznNkfHhL5g/NKlwncNhXL54jTld91WOzA6V01dxmUhs4k/59uiVYnEVkdqNlnoSZQzYMhEPhjX7c7tSG2KaMgy38qTRMW7vxLl8xmZrN7lm5B7zSQqqUHpBv38uQSzZcprvgXd8UOclV8udq62IhM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=zt9Isu3j; arc=fail smtp.client-ip=40.107.236.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="zt9Isu3j" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CnhyQQUs/GThTBLQF1P05H6k24d5mkL8hTTlWoox+M9wyQklVKlq5I5Z0w7LzOs2ZPaCPzF98onE4FSnp2czEfbysI/1Nh/Bwa7dLJbSzH4Pa5oDXYCSIDQSrGTDRQtkNlC9BWhJjF/uhzz/kqwf7cNS5dzB9QGB5v0ANhJN2zJgjMNd9AA2gGniWO6YJojLFwD0iM5oDpj8UqaYEGiQrUeoCwyp4eRXaJ/mcxE7WAVXNEMIIuY19EU2AjLnGBu0vdJ9L5bEEDCm3RzJClhaLMBxB5EmM6wrLJCejqVyTV4l6RUbHHs87WcyySnFYz3pvPA+MQERgGgZ2UNMYpso5A== 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=Mnof79B9tpM2EMXHBlSOaE61DrpyVkqMA9YxAksA6uM=; b=GyFln13S1zi2JNYh04qJZcRqqGmaorO5RoO+69GNX0u1S48aEFVuoOFOR87jEV4nTGIZmiJMWpSeYvbyLzMMsCWuD2FCboS35kDD6bnCN0Auske2LHiOTSEqH17I4BpvUxEEgEX14eTtw/Sr9fy49LUG76l+VTHGbBbhD/SGl50+xFmWCqgId1FUWT+gs+x1SK8kEx+GP6tYlSzmeiCcGTIWjWCkcmXmsHeP3nyPEfQgT91iceZBJqX3scYt2vrG/dO9IhIRmxmBBhq0HIpNjJuLtpzHCu27S7R0eFvlxb2Zgl0H+ZK0dTGqP54xArjz/w8AAAFxcuk8STVCKnWsbg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Mnof79B9tpM2EMXHBlSOaE61DrpyVkqMA9YxAksA6uM=; b=zt9Isu3jwJWsOLw56zbE6ciryCrubqsO43+yp86jB3VcdIPfZ85vtUyktNZa/0NA3T1+RpDPjMYBeLcFneYT5LxoYvbwASkYVi+Q3qrXyV0IMR2R0MAcMYjEtWJSVQhJ0MT2xgOWP7pePsQ0opTBXf7WNm/RpTjYATGHC+Vkstw= Received: from MN2PR19CA0038.namprd19.prod.outlook.com (2603:10b6:208:19b::15) by DM4PR12MB5246.namprd12.prod.outlook.com (2603:10b6:5:399::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Tue, 13 Feb 2024 17:34:52 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:208:19b:cafe::a9) by MN2PR19CA0038.outlook.office365.com (2603:10b6:208:19b::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Tue, 13 Feb 2024 17:34:52 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 17:34:51 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 13 Feb 2024 11:34:49 -0600 From: Mario Limonciello To: Herbert Xu CC: Mario Limonciello , Tom Lendacky , John Allen , "open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB..." , open list , "Tim Van Patten" Subject: [PATCH v2 1/2] crypto: ccp: Avoid discarding errors in psp_send_platform_access_msg() Date: Tue, 13 Feb 2024 11:34:28 -0600 Message-ID: <20240213173429.43748-1-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|DM4PR12MB5246:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ae68164-66a0-4595-08bd-08dc2cba155f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: +Cx+9gjyw4L//yvPGp2uXntCRVs9Dm6UUJtZct1z7CBePrMvfZkfn2uZYDg4dEX4cXlGNrYotZEgWRd5scZoK/N5RUEQjk7+0Oug/lR26mETLkZG2qxvvicLwUsKmbbxnHm400NH/nBe9LwE/wpNAM6vgW9BtjPN2OhATOp7v3ShvG9N+HI/Wpn1slq1Tlzg5ta242Z6yUHtSXU9cHCkOKX17NKSZ6hOemCN9XVDDhjzssXUFg05+qrXkheXMIEw82ZJLJ1gMvZA0iX6JqtwKj21fL8YIGV0qmT27TBmUi9GSEy3zuwDcOBE1+0GxKQUPCND55cqgkEDFePYgdooLb6vb6P2ubnZxXvfLPliC1SrIeoI2udP4XLe+kzXQrCtOoF3HGwJM6POAPS8fN2b9/Nv54e3FhxOKW6V8iDfT3Fo9N0rqqeJrNuTjkLx05PFiRNfk/rl+A/Jnoo0UuSfxrj3V9mkChlA+YihC3sszUDmI1oYEXXF+wlu3wMZRyIMhkGjiNZjBP47hOUt3PKuxmdWYAXNRYFqmsnai5AsZjkboxbqXfTfpqpPvqweimReyhtPHg90X+XiuLb6MdFnLS0iO53pnO710061rCcy3/A= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(376002)(136003)(396003)(346002)(39860400002)(230922051799003)(1800799012)(82310400011)(186009)(64100799003)(451199024)(36840700001)(46966006)(40470700004)(54906003)(6666004)(316002)(2906002)(44832011)(5660300002)(70586007)(70206006)(86362001)(8676002)(6916009)(8936002)(4326008)(478600001)(41300700001)(2616005)(1076003)(26005)(36756003)(356005)(426003)(81166007)(336012)(83380400001)(16526019)(82740400003)(7696005);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 17:34:51.3544 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8ae68164-66a0-4595-08bd-08dc2cba155f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM4PR12MB5246 Errors can potentially occur in the "processing" of PSP commands or commands can be processed successfully but still return an error code in the header. This second case was being discarded because PSP communication worked but the command returned an error code in the payload header. Capture both cases and return them to the caller as -EIO for the caller to investigate. The caller can detect the latter by looking at `req->header->status`. Reported-and-tested-by: Tim Van Patten Fixes: 7ccc4f4e2e50 ("crypto: ccp - Add support for an interface for platform features") Signed-off-by: Mario Limonciello --- v1->v2: * Update tag for Tim * Reword commit message --- drivers/crypto/ccp/platform-access.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/platform-access.c b/drivers/crypto/ccp/platform-access.c index 94367bc49e35..1b8ed3389733 100644 --- a/drivers/crypto/ccp/platform-access.c +++ b/drivers/crypto/ccp/platform-access.c @@ -118,9 +118,16 @@ int psp_send_platform_access_msg(enum psp_platform_access_msg msg, goto unlock; } - /* Store the status in request header for caller to investigate */ + /* + * Read status from PSP. If status is non-zero, it indicates an error + * occurred during "processing" of the command. + * If status is zero, it indicates the command was "processed" + * successfully, but the result of the command is in the payload. + * Return both cases to the caller as -EIO to investigate. + */ cmd_reg = ioread32(cmd); - req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg); + if (FIELD_GET(PSP_CMDRESP_STS, cmd_reg)) + req->header.status = FIELD_GET(PSP_CMDRESP_STS, cmd_reg); if (req->header.status) { ret = -EIO; goto unlock; From patchwork Tue Feb 13 17:34:29 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mario Limonciello X-Patchwork-Id: 13555438 X-Patchwork-Delegate: herbert@gondor.apana.org.au Received: from NAM10-DM6-obe.outbound.protection.outlook.com (mail-dm6nam10on2041.outbound.protection.outlook.com [40.107.93.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CE502604AB; Tue, 13 Feb 2024 17:34:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.93.41 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707845698; cv=fail; b=WpluRkuuD0W1yV74ZtF9AvnVkIwKPrhlLOjyQwbKKOEX+qqdtkNFyZ/wWekWmYJpENkhUGYLAL30fQH8tBAVySB2mwmjy5TSlAOEe0HYEZ2WwV7bTWhgvJ3wt3EwPG9m3350eG+oznsRiC8LKaOiKVRRgS0wGb6kz48AHnxZBuc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707845698; c=relaxed/simple; bh=1g3yxX9ps+Kc2EwgJ/o6nEB4qaYHnnBgebJhg1tW+io=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=ARRE3qywaX6ddPOKTJBLu26BHRQC2QWjnt/geYwsKtMjGYL4Htyb+Sg2jSNKa/Yp25sLu1tz3uoZSVGsGqqW3NVBDFZtdhv27eRZftEcogoVOu9/13zyteSrXDsCENgExSNxuxE2bmzytIOGib4KXC/XokYMxIcFlKibscMM5DI= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=h1YdNxSa; arc=fail smtp.client-ip=40.107.93.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="h1YdNxSa" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YWzzaz1A3ngnLJIvYkA8HDa6Zzf0bBwHTvp4qbIISeQ9ePCHcQWeZr1yBY8XMJxx7aSF+dU0WihqvXV7PxcqzSeCbUX7oCfwXF2LNEXDmhc19qN9v3iFp0qUBwDcql6OWnRkt5FYixaKgsWiZz595UcXQoHEU/kLV2G/uuSGicVwm/Ts8dWeOwZmSEp8fMNmT9sRC6X5LV6MANeMDyV4Kg+iZe8/itq3wOchOLRcEJmD5EHYauL2+bhFq0yrHrN4yD2eSbvWNVC0f2UhOuXo5I7yvCKzRL4O1M6MXeXTuHiv54hMh5l2QUvjv80V4Vr7zuQJc9ubPTgD0GuO13ss0w== 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=JQWUb3HiBZR4g9/sYjsjEUNPhe8hXbvdVYnOW41dby4=; b=dsPeG8zF/+pnomRBdO1jV4SvcfH7Iz8cnW09uE03CG+VhOTrtlsPpph08ZFHG/57lsKsKzWdY8Bgp01D8Fxts++9U2w5JsYLsX8luu59sUTqSQcqQpVu5zTYfdXpHcDwnwEYSXvDIl+AGW7WVt+YznsS0Hl3J73XSE478v9OWa12/NRJwJUID3RvkYoHu76VnQTfpe6v1+U19pyhKSLYFtplpItLFqJcU2961346f6S0pNaYHRXhX6o9RWPVmbM99/Gv6zsvowbUZom5v9UiX7CJ920Yxlc5WqQ3I26HvkHzahSFkFexWyItfDo80f5g+9GlT3sG1tc2CNyS5f0dBA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=gondor.apana.org.au smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=JQWUb3HiBZR4g9/sYjsjEUNPhe8hXbvdVYnOW41dby4=; b=h1YdNxSal6OXAruNkN8GB981dqvT3ddV95GjFSbFvSVRdbCNdKRzaYNBLQxah8EgUyRTltqyIJpC/XiewAxa5cH1cT807knJS03f+zMVGHXFHTg2UUJWx/RJyPnlnV4bO8J6vSbz6ZxfF7eLHo1Bhq6ii+8bjXKW69NT7OXanAc= Received: from MN2PR19CA0056.namprd19.prod.outlook.com (2603:10b6:208:19b::33) by DM6PR12MB4041.namprd12.prod.outlook.com (2603:10b6:5:210::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7292.25; Tue, 13 Feb 2024 17:34:54 +0000 Received: from BL6PEPF0001AB78.namprd02.prod.outlook.com (2603:10b6:208:19b:cafe::df) by MN2PR19CA0056.outlook.office365.com (2603:10b6:208:19b::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7270.38 via Frontend Transport; Tue, 13 Feb 2024 17:34:54 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by BL6PEPF0001AB78.mail.protection.outlook.com (10.167.242.171) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.7292.25 via Frontend Transport; Tue, 13 Feb 2024 17:34:52 +0000 Received: from AUS-P9-MLIMONCI.amd.com (10.180.168.240) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.35; Tue, 13 Feb 2024 11:34:50 -0600 From: Mario Limonciello To: Herbert Xu CC: Mario Limonciello , Tom Lendacky , John Allen , "open list:AMD CRYPTOGRAPHIC COPROCESSOR (CCP) DRIVER - DB..." , open list Subject: [PATCH v2 2/2] crypto: ccp: Update return values for some unit tests Date: Tue, 13 Feb 2024 11:34:29 -0600 Message-ID: <20240213173429.43748-2-mario.limonciello@amd.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240213173429.43748-1-mario.limonciello@amd.com> References: <20240213173429.43748-1-mario.limonciello@amd.com> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-ClientProxiedBy: SATLEXMB04.amd.com (10.181.40.145) To SATLEXMB04.amd.com (10.181.40.145) X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BL6PEPF0001AB78:EE_|DM6PR12MB4041:EE_ X-MS-Office365-Filtering-Correlation-Id: 624b2d8b-3383-4847-d913-08dc2cba1630 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9PDHNSGVlqr9EkkdxRpkRlnP5Zn4qFBWPPJTJNGPQhWfeINR5kwApjQ4/f3ITEYfgJXWo+MAWE0kdmxdDpZz1x/gCbEsYlmO0pqQdK0Rrc6tFzVcXmj73xJ5mhaizALCphScR3A4QHBMgdEju4VVOiT8KH0vsOFbBGojonYLAIfzhElYY8+CItG7p8RsuWeMly+dDtmet0INDsXRULHp+ce6ADiUfJIJfTKRrtQx4kQjckjf+vaxDFtbuKaHC82YB7lEDMzgPZKiobwCAYbho1oXZhZNnErlXthntw0vo517ulUaUn7q/f275jM0Cw+HgyetyVecW7+a3qQdekQHJ4yn148NkoP/M4MpXWrhx+0fPNcHzRJ/+24t0NsGjMBdCK0A8aMrg/EC7BCBokKN1EnlcUNHi38xNGVhJlzK7De5wJh3iX3ejsmB0kRowo3vd5/MD1LL4rvDuwsCtDjjsxgOQ75RvaHdybim9BqQ3V3pwo9x91KpovZDBMUtlwDFjZMGp3aom3eVuedhJ0hFXB0juwMXZD9DcOTyVR2f/yyctQoowZd+Drr4zWOKyTJHn7AE9AXkfKwglx/0xvEiowel2LH2/DzVBaFWuTbImyw= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230031)(4636009)(136003)(346002)(396003)(39860400002)(376002)(230922051799003)(82310400011)(186009)(451199024)(1800799012)(64100799003)(36840700001)(46966006)(40470700004)(8676002)(4326008)(8936002)(5660300002)(44832011)(2906002)(83380400001)(336012)(426003)(2616005)(1076003)(16526019)(26005)(36756003)(82740400003)(356005)(86362001)(81166007)(7696005)(70586007)(6916009)(54906003)(316002)(70206006)(6666004)(478600001)(41300700001);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 Feb 2024 17:34:52.7294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 624b2d8b-3383-4847-d913-08dc2cba1630 X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: BL6PEPF0001AB78.namprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB4041 Until authenticated the platform enforces a state machine. Adjust unit tests with this in mind. Correct the return codes for all the states the unit tests ends up hitting: * Set Param / Get Param: DBC_ERROR_BAD_STATE * Set UID: DBC_ERROR_SIGNATURE_INVALID * Authencitated Nonce: DBC_ERROR_BAD_PARAMETERS Signed-off-by: Mario Limonciello --- tools/crypto/ccp/test_dbc.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/crypto/ccp/test_dbc.py b/tools/crypto/ccp/test_dbc.py index 79de3638a01a..bb0e671be96d 100755 --- a/tools/crypto/ccp/test_dbc.py +++ b/tools/crypto/ccp/test_dbc.py @@ -138,12 +138,14 @@ class TestInvalidSignature(DynamicBoostControlTest): def test_authenticated_nonce(self) -> None: """fetch authenticated nonce""" + get_nonce(self.d, None) with self.assertRaises(OSError) as error: get_nonce(self.d, self.signature) - self.assertEqual(error.exception.errno, 1) + self.assertEqual(error.exception.errno, 22) def test_set_uid(self) -> None: """set uid""" + get_nonce(self.d, None) with self.assertRaises(OSError) as error: set_uid(self.d, self.uid, self.signature) self.assertEqual(error.exception.errno, 1) @@ -152,13 +154,13 @@ class TestInvalidSignature(DynamicBoostControlTest): """fetch a parameter""" with self.assertRaises(OSError) as error: process_param(self.d, PARAM_GET_SOC_PWR_CUR, self.signature) - self.assertEqual(error.exception.errno, 1) + self.assertEqual(error.exception.errno, 11) def test_set_param(self) -> None: """set a parameter""" with self.assertRaises(OSError) as error: process_param(self.d, PARAM_SET_PWR_CAP, self.signature, 1000) - self.assertEqual(error.exception.errno, 1) + self.assertEqual(error.exception.errno, 11) class TestUnFusedSystem(DynamicBoostControlTest):