From patchwork Mon Nov 6 18:11:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Brijesh Singh X-Patchwork-Id: 10043989 X-Patchwork-Delegate: herbert@gondor.apana.org.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E7F5E603FF for ; Mon, 6 Nov 2017 18:12:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DF1A429F53 for ; Mon, 6 Nov 2017 18:12:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D3CA229F5B; Mon, 6 Nov 2017 18:12:44 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F52C29F53 for ; Mon, 6 Nov 2017 18:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932759AbdKFSMm (ORCPT ); Mon, 6 Nov 2017 13:12:42 -0500 Received: from mail-by2nam03on0078.outbound.protection.outlook.com ([104.47.42.78]:49424 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932631AbdKFSMb (ORCPT ); Mon, 6 Nov 2017 13:12:31 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amdcloud.onmicrosoft.com; s=selector1-amd-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=tjBYWUye66/LIIrzJq5Db35aTptEltQlhPq1G80Xx3s=; b=earWfQmyYAsr3kFIIIYWjmE7DDoaTmAKQz17bnJtISa+mYFagAiEztvPuO6hC37/BTS63cTiYy/oulH/me1+WiSLNL3ugA0hDt+eUaUnXj3FZ+NZ1XUo5w/TO3zuVNbTXdotzZze2ex6Ddxe549IvcbHQ7wYylm1ZaUE4fEhXDc= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=brijesh.singh@amd.com; Received: from wsp141597wss.amd.com (165.204.78.1) by SN1PR12MB0159.namprd12.prod.outlook.com (10.162.3.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.197.13; Mon, 6 Nov 2017 18:12:16 +0000 From: Brijesh Singh To: kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: bp@alien8.de, Brijesh Singh , Paolo Bonzini , =?UTF-8?q?Radim=20Kr=C4=8Dm=C3=A1=C5=99?= , Borislav Petkov , Herbert Xu , Gary Hook , Tom Lendacky , linux-crypto@vger.kernel.org Subject: [Part2 PATCH v8 17/38] crypto: ccp: Implement SEV_PDH_GEN ioctl command Date: Mon, 6 Nov 2017 12:11:09 -0600 Message-Id: <20171106181130.68491-18-brijesh.singh@amd.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20171106181130.68491-1-brijesh.singh@amd.com> References: <20171106181130.68491-1-brijesh.singh@amd.com> MIME-Version: 1.0 X-Originating-IP: [165.204.78.1] X-ClientProxiedBy: BN6PR10CA0031.namprd10.prod.outlook.com (10.175.102.145) To SN1PR12MB0159.namprd12.prod.outlook.com (10.162.3.146) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fdd86a24-1428-4739-9ac9-08d52541ea2f X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(48565401081)(2017052603199); SRVR:SN1PR12MB0159; X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 3:4CED76uYNRZTD46Qa3mban8HhgZ+jLDwlaI6lCsuDDT3YzG5xPi5Qwa4X5keBXmHI1brhQnKsd/CqAoF87OrS0Pkm1VnZ6FEm0jt0UVfIZokJrcAiP29ASAE9ZS7yI8nfKhi/p+AOpm4zbpAr8cftNbWeFUTEfVsFn89ugxn5JNQV6TM1dw59jvhlaLak+vYjFVuOGtUNI34OybR6cW7sGEljPxDZm0J3S1r3mScBBFuRT9Q0kGxRZ6+gQ2lcIIM; 25:PegFsZIyG0hsH++OuHoInVRL/6uAc86Ructtly2yURlRGqrMz315/gOExQMoTsVMqeK/hEYDg58VEEz82/93NLkcP9MhGlt/u7tk704POsbq1kqFT+A5FU7w9pzp2cYKwYqMrJoaZw2zlSI/JtEKEFo5+RDElr5jH9DTxfGSh8pBEJyp5GcjVFZPTI4f0ZzhySkQMVyQnf0SJWkb06qXwO+QQYorojBOib4T3hbbpl1sPdTrfz7/+sO/6cr1uCe+lzp2AjaVEvy+F8oViUjsQwQYTsKutXXQq5OD1RHggdAUMmOlFhQZMQ2UbQ2lM0bQ47Oih9qy3MpNmUngYxqrFA==; 31:vt2NPArJTGWxmg3Qos06LHgcNqq2KXOc8RPXufN4queVRwKH7HDxoH1o2hL+Y9isxz9RuthNM3OkHlwS574+D+eaHUZoZ85UePGxhVR/oD0v+AW1sf/zIhzle9X0mJC7ApPQV7RVHOnWJJRJ5aYIaHwzCeFjyZ+74D/iiHmdUMfmK9JyTXKuw5dV1pseP5mflza5VGBRdAkh5zrGxyRJkD/dVZq5RTBHs9DpLFeGhes= X-MS-TrafficTypeDiagnostic: SN1PR12MB0159: X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 20:v23t0u2haqYK8rOjVmkNyMnjTDQOeUQABDvchp45qcR7g6F9/0/uKEeB3vuDJ2HxLkkL1Ew1UwRZ/mfgNt7lTAbHybB8W3zL63fDjFbN+za9OyhhvMmnhO8baGoFBXfGtyAFEogryLBV2xb8dgGHimEn3FiRLGDl5Y58QdYQULpp5aGeycSfltInQzqM48/y/5BQ1FiyaAxkRgUaStco36z4xE/0MVA7AnOgHf+p7/O134SKvMvxETRHl9e7QS4h4N8QqlxfqJIgdFtv9NfV49Uq78iNatxqlIDydy2qQilU9b709ndNi2iSHb+i+sqTqaqgAqZuYCkfSHnxQ7pM2UvPg9RJZiA7PmMCUjfULrsVdrHFiHQoLj33Ej4Zam/aOewzmUPCTYw5YLUIvT0QTD7usrSN2rRKPyhNWyMV+26909a+sfVASn06Cq4WcDRBLqSRZYEO4BUped5+d7P5uD7noT2rm1U65fQ91/FBwk9VpPnB+5UV1QemDe5iQp05; 4:D7pezWJVi6iuN7CIqXfh+OwHeQ7KEN/YDQWOzqh/nUtJvq7rwVYEiTo9eU33FVHhUBB9FiRb3TJJdlIMX3VxpK1sNgNAkPRye6xzwWN2r3bc+cRN3HJvxiT1/XSjVe/jgcKdUQCWXUi6ieq26Mmeb1UFjSIg01qqSNYe59/XO3CW/sowJLNjwnld4l5xHvG7BYx8uA9TWHb1xXC2h7IM6UUxrkMB9TD0upjNDxImA0cHHJKwH8lHWGcxAlwnmBi+oHINxpulhuWwAmUmj8nPCZlyxX0TJgHwHCTEfkX7o91guNnJCGI/lUgFWkMPmmEE9HFj/F7uNI8MBsytRWlyrQ== X-Exchange-Antispam-Report-Test: UriScan:(9452136761055)(767451399110); X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(2401047)(8121501046)(5005006)(3231021)(100000703101)(100105400095)(3002001)(93006095)(93001095)(10201501046)(6055026)(6041248)(20161123564025)(20161123562025)(20161123555025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123560025)(20161123558100)(6072148)(201708071742011)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:SN1PR12MB0159; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:SN1PR12MB0159; X-Forefront-PRVS: 048396AFA0 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(346002)(376002)(39860400002)(189002)(199003)(68736007)(97736004)(4326008)(316002)(16526018)(54906003)(7736002)(8936002)(2906002)(81166006)(81156014)(25786009)(53936002)(8676002)(2870700001)(1076002)(6116002)(575784001)(23676003)(50226002)(189998001)(305945005)(86362001)(3846002)(50466002)(33646002)(66066001)(36756003)(53416004)(47776003)(5660300001)(76176999)(478600001)(6486002)(105586002)(50986999)(2950100002)(101416001)(106356001)(6666003); DIR:OUT; SFP:1101; SCL:1; SRVR:SN1PR12MB0159; H:wsp141597wss.amd.com; FPR:; SPF:None; PTR:InfoNoRecords; MX:1; A:1; LANG:en; Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?utf-8?B?MTtTTjFQUjEyTUIwMTU5OzIzOnI4QmVHVHQzZ2FKYjBnYUFCRzJuMjhJWnNq?= =?utf-8?B?dHlLOEs1ckR6YS9uZGZlZlZCWWZ2RWYxOURvK0tIbnVleHdnanBKanFLbjBO?= =?utf-8?B?S2p2RVhxcitDakIydy9FTTZPc1RuV2ZkYlNiejJSWWl4QVlkQlo1R0grZkhH?= =?utf-8?B?UkpLb0U5djFtbld6NGh5T2VRRE04TnlMU0JoZGNFVlRUZm1ETUlnUjkyWHNt?= =?utf-8?B?ZTQ0NTlMQjJIMnJpdVpiMmRPUjRrNlpaMVBJWkh2d3FHK1NKdHVtcEplVHgv?= =?utf-8?B?dGM1bHlTMEtmMlFWOVF3M3FuNTNGT3cvZlQrb2xGOUZ5VkVyUTlNTXBFS3lJ?= =?utf-8?B?dXFDV3dFNkRGem5WMTJBcEQzeHNkUDNHdlRBcU5iU0lYbnVCQzd0M01DWTFF?= =?utf-8?B?elNRM25rVUhNcjQwM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REPKbTn1W84jj+jqF0zPoHkujYMm3CMUrSU/E5nDt8sJ160BKWbW22vnMNNNCW5YmSpAhqCoHitiwu8kAGOIQ0UHriUCBvEiF20a95wXoeGi SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; SN1PR12MB0159; 20:TXipsdTJNg/NWTg+ryl4lFGnZPV5VKZ6/wRAinVCaYaMr2N6eeLwYAtjQSZfPgi5kAYPnqUNv9X7Z7P+OR0jj352+yHuoM5ova4BDchbqwafDP4n4zBsvgpQlY3let7SUIsSGM2JkfuC8OiGpZo/zC2800U+RquIk6NACtPnlOalbarjnsAFayj7F3vrfJvALG9RoAVugUJ7IompVkqrq4+aUE0/1Lf49jq3qaZR/zDNUed5Q3CvnuRx8xGkgXiH X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Nov 2017 18:12:16.6133 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: fdd86a24-1428-4739-9ac9-08d52541ea2f X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN1PR12MB0159 Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The SEV_PDH_GEN command is used to re-generate the Platform Diffie-Hellman (PDH) key. The command is defined in SEV spec section 5.6. Cc: Paolo Bonzini Cc: "Radim Krčmář" Cc: Borislav Petkov Cc: Herbert Xu Cc: Gary Hook Cc: Tom Lendacky Cc: linux-crypto@vger.kernel.org Cc: kvm@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Brijesh Singh Reviewed-by: Borislav Petkov Acked-by: Gary R Hook --- drivers/crypto/ccp/psp-dev.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/crypto/ccp/psp-dev.c b/drivers/crypto/ccp/psp-dev.c index 8aa8036023e0..fd3daf0a1176 100644 --- a/drivers/crypto/ccp/psp-dev.c +++ b/drivers/crypto/ccp/psp-dev.c @@ -333,6 +333,9 @@ static long sev_ioctl(struct file *file, unsigned int ioctl, unsigned long arg) case SEV_PEK_GEN: ret = sev_ioctl_do_pek_pdh_gen(SEV_CMD_PEK_GEN, &input); break; + case SEV_PDH_GEN: + ret = sev_ioctl_do_pek_pdh_gen(SEV_CMD_PDH_GEN, &input); + break; default: ret = -EINVAL; goto out;