From patchwork Wed Feb 8 19:07:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gary R Hook X-Patchwork-Id: 9563209 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 4398460236 for ; Wed, 8 Feb 2017 19:09:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256A4284FF for ; Wed, 8 Feb 2017 19:09:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 18CCF2850F; Wed, 8 Feb 2017 19:09:08 +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 28D33284FF for ; Wed, 8 Feb 2017 19:09:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751357AbdBHTJD (ORCPT ); Wed, 8 Feb 2017 14:09:03 -0500 Received: from mail-bn3nam01on0070.outbound.protection.outlook.com ([104.47.33.70]:13120 "EHLO NAM01-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751014AbdBHTI7 (ORCPT ); Wed, 8 Feb 2017 14:08:59 -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=rh8RqtIRIaSxXJ1AyT0UvZfDYMLtdjHzfnDV1yJQmYY=; b=iiwSxGXSZWrhAzHxzlDmQ/PG6vQ5ba0bDTDBWM5/QLQv+07GMa7VMh09Rx+EIML0gG26lZTD96LB5624qXTojdpEpevajDrDzifLRYYV6dMCIs0ehVdzqctf3OHly9RqiPoPq88DFtCz8nblUDid/pTJ0pxzam7XxneHEA4nQDY= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Gary.Hook@amd.com; Received: from [10.236.19.42] (165.204.77.1) by MWHPR12MB1405.namprd12.prod.outlook.com (10.169.206.16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.888.16; Wed, 8 Feb 2017 19:07:11 +0000 Subject: [PATCH] crypto: ccp - Set the AES size field for all modes From: Gary R Hook To: CC: , , Date: Wed, 8 Feb 2017 13:07:06 -0600 Message-ID: <20170208190706.7984.97805.stgit@taos> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-Originating-IP: [165.204.77.1] X-ClientProxiedBy: DM5PR18CA0027.namprd18.prod.outlook.com (10.173.208.13) To MWHPR12MB1405.namprd12.prod.outlook.com (10.169.206.16) X-MS-Office365-Filtering-Correlation-Id: 96aab34f-5cc2-44ac-f92f-08d45055af96 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(48565401081); SRVR:MWHPR12MB1405; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1405; 3:yMfBoFgaLTUsgO4PTe+carjuRRhrJb3UCb9eSBtUC34kJJZqnzo+JGSaipqv+BabYxlqSehkEEWHqOIEQzBCLISTJyZh8xwTLn2Fs3vYKq5ulLmjxc3EwAk5YtrNR/sL4mng2PRdMuPdbFKXIG9yXc+0mS+fxb9abiPGgZrxAICnPEp+G0j0god/6dSGTwLPEk5wZOH3Mh+0ma9OVELq09BWyGVvVSn5H7l2K/bwFHyuWtJU31asC7WJnTtXk2CNG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ex+8nWnOYg+SRLsf9qUEk+xI8YZGFxAOrXLIea0Arbud4HCi6sOgdht6SZHuy9I2boNdJ1ZU+dHzdV6I6i1e2Oev0Qs86LBDnnWO641zgqa1Jb5DjxQUFN4E/AbgZVYjjkCmvf6Br1ab+eT6NrvSJMLEryOAMLddRa55FOsgT1WudoquLX5ImqL4UzJVur2OBCOa5tb9BDdFP1EuV7Ia2Quw1MbyWDrWct+77My/m1Ch4az46zMiCcYxiVQG0pj32QyQkrelhdOablhqt+tI7FuozCnEcrP42wiZ X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(767451399110); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(2017020702029)(5005006)(8121501046)(20170203043)(3002001)(10201501046)(6055026)(6041248)(20161123564025)(20161123558025)(20161123560025)(20161123555025)(20161123562025)(6072148); SRVR:MWHPR12MB1405; BCL:0; PCL:0; RULEID:; SRVR:MWHPR12MB1405; X-Microsoft-Exchange-Diagnostics: 1; MWHPR12MB1405; 4:DT7DkOmTDoq85+kYd9YFypeIxHUibWE/UC2nwlGGeL1q9jYKfHWj4JKyHPdfuA0zrfFLRsL7x5r39KybKMrcKPSqWDroH4UX3Le241U1KvX/O+eDsOSonSg48qJeXxRYSQGj78V3RREkSbxSzSxkgocBYtZYyP8OcklEPZ6oq8oNcIM1ME+b0CgIx6Gh91Omatkdi3FASPmlguSboaXmDpQUO5f4EadL9avfoZyVWzBBR/25F2039PILXF5SSHdgjYQF5ib61YqnKl+fTNSi0uhiG4OhfAzdeXeZ3nvAt1JZbwSNfhJrVDBJ5qw8PazcVo5t43CSTHbXyCIokMJdnv/ar5fH5os+Iy506RnclpsRNjIFLJjqL4ONeufgCKs2U3MpE4d96OeagBZPnbweJqe3zGs/QLPGCMMdxhfiNZoQi+gNXUUZ6wvencik/l0yS/3DEng81fiMO+llrs/oAUceBA+NFzV8q1SqwsNCbm9scEvTHQqGbw+vKchTT6VvJa4dsxx83OAz36zNYF4LvqwX29ahQ1mNmksq1+wscXlw0qIadat6ofVtvMTO4PWi6Z6zm+rMMcyX0SUcp6F7lT9+t/hBQlcIaqxlIwslkWdGEgDybdrN3ALrCzaOR0tuoOViHbAYIg0ZOXID/LVcf5LNsftvmlV3VYdnMaWS13GtI+C29mrG0zWIZA6m8W9sSTXOIvHGhF4Nb4Vp5S6rZLpKR4KVlPZiZ/JckDDgcDk= X-Forefront-PRVS: 0212BDE3BE X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(6049001)(7916002)(39450400003)(39850400002)(39860400002)(39840400002)(39410400002)(189002)(199003)(105586002)(2351001)(7736002)(50466002)(106356001)(305945005)(97736004)(25786008)(90366009)(9686003)(86362001)(77096006)(5660300001)(54356999)(50986999)(97746001)(23676002)(92566002)(101416001)(54906002)(103116003)(6486002)(66066001)(33646002)(81156014)(81166006)(8676002)(6666003)(2906002)(4001350100001)(53936002)(4326007)(230700001)(33716001)(6916009)(83506001)(189998001)(110136004)(38730400002)(42186005)(68736007)(3846002)(1076002)(6116002)(47776003); DIR:OUT; SFP:1101; SCL:1; SRVR:MWHPR12MB1405; 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?MTtNV0hQUjEyTUIxNDA1OzIzOnFvK0xmbUlLZitBZlZ2a2hNd2xYK3BoV0wz?= =?utf-8?B?UXBQL1didEhFZVE0ZS9pU3pWamo5Z0kyRGg5VUU1OEc4T2prekRNbnBNT0Zr?= =?utf-8?B?ZzVTMW1GOXRXRzZnNWdzZUxIZUQ1OTcydjZBMGRRV3dZSzlsU1ViRFYrTzVa?= =?utf-8?B?cEhCenBBUGxkaGhyS3pVby9iMUdKa1IzdUMrcHJiVkpYcEEvV0xTVjJKQjVC?= =?utf-8?B?c1hncWxUcVAvSnhpODdVNWs2TDRZUV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ULwWb4t0ZM0O0ijh4WAhbW7WrOoKGLNi6qhw==; 20:3abQPVlyw8W6V7tPDlNgEVODE8LsjWfJ6MIK7jZsdCEOKJwEyua6SxdT+58Hy9nlS4GNeasHIUTruNo/0bYINEbKNFw6BT/FFpj7gQR4TJ0fJEOAOLvGs8t9aMbccNwpUa+gcuIeJheg86fKMEFnx37z8Lq+r/vt7TPnVOU2jZzvip14DcYGRPHKynOWnOeS7IRvysJGTXH8b9JK6RLJ6nuIFovXOni/U2h5kKmt8ko07uRn8pyTC96LvS//FTzR X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2017 19:07:11.0988 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: MWHPR12MB1405 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 Ensure that the size field is correctly populated for all AES modes. Signed-off-by: Gary R Hook --- drivers/crypto/ccp/ccp-dev-v5.c | 3 +-- drivers/crypto/ccp/ccp-dev.h | 1 + drivers/crypto/ccp/ccp-ops.c | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/crypto/ccp/ccp-dev-v5.c b/drivers/crypto/ccp/ccp-dev-v5.c index 612898b..9c6ff8b8 100644 --- a/drivers/crypto/ccp/ccp-dev-v5.c +++ b/drivers/crypto/ccp/ccp-dev-v5.c @@ -284,8 +284,7 @@ static int ccp5_perform_aes(struct ccp_op *op) CCP_AES_ENCRYPT(&function) = op->u.aes.action; CCP_AES_MODE(&function) = op->u.aes.mode; CCP_AES_TYPE(&function) = op->u.aes.type; - if (op->u.aes.mode == CCP_AES_MODE_CFB) - CCP_AES_SIZE(&function) = 0x7f; + CCP_AES_SIZE(&function) = op->u.aes.size; CCP5_CMD_FUNCTION(&desc) = function.raw; diff --git a/drivers/crypto/ccp/ccp-dev.h b/drivers/crypto/ccp/ccp-dev.h index 649e561..2b5c01f 100644 --- a/drivers/crypto/ccp/ccp-dev.h +++ b/drivers/crypto/ccp/ccp-dev.h @@ -467,6 +467,7 @@ struct ccp_aes_op { enum ccp_aes_type type; enum ccp_aes_mode mode; enum ccp_aes_action action; + unsigned int size; }; struct ccp_xts_aes_op { diff --git a/drivers/crypto/ccp/ccp-ops.c b/drivers/crypto/ccp/ccp-ops.c index 50fae44..6878160 100644 --- a/drivers/crypto/ccp/ccp-ops.c +++ b/drivers/crypto/ccp/ccp-ops.c @@ -692,6 +692,14 @@ static int ccp_run_aes_cmd(struct ccp_cmd_queue *cmd_q, struct ccp_cmd *cmd) goto e_ctx; } } + switch (aes->mode) { + case CCP_AES_MODE_CFB: /* CFB128 only */ + case CCP_AES_MODE_CTR: + op.u.aes.size = AES_BLOCK_SIZE * BITS_PER_BYTE - 1; + break; + default: + op.u.aes.size = 0; + } /* Prepare the input and output data workareas. For in-place * operations we need to set the dma direction to BIDIRECTIONAL