From patchwork Tue Aug 22 08:08:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9914565 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 86F00600C5 for ; Tue, 22 Aug 2017 08:17:39 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8D3D92881A for ; Tue, 22 Aug 2017 08:17:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 81B7528806; Tue, 22 Aug 2017 08:17:39 +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.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=unavailable 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 3A55828806 for ; Tue, 22 Aug 2017 08:17:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932126AbdHVIRf (ORCPT ); Tue, 22 Aug 2017 04:17:35 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:36871 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932122AbdHVIKh (ORCPT ); Tue, 22 Aug 2017 04:10:37 -0400 Received: by mail-wr0-f195.google.com with SMTP id z91so21509038wrc.4; Tue, 22 Aug 2017 01:10:36 -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=nN20BStavlTIA463lcbViCgw/MJpJHZLy+PB4/o2yjU=; b=lmDfx6FdVIhHKwSwJHzrDiVtavVd0YXp4eZiRwq+WaF2WWXgePMA2x2z7YCGGWkkoP ra9mmcXJjRLmxYu97BZ5BjljP/UYsJ6XrWfbnDywVvoPpewUmSUBQuoZyl9F2qVJ66G3 VYXLicNblM+32AqszOgPvbKTsFi+Sk5uBymNAomVPNmZTn4gXuc1no6e1bV5bUEclbyA e6kDr0F9xOljFJpHYMJB6ayVkkuqF978cz0HtwQy+ulhsAWQQKJuvae/G2Ozj3TXcPT6 eaNYqBgU7P2M7+dFe5gJfr5Q4D8p3PmP9wsy8CcR+G+ENcQVSyXXKC7+mmz8vBSCmMog TYjQ== 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=nN20BStavlTIA463lcbViCgw/MJpJHZLy+PB4/o2yjU=; b=gY6wnv+wjwN2LyZfS0qRb8E5kIeltWpw2SUgRrIVz4OGwtNawPFOl9FD70Spsm9pZk SRuepFjuHQ6J2ExCpL49zbDybPeCjVhRki7yAdQkUHXMdTLhIntkasToNP5SBVTuwrJi iNCYquWxvJGJftHieAt7qn3Ug7PkKpRZ0I8iuDbjTG4f9iUsgEDzCqV/E9zKM6JL02wc VJFitZWDNSUpasf8csKjI/j8xwhKg6PLPe6MSwdZ1OYO9mP30iC2FXm5zludZIVx7qop nGgIiUQxT7cR8X5cWxNAaZagao0hof856kVZ02BxbKZDU3t+sVVrbtLb6BzyDjLIt3wJ L2Cw== X-Gm-Message-State: AHYfb5jRK9slG63jhFP/UbG4QFrkQ753emDC/4OB1h78HExawN6AHm/c oVW6Lzlp7z9mFA== X-Received: by 10.223.162.9 with SMTP id p9mr11923340wra.236.1503389436097; Tue, 22 Aug 2017 01:10:36 -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.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:10:35 -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 Cc: linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Corentin Labbe Subject: [PATCH 02/11] crypto: caam - Use GCM IV size constant Date: Tue, 22 Aug 2017 10:08:09 +0200 Message-Id: <20170822080818.12486-3-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> 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 This patch replace GCM IV size value by their constant name. Signed-off-by: Corentin Labbe --- drivers/crypto/caam/caamalg.c | 10 +++++----- drivers/crypto/caam/compat.h | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c index 54f3b375a453..baa8dd52472d 100644 --- a/drivers/crypto/caam/caamalg.c +++ b/drivers/crypto/caam/caamalg.c @@ -992,7 +992,7 @@ static void init_gcm_job(struct aead_request *req, struct caam_ctx *ctx = crypto_aead_ctx(aead); unsigned int ivsize = crypto_aead_ivsize(aead); u32 *desc = edesc->hw_desc; - bool generic_gcm = (ivsize == 12); + bool generic_gcm = (ivsize == GCM_AES_IV_SIZE); unsigned int last; init_aead_job(req, edesc, all_contig, encrypt); @@ -1004,7 +1004,7 @@ static void init_gcm_job(struct aead_request *req, /* Read GCM IV */ append_cmd(desc, CMD_FIFO_LOAD | FIFOLD_CLASS_CLASS1 | IMMEDIATE | - FIFOLD_TYPE_IV | FIFOLD_TYPE_FLUSH1 | 12 | last); + FIFOLD_TYPE_IV | FIFOLD_TYPE_FLUSH1 | GCM_AES_IV_SIZE | last); /* Append Salt */ if (!generic_gcm) append_data(desc, ctx->key + ctx->cdata.keylen, 4); @@ -1953,7 +1953,7 @@ static struct caam_aead_alg driver_aeads[] = { .setauthsize = rfc4106_setauthsize, .encrypt = ipsec_gcm_encrypt, .decrypt = ipsec_gcm_decrypt, - .ivsize = 8, + .ivsize = GCM_RFC4106_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, .caam = { @@ -1971,7 +1971,7 @@ static struct caam_aead_alg driver_aeads[] = { .setauthsize = rfc4543_setauthsize, .encrypt = ipsec_gcm_encrypt, .decrypt = ipsec_gcm_decrypt, - .ivsize = 8, + .ivsize = GCM_RFC4543_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, .caam = { @@ -1990,7 +1990,7 @@ static struct caam_aead_alg driver_aeads[] = { .setauthsize = gcm_setauthsize, .encrypt = gcm_encrypt, .decrypt = gcm_decrypt, - .ivsize = 12, + .ivsize = GCM_AES_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, }, .caam = { diff --git a/drivers/crypto/caam/compat.h b/drivers/crypto/caam/compat.h index 7149cd2492e0..5b8d930f3dd8 100644 --- a/drivers/crypto/caam/compat.h +++ b/drivers/crypto/caam/compat.h @@ -31,6 +31,7 @@ #include #include #include +#include #include #include #include