From patchwork Tue Nov 1 19:05:05 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: 9407849 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 75E4460585 for ; Tue, 1 Nov 2016 19:05:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67D1429A76 for ; Tue, 1 Nov 2016 19:05:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5853929A7E; Tue, 1 Nov 2016 19:05:20 +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 B56B129A76 for ; Tue, 1 Nov 2016 19:05:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752297AbcKATFQ (ORCPT ); Tue, 1 Nov 2016 15:05:16 -0400 Received: from mail-by2nam03on0051.outbound.protection.outlook.com ([104.47.42.51]:45756 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751469AbcKATFN (ORCPT ); Tue, 1 Nov 2016 15:05:13 -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=E7Gzt5HLfL4Hw/tdEZ2NJiZ74AKJwFP8LTnx3w+ik2JxnAZvs9DvWgjfLeZT80497AW5dTDhnl6hc0RDEWeOl5DKlGZW+vi+apGVqYp8gvAyBB3Bfyeplt9Tp0+0PUGZS5OCIx6naEuEa8oEMYJvO20vpGMWZn/Skw17Ya1EPak= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by CY4PR12MB1400.namprd12.prod.outlook.com (10.168.169.21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.693.12; Tue, 1 Nov 2016 19:05:09 +0000 Subject: [PATCH] crypto: ccp - Fix handling of RSA exponent on a v5 device From: Gary R Hook To: CC: , , Date: Tue, 1 Nov 2016 14:05:05 -0500 Message-ID: <20161101190505.1191.20536.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: BN6PR17CA0033.namprd17.prod.outlook.com (10.175.189.19) To CY4PR12MB1400.namprd12.prod.outlook.com (10.168.169.21) X-MS-Office365-Filtering-Correlation-Id: 56169022-286d-4dce-e6c4-08d4028a00a0 X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1400; 2:83W7/bilVZtAiiABSfYn/xN5gu26TyZAuMh7hlTIELnqmMzlCpL4oXWcGbbHQMZKt1QLpF684pCghtdcmRGv2VB/HaVObzdWkNTFQJIH4lOFiR+DO1Ek9icey3HJLWKpBqw/7WmPT3C3TS8glKNPo5FHKBoeYGODzt8lVIy2Dy14Iytz2rNTIpVCORsXVElTU2ZTNaOjzzZxA2jZSF3y2g==; 3:4+Kbv0mXy5P9UFELP+UQlWg5cSjXEy7dCRwoxzaYfp9h/eU1xdcZvk1XxhmzHfGjKln2GddQ14sLd/x8vD48+wvFFYUDRVYvepNf82SLDQJmeWV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AMWgv31Ec5fOP2aESesXQLI3RKVnyDbvUHZTgC1MT/Et8AqZ5C1UzRo7R+1i2OwSDcR5jTDmrp+yIR2FwF7UZLA6G+2XsaxHC9QML1dpuRHQM+DyLmVaZMteoKbBffKyF1a5NFchilx3RYB/gt8w/P6nT37Zj7E683jGDgM6CBp4UVUvaB/0izmIlR63OLyOREx1f8uAIUci91/gncvrly/U1W1Inoen0fpnDA8xggLGxA1tEQqm2YLnC+3Nfo2+JjO 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)(8121501046)(5005006)(10201501046)(3002001)(6055026); SRVR:CY4PR12MB1400; BCL:0; PCL:0; RULEID:; SRVR:CY4PR12MB1400; X-Microsoft-Exchange-Diagnostics: 1; CY4PR12MB1400; 4:aUbYKvJxmVo8oPvy/5RCNfO7yowNdAC2qVq0cKRlNPxm3J4InUjH5roquqWQdnRZlniEsjYCsSiHNcTabEwcQGiG3a1RmFdsSxLlotkeh7ZBQcipPw/Q8rTcULl8ISNMmomwvUVDG6vXXq9lXMrLIL0nDcdXPRowRTRshn/fS/sMyx2oP2s0ory/2PRJtCnPivspEPCYvbygqTal4rtR3+xUxqJSWuEO1SkRbdgq3HDR9F5kDx4a/gXej30RZBYXaUmj0pCW6LptvFb0+WxOqNCW2p61mbvKTiPCmW99G02VP1Yd+d79++y2201COuewylpskoiXZS1qJAFZAOt1qz16EUGaUMwA9f8Ru9z/xo+8xuqyBL7I3IWuE8fwvVPloUGeQJeWqtcL+WEbCOYsKvxU7/tN8UyLLTihmfOciKbgg6nzGZ5t3ISG/PZy4Irfrm4eGsaJ0MYJlXbCCfqnyw== X-Forefront-PRVS: 01136D2D90 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(189002)(199003)(3846002)(81166006)(6916009)(42186005)(50986999)(110136003)(23676002)(97746001)(33716001)(9686002)(103116003)(305945005)(7846002)(86362001)(5660300001)(4326007)(47776003)(106356001)(54356999)(68736007)(66066001)(6666003)(105586002)(8676002)(7736002)(81156014)(229853001)(101416001)(2351001)(92566002)(230700001)(33646002)(4001350100001)(50466002)(19580405001)(83506001)(586003)(19580395003)(2906002)(77096005)(1076002)(97736004)(189998001)(6116002); DIR:OUT; SFP:1101; SCL:1; SRVR:CY4PR12MB1400; 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?MTtDWTRQUjEyTUIxNDAwOzIzOnpyOHlhekJhSUwveldpMDRTbWtVTGZkNE93?= =?utf-8?B?OFI5RTJ3WGxsc2xNSzlzYnp5ZDN3US9SRzR5aGY3MW45bWROZHBMTHJFUml5?= =?utf-8?B?dnAwV2RaTzBsZ01lLzBlMWR6c0FybERiSmVCcU0xWStVUTA3THh2aDYydW5U?= =?utf-8?B?bmJzbUpZc1o0ZjBHbGhBRGdBSE5rTlU4RjhqSUZSR3RNN2daWXFOeXQzZjha?= =?utf-8?B?TXo5MFZqMFgxZnJZZC9leVFBOVh0b29vQkVvVFdqVStENU04NzZvUXVvRkJO?= =?utf-8?B?M2crRTZMMHUwSDg4TE1VNVZCYXM2NFdwem4wMS9WQnB2RGloc2FyNktYSGo2?= =?utf-8?B?VkU0LzFrYjR0OTVPdEhhOFlXZ2xhbk4zc1I0RE9CdXhtRTdpUDJzQ0FKbW93?= =?utf-8?B?bU05YzUvRGs0ZUFkTEl3ZHQ3em1tR052MXZHYmUrT0hnTTJTa0d2WWdYM0Nt?= =?utf-8?B?NXhnY3JYczl3c2dtdTM0WHQ1Nkk5MEI3RnIvSGpxMkdUQTFMZ21hWHZWaVFl?= =?utf-8?B?TmpXM1c0UW9mUEpia3I2NkRWd0pSOStJeVlINUo1MXBzOW1xdFBHNzNjZFFY?= =?utf-8?B?NzF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tTXUFPi9ROLQiCcnfebyC/62nUZE/TRDsild7ucB6xUKyCU/GRin+HJJBOEuVSHofGFOKjMNlWP6HnHqJ64z7JjUTTHIa5Kq9wnu1OiFm83MhVgCsQxx7n7fLcRT7TAvJMfbb4Dg1G5BEI/DsA328FW0WKE35tn4K4+CQR0RqYZc5blNh6EHuFg2IeYcW+SFX6Zu6zXO1HR+TBI/10EoCQJt4BRtryJ65dqP0o0R2mVCex8l45IfZMwN4yqkopi6EqE=; 20:LM1jgu6/jgQl2LG92mJtokNpEvUedxuI2uTzpXDOSwvJMkoazGC4d+Xx9lhFXHwlRqspBnSBWkcSdWXQqwHxJizBuA4oMbob1fgLXUT053AadFA0wqb7FqJLxzm3Ww+c6Ctqt61hH3UqMsm5yCpejhIPIJBdC14yA8FSEtDmii8cFYIqIX/cqd6dQwm8xwqKvkiejXhOZdn6vCSEZTNRe9WK5e4wN3DGZ5ZJ/IG67sorrul1iUEvABKEvIVrV8Jf X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Nov 2016 19:05:09.9554 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR12MB1400 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); }