From patchwork Tue Aug 22 08:08:10 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9914501 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 63485600C5 for ; Tue, 22 Aug 2017 08:14:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6CD58287EC for ; Tue, 22 Aug 2017 08:14:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 612FC2881A; Tue, 22 Aug 2017 08:14:06 +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=-2.6 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 13397287EC for ; Tue, 22 Aug 2017 08:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=Rff7/LibIBqX7f/TIjB6qN/YTaR+ijSQ1FFDWv+Vyp8=; b=avaq26pgxJq9NmIyJ6iEQV5gED PFEE0lchNqQwmAryGwFZzcZhNKRSZXx2J912YH9tz0DybscTdFjeOJ6mGca6VVC2ejKEF9LApOyP6 JCoB4WFiULNZDlsgzYfgZvCbvz2vnqztQpmyBBQxP70rfPxcQ8ZwmPO71plljXKWrjySJNK3L1K/D feg/sJnOqDdW6x/sVyFXjEgf7yy54O68d2vo5mrrz43bWYXH94ObdDvzAd9wTiMpk69/FJzRbHPyc GPBIlRFTofjRbDV8BJezOYkVbqdFujhJargBvshvROXI29WD4OIvAVDjOW1aViYBMUdZ5kBghUwCD MB166uAQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1dk4K4-0004xB-Cw; Tue, 22 Aug 2017 08:14:04 +0000 Received: from mail-wr0-x242.google.com ([2a00:1450:400c:c0c::242]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk4H1-0001Op-0O; Tue, 22 Aug 2017 08:11:10 +0000 Received: by mail-wr0-x242.google.com with SMTP id z91so21509109wrc.4; Tue, 22 Aug 2017 01:10:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=6hqsbdEupEvzNfiRcsut3rH0IZjWn0qN/RaWhNB1oZw=; b=jenjSffSa+sh4XkoFIAL/DL6gqT1yT/ib9/LCE+7/elnlEkYE1Jqr1zwWBFNejDP9m zey9cZIgXKSNF3RKCHgbasckz9tqwJZPsDZVR8mMUm8VWwsBqv2IaCL3X9Acy2TzBVR/ avN/8HloENLQBmWp7PrFY13fED/ZUEXa2f6/FIv+BDMOhL0Ozjpbleh1MCQmt7S/2Q0M ATd6VfQXs600U8JAQTiLoq6lhMANSaVzAJ/rOeUhNm5qqrBeRNGBl+PCLfiUqpsAe9u3 F5WCLf2Z6NiXDx1hRhyr3Q+qH0EbtjKJ66djMdorU0Oe8CfLiAuQkpltQs0zz0JV4XYf WMgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=6hqsbdEupEvzNfiRcsut3rH0IZjWn0qN/RaWhNB1oZw=; b=LrX3iigtL/mpK/Z9er/r8A9Zqot1+me/u8TqpAAgEfor6FKKhjU1syV9SBHra10L/Y zSgCgTg4BD+7pC6d8SmDYoAFwHJCKntMVjlsl32Vl0cRlkesrEOMuOfJNYjlmyXsSRlL 5Pp9QO3pF0gY3KgN28A4OXpe0AJBHlE40QuHjGHuMFMcoaooRjYi6RhOIB/7Sr24v9R/ 9IeVYTtQrNqP61WhuEi18NTCdgl0Mxd6D+cTlgXESo6EqyQKDazHW4Cm55yCFMdRZE0+ GZQhaAsQBj4IVWpPWE0nQmT9qjrmarKBpnbFWmfPtSkb8cc0Dmj/CCj9gMXuwY1kuKfa lO8A== X-Gm-Message-State: AHYfb5gOGYDgS/ahGefeuHKjHfVfKF9frQE4dqRWs/qm48DbJtPkpAD8 BaKbaezA15XjNA== X-Received: by 10.28.105.217 with SMTP id z86mr5377612wmh.22.1503389437302; Tue, 22 Aug 2017 01:10:37 -0700 (PDT) Received: from Red.local (LFbn1-1-65-78.w90-118.abo.wanadoo.fr. [90.118.156.78]) by smtp.googlemail.com with ESMTPSA id e21sm10778796wme.17.2017.08.22.01.10.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:10:36 -0700 (PDT) From: Corentin Labbe To: herbert@gondor.apana.org.au, davem@davemloft.net, tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com, x86@kernel.org, horia.geanta@nxp.com, dan.douglass@nxp.com, thomas.lendacky@amd.com, gary.hook@amd.com, harsh@chelsio.com, matthias.bgg@gmail.com, leosilva@linux.vnet.ibm.com, pfsmorigo@linux.vnet.ibm.com, benh@kernel.crashing.org, paulus@samba.org, mpe@ellerman.id.au Subject: [PATCH 03/11] crypto: ccp - Use GCM IV size constant Date: Tue, 22 Aug 2017 10:08:10 +0200 Message-Id: <20170822080818.12486-4-clabbe.montjoie@gmail.com> X-Mailer: git-send-email 2.13.5 In-Reply-To: <20170822080818.12486-1-clabbe.montjoie@gmail.com> References: <20170822080818.12486-1-clabbe.montjoie@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170822_011055_577565_ACA8EE3D X-CRM114-Status: GOOD ( 10.62 ) X-BeenThere: linux-mediatek@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, Corentin Labbe , linux-crypto@vger.kernel.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "Linux-mediatek" Errors-To: linux-mediatek-bounces+patchwork-linux-mediatek=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replace GCM IV size value by their constant name. Signed-off-by: Corentin Labbe --- drivers/crypto/ccp/ccp-crypto-aes-galois.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/ccp/ccp-crypto-aes-galois.c b/drivers/crypto/ccp/ccp-crypto-aes-galois.c index 52313524a4dd..ff02b713c6f6 100644 --- a/drivers/crypto/ccp/ccp-crypto-aes-galois.c +++ b/drivers/crypto/ccp/ccp-crypto-aes-galois.c @@ -19,13 +19,12 @@ #include #include #include +#include #include #include #include "ccp-crypto.h" -#define AES_GCM_IVSIZE 12 - static int ccp_aes_gcm_complete(struct crypto_async_request *async_req, int ret) { return ret; @@ -95,9 +94,9 @@ static int ccp_aes_gcm_crypt(struct aead_request *req, bool encrypt) */ /* Prepare the IV: 12 bytes + an integer (counter) */ - memcpy(rctx->iv, req->iv, AES_GCM_IVSIZE); + memcpy(rctx->iv, req->iv, GCM_AES_IV_SIZE); for (i = 0; i < 3; i++) - rctx->iv[i + AES_GCM_IVSIZE] = 0; + rctx->iv[i + GCM_AES_IV_SIZE] = 0; rctx->iv[AES_BLOCK_SIZE - 1] = 1; /* Set up a scatterlist for the IV */ @@ -160,7 +159,7 @@ static struct aead_alg ccp_aes_gcm_defaults = { .encrypt = ccp_aes_gcm_encrypt, .decrypt = ccp_aes_gcm_decrypt, .init = ccp_aes_gcm_cra_init, - .ivsize = AES_GCM_IVSIZE, + .ivsize = GCM_AES_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, .base = { .cra_flags = CRYPTO_ALG_TYPE_ABLKCIPHER |