From patchwork Tue Aug 22 08:08:13 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9914525 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 782E7600C5 for ; Tue, 22 Aug 2017 08:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8129228806 for ; Tue, 22 Aug 2017 08:15:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 754C728820; Tue, 22 Aug 2017 08:15:21 +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=unavailable 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 038A128806 for ; Tue, 22 Aug 2017 08:15:21 +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=9YWWPoelZMsuIyqLtjo+Ln784bKAlT/PbzNzU1M8xn4=; b=S9nm5DxReranRLWVP+bqXtB56t aDM/H7QcAHFCr9VLOhtnfgmJdBugw/WpTi0Q5x2pUHO/Gqfdcse2cdu2xUUusGZPnJpZrd2dN416n 5XSQQqtxgzLJVL3EeUnquC/A9TXMc0e9LjS2F+qD1uqFVxKxQHVJcdFR1+wNasU6i7VOl/zBxReNW e9gZMz+1yfOnY/RvtXOKy3bRleRAklIVDGWGRa3Lgw335N3Cim65XAYYsEw4V+y/0c0kEs+S1dvF8 U7Jt4YWarJkST9JGLW8mzc86RITbxr1+/UTvrjvURHPcDJcU54UG4cX4ONyaoGUNHtcCfn30jSrKr ZFRTeCyw==; 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 1dk4LI-0007Pz-0R; Tue, 22 Aug 2017 08:15:20 +0000 Received: from mail-wr0-x241.google.com ([2a00:1450:400c:c0c::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk4H9-0001RE-1I; Tue, 22 Aug 2017 08:11:14 +0000 Received: by mail-wr0-x241.google.com with SMTP id p14so16007581wrg.1; Tue, 22 Aug 2017 01:10:42 -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=c85dKQGI3e/Uww+zRaTTwtOnFg1xNqu/a9lZxgnocMY=; b=I74WEDpdPkDxD6oXKWAK/CgukEWYjVJiaz9/+cSqZrQohHSZojDi+g7KNXU28D6B+d LntjonFDxtbJ1YgcPLBMG10Lah/fBvs1rJkS6iZuEdAyQi86ebLH2IZoBmk7Yi5T35Lf LsUA/MnxV6kFSivyOjS/dsfzsqF83YXlgarAPxcQ7JCH+be+K/YR3R/RdZj48CTDw8ay Y711SxcfyHIt+4nTnKxtMxvSjuXAAG9AEI/badodvMa95YIUQRUPgaAyeZIkbCxet8wv yOh6xJkSbIPaf2gDWHuU2M7jks7AFr/PAdwkRNQJwqYMp2WN7L4kQZ8oSrfLODyOHBBf p6qw== 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=c85dKQGI3e/Uww+zRaTTwtOnFg1xNqu/a9lZxgnocMY=; b=nSHYystv7fucyuUd4Y5qR8NaXcYaFrcDlfyKGDu8LktOhLSLqtMphSfOHFqjI86Usw FrLS5gUzkZXxcRIOPjQl3IE0fbo3VJ7PhN8ZaSdJ5w4qSVmp+FJdztxRN6mtkXEJL3I2 ZYz+Kt7b3pT60o/lOn+36CXtWRCUHEH4SL6X7jzbeTIrZhWJ1SBVprX1cbZleUeOdbMM in+Rsst/bLO85FfUFIgpiS0wxYXK9OGhZ9SP+X156vz8YooWbifZfjpwcfWthmMS34tZ S1B9g5voQeqFTnVZlRK10HW1ne4gEFJkOMhVIN734QNz8Qa0lTy2MXuzmwA8YKS5bqIq a3xA== X-Gm-Message-State: AHYfb5jMV22CaplV4RwKTWTRJySmAR9GGGvc2Q7J1BGbgh2dt8DM3p93 BLOFppdcEfg9Eg== X-Received: by 10.223.162.132 with SMTP id s4mr9905809wra.240.1503389441403; Tue, 22 Aug 2017 01:10:41 -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.39 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:10:40 -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 06/11] crypto: bcm - Use GCM IV size constant Date: Tue, 22 Aug 2017 10:08:13 +0200 Message-Id: <20170822080818.12486-7-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_011103_980518_B8B248DB X-CRM114-Status: UNSURE ( 9.52 ) X-CRM114-Notice: Please train this message. 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/bcm/cipher.c | 8 ++++---- drivers/crypto/bcm/cipher.h | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/crypto/bcm/cipher.c b/drivers/crypto/bcm/cipher.c index 8685c7e4debd..537a67483aa3 100644 --- a/drivers/crypto/bcm/cipher.c +++ b/drivers/crypto/bcm/cipher.c @@ -1367,11 +1367,11 @@ static int handle_aead_req(struct iproc_reqctx_s *rctx) * expects AAD to include just SPI and seqno. So * subtract off the IV len. */ - aead_parms.assoc_size -= GCM_ESP_IV_SIZE; + aead_parms.assoc_size -= GCM_RFC4106_IV_SIZE; if (rctx->is_encrypt) { aead_parms.return_iv = true; - aead_parms.ret_iv_len = GCM_ESP_IV_SIZE; + aead_parms.ret_iv_len = GCM_RFC4106_IV_SIZE; aead_parms.ret_iv_off = GCM_ESP_SALT_SIZE; } } else { @@ -3255,7 +3255,7 @@ static struct iproc_alg_s driver_algs[] = { .cra_flags = CRYPTO_ALG_NEED_FALLBACK }, .setkey = aead_gcm_esp_setkey, - .ivsize = GCM_ESP_IV_SIZE, + .ivsize = GCM_RFC4106_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, .cipher_info = { @@ -3301,7 +3301,7 @@ static struct iproc_alg_s driver_algs[] = { .cra_flags = CRYPTO_ALG_NEED_FALLBACK }, .setkey = rfc4543_gcm_esp_setkey, - .ivsize = GCM_ESP_IV_SIZE, + .ivsize = GCM_RFC4106_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, .cipher_info = { diff --git a/drivers/crypto/bcm/cipher.h b/drivers/crypto/bcm/cipher.h index 57a55eb2a255..763c425c41ca 100644 --- a/drivers/crypto/bcm/cipher.h +++ b/drivers/crypto/bcm/cipher.h @@ -23,6 +23,7 @@ #include #include #include +#include #include #include @@ -39,8 +40,6 @@ #define ARC4_STATE_SIZE 4 #define CCM_AES_IV_SIZE 16 -#define GCM_AES_IV_SIZE 12 -#define GCM_ESP_IV_SIZE 8 #define CCM_ESP_IV_SIZE 8 #define RFC4543_ICV_SIZE 16