From patchwork Fri Nov 4 16:03:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9412763 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 D9B3A6022E for ; Fri, 4 Nov 2016 16:03:44 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9B5D2B189 for ; Fri, 4 Nov 2016 16:03:44 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BB05A2B1BC; Fri, 4 Nov 2016 16:03: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.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID 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 26B3A2B189 for ; Fri, 4 Nov 2016 16:03:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935298AbcKDQDn (ORCPT ); Fri, 4 Nov 2016 12:03:43 -0400 Received: from mail-by2nam01on0079.outbound.protection.outlook.com ([104.47.34.79]:58880 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S935059AbcKDQDm (ORCPT ); Fri, 4 Nov 2016 12:03:42 -0400 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=ADyjxteqSjq9om9060ME/cpFvRO3Ph/kA2N4O3U83CQ=; b=hqcHUXe64MYFNDqxqfD5kcwJ5K7abI5TurBaF6c5d3ikDsF+ldSXHnxvePReDnRw1ydsPI5LQIRoS99te6kwKVqnW9kaI0EgFQZqCm+rqbybma3oNVdzQ+/2Xc6HAufCljo8d5I2w3jm1y8CpKciYCgxeEMtTilo0o+CFw/omtE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by BN6PR12MB1394.namprd12.prod.outlook.com (10.168.228.140) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Fri, 4 Nov 2016 16:03:40 +0000 Subject: [PATCH V2 1/9] crypto: ccp - Fix handling of RSA exponent on a v5 device From: Gary R Hook To: CC: , , Date: Fri, 4 Nov 2016 11:03:34 -0500 Message-ID: <20161104160334.18155.32509.stgit@taos> In-Reply-To: <20161104160140.18155.75618.stgit@taos> References: <20161104160140.18155.75618.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0036.namprd17.prod.outlook.com (10.175.189.22) To BN6PR12MB1394.namprd12.prod.outlook.com (10.168.228.140) X-MS-Office365-Filtering-Correlation-Id: 413a8162-0017-4b4f-fb56-08d404cc2517 X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 2:QpxBhUHJjC1yFFFG9TIfwii6T2fOI3/dS7fb9gHec4lCUv0bz9m6jUu68DqXIDf9Myb1HH3QBkaols2zQMjrqOnqugZwCHkdplQCsw3nGRQGVZoWqUt1smKr7L+wW5bcUfGr18EIkeipcbdMaHLofUnQxPidSziRDZqEIIzxa6lAi1q/5NP5daFOFzsnTJ24cDHeRIQCo1ORSgysXowKBQ==; 3:RgIqdtSLyctxTNt3bQ08kx3abXEGlCGiltFsrTVCLCso4Y0rk8lLgzDBS+KIkdFsazCuHcMaFLMdumOvdy3C/DNVrzjnU1n6WtKPu3j7bm5khcJ3XEV9CIJ1/ZMeTRVGRHGerE9aYxMhkfjVKlAWDQ== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN6PR12MB1394; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 25:mdKxBT4LazHemLe6+3PGIiSCB7pjGrfT2zg9fojysvr37nG0VEgv003QSjaY7S/7z7A86bR8uE6PgTi2f3+bRXtlOiMdDa1zaSw/DLW4DU8TPyj2SIX2uhPYjaEkbdCF0WEfYfYQ26pNFrs9t4g2zpJDHuk5i12Gb+ij36IKSFnC87t8kX9kPoIYNVOqUsQOwWULGqGPyuWFHJt+VwPaJhzXXKpsLw02Id5uoVc8DaC6FxSGkZWDZw8DbxEs+1zM39/hWcSoEunFZXS1zNNzI93SiLyKXcf2hmJK0+N6KZMJP1G1YjAWzst+/jMpABu2D2xJU0lNkedGdwfhXiAnwBENbCUgRGquAwPUlWQvN5h1bEDVip/I4EBZVSHM0IPWS3HQa1aYxSX8xlJj6EkPIlPvZdtW+FibI7XdkVvjWjX+fqGYJMt7izachN3BioxXKcXQaLSVvuQr5dCjEfWYDGZaZpoSZ9ulj6rzpov+aLKhJeRP1CVVfCg4NBbQaT6XeUYe4hxW41l2EtSttAa/HY7wFFOHp/XYAJY1yXq3KIYC1wocz2tV23fI8+SaW/cAwRdb2lNZwInFRs0mVkmOLRNE5r7xSgXpd+zLOedC640N4Cf1UNwyJyeiKrbrSzxIb40nGp9EadCl+Ecot2gVmtogpJXcianOipgin7Jrvyi/4JxJAguZdQKExklOpOMpSWSjdJcPhJWoaz7EyHrDtA== X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 31:xVxg1kz7feE4amnGZOQAKjTGBriBLZrcqj/jUjiWWQNO9QyMdF+1gG6XNVi2diQIRLvtLaISJRvAZGvPANa3GLu3NmGX8aLE31l4B8shayyLUpQDfCOi9mXORGOdy4BKqdRZIuyxjUq5d7729q7YClrFdIjYnTNR2N2rGVsqq4Lw1WM9VhKULJUlvtcspYyQX70zfMBm/w7C8Ibd0na74N8Ybb0sfoXLAiw57wrFwrvxQaiRyNSvQumI0UmuLEDu; 20:6tbx88gd898vrJ629CyY6EKfkkMF4lDR1rM//zlQB74Y4ncGjW+nGV/kRNBTRX8wc/xxJviXsU0lzEl4rBZfpz99fqAEKyW4BYUbsf1PAODkY8G7JxOr0fKFG+8G4AVXcEPMKGvNz+Nt8wlfJWjYhTtOb7nwiEGDZDwloT4jZu7szzw31VPf1VKrtXhAWUxds23smY3614kvIcTBl/rXzUgYsX8bXmuGUYMSRtzNnwerPbc22ejQS/jonRakWt3AkGZw5LrvU8yGS3/M0/1wSM16rqBCt4akhNOfjEgVRNLh2u6vtL2XZjLRyROzXqnSQS+egatldotG93ZNxvp18SXcwWHVXDE7kVUyVhxqDmP/qBYwv+LuVVeEtX41jzkBO3/zChfiP85EYlIMyhBSwGbSUcdO7X1i26aQbsXaD6BUxJtYERNLnS3jtCgBL+aMBGlSiIPPISFVcUXKurFTqLAhKXWpJ83S11rUdh4fSqYO937VCnBiqq8JjNlOxP6B X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6055026); SRVR:BN6PR12MB1394; BCL:0; PCL:0; RULEID:; SRVR:BN6PR12MB1394; X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 4:2UTZ4wfU+6RZGhQs6yPt2ByvdLnc/qIEYO5yN144JrSzKpkCA655dbJ1FvolyHSUOme+2Ry2AmtCzZfveaaffEijC5ryWczZBDw/PXhkxEVXSNdNHXUuGO3l4eWxn55r3V91/M2jvmd/sWzk3D8GXSLR50HM+pd1RVLs2NFCZXDz3DfLOAQ8KZsts1flL9TwNoh1SdpnqF53Pp2l3oT2AXVzkA/B3RpJvlO7FYeYUaIpKZKJNLSoVVcK7UN9mC4mqLTHKjYjd4zo2fKLl2bLoL9P4lXNK2AJH7G4H7GDx1C1+32tcKAIPwVTSQ5Rc1WiUdu5GEb1oE5Fc4JMsOL4tp0wxqc+xShGrosueB8HWqqREg1ThyJtEluATD3J68lLVAlX40MYSH65NuuhxaZzKobbtwYYtaeCBl2mF3YGvYrcTHwHOOhoj9mkGiVmv3/bH9u00F/RWJiGc+6yzpPF5Q== X-Forefront-PRVS: 01165471DB X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(189002)(199003)(86362001)(77096005)(47776003)(66066001)(50466002)(19580405001)(19580395003)(9686002)(4326007)(189998001)(83506001)(8676002)(6666003)(92566002)(2906002)(103116003)(81166006)(81156014)(6916009)(2950100002)(68736007)(42186005)(3846002)(586003)(54356999)(33646002)(105586002)(4001350100001)(97746001)(305945005)(230700001)(33716001)(50986999)(23676002)(7736002)(110136003)(97736004)(7846002)(2351001)(106356001)(229853001)(101416001)(6116002)(5660300001)(76176999)(1076002); DIR:OUT; SFP:1101; SCL:1; SRVR:BN6PR12MB1394; H:[10.236.19.42]; 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?MTtCTjZQUjEyTUIxMzk0OzIzOlpTdDJoTVZJV3c2cFFXRHFKMVFMNHh4MWRv?= =?utf-8?B?ZEZhRGdJWEZKallwdVRtUldFUDA1QUsxeFZsZEhEMVNFeVB3MjE1RjZkeUxY?= =?utf-8?B?UzlLZC9NWDF1K3MrVC9FZTAzZ1dyZjFqbXJjcytoQUZQYXA3SDNjUWNnVHls?= =?utf-8?B?bHN0SnZqRkNGMElHNlM1TVVRL1l5RXdEZ01iNDVkbi90OU5EUDFucTVKSHhn?= =?utf-8?B?WU44dy9oWUlPamxuL0x5MDQrdThOd014L0xDczZHRi9P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G/7WCo=; 5:s8rSj/P29DFhbUgaqQFQ6zXWhyo6KQS22SVVoTQsy88KUwxAtNvX6ALqTXG3iJs/RFkUMPRev7Y8uYPqgb4Ccnn1TfjmRZnlG1QLMBys83itJtYuV95Ef8ITQ035IHFp56mERCIebd19LZUspdqkQJaPrFYZUMB36wRdqzJsBnA=; 24:61qK6og4IfGDlUG5k19uG44inCjZ38W0wAf6uqjonTEbPwKrndkbY8UAYnHwVXGOUAchRdnae+wrylhp+wxXUxmtVzBmUuMibWWSt+OybrA= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN6PR12MB1394; 7:s0cEp97ILpp69F/ZccUEUWSjXuiJuXCJdrt1jNgijLN9hnv055fuUg2xDQAoLtn1RJaKh4aYo5/hQ8qr6sxE1uGRTUheoHNZf97AyNepbp9b7X8DfN6R/TgSnA3whNJEKw/Ts5y5kBjNkBtOVxD47evVH9eii7tPCp2kQRmlF/awK4IYLawCoJgLPjoSp2R8igriU5aY0eu3+ghgZQXFWold/ux+EcwseORMhMx8l609U5CRERvKtanVRESA/KfSKx2ldn6es8wUAvqOeYMiSWieKEYx2rRPE/ZG0LdNcvd3jSoKuKytHGRhPNfVuRx92jGOKftTNjN42bg0jZG+nD/rPDisMwS9P5EyQCR4Kp4=; 20:940Ucgn8Omm6Q2m9+dFGDosm44i7KkkeZ21LDSDxqcC1613vdrY0k/zqJQCjmTJlYbEL0PODrF1sjCmMdpbV76z1kvNb6TgbZiPjlAsZHyckYc71PhovjXe8jPA/VGv2kIf5igF8lbYu4BqMBpVrC0IsOG39/1rIzudJd/G8rKElYNZGXaMbDbAB471erumBkPUz3wOmdBTzojcQD0K6OS7DI9C09kULSpHA4bXbZVisDelWUadQm5Gp6YQIrq/e X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Nov 2016 16:03:40.5538 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR12MB1394 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 exponent size in the ccp_op structure is in bits. A v5 CCP requires the exponent size to be in bytes, so convert the size from bits to bytes when populating the descriptor. The current code references the exponent in memory, but these fields have not been set since the exponent is actually store in the LSB. Populate the descriptor with the LSB location (address). Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev-v5.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-crypto" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index ff7816a..e2ce819 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c @@ -403,7 +403,7 @@ static int ccp5_perform_rsa(struct ccp_op *op) CCP5_CMD_PROT(&desc) = 0; function.raw = 0; - CCP_RSA_SIZE(&function) = op->u.rsa.mod_size; + CCP_RSA_SIZE(&function) = op->u.rsa.mod_size >> 3; CCP5_CMD_FUNCTION(&desc) = function.raw; CCP5_CMD_LEN(&desc) = op->u.rsa.input_len; @@ -418,10 +418,10 @@ static int ccp5_perform_rsa(struct ccp_op *op) CCP5_CMD_DST_HI(&desc) = ccp_addr_hi(&op->dst.u.dma); CCP5_CMD_DST_MEM(&desc) = CCP_MEMTYPE_SYSTEM; - /* Key (Exponent) is in external memory */ - CCP5_CMD_KEY_LO(&desc) = ccp_addr_lo(&op->exp.u.dma); - CCP5_CMD_KEY_HI(&desc) = ccp_addr_hi(&op->exp.u.dma); - CCP5_CMD_KEY_MEM(&desc) = CCP_MEMTYPE_SYSTEM; + /* Exponent is in LSB memory */ + CCP5_CMD_KEY_LO(&desc) = op->sb_key * LSB_ITEM_SIZE; + CCP5_CMD_KEY_HI(&desc) = 0; + CCP5_CMD_KEY_MEM(&desc) = CCP_MEMTYPE_SB; return ccp5_do_cmd(&desc, op->cmd_q); }