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: 9914477 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 864E5600C5 for ; Tue, 22 Aug 2017 08:12:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9107F2881A for ; Tue, 22 Aug 2017 08:12:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8572C28829; Tue, 22 Aug 2017 08:12:40 +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 F3C3E2881A for ; Tue, 22 Aug 2017 08:12:39 +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=52HnUEY5BRjsiLY5szUrzo1vbViTjc6eA+ZjOxaFiTE=; b=AcGfKSB6fTdu2KfOLPTYV4VbFw pV8iXMz9YgfvXEg+vTJ6r0E/iJre3Hq1nSLV9LL63NM4eiP6CxR+xpsLgFcc59EgXcvU4fEmTEErK ji2ydOdvaqijMn+I3eBw0yyWIAgBQ66VPQUFqJ301vs6qeqTeMFDvN1FTesiuEiPdYCBQFcwPheq1 ztfwVBDHZ1T+muAj+P2m5JpkRyirBOQ++4geK9KsscEe1IF08JlOg5FzpL08K/vUPHD8O1V3kqnmk 0RwlOhmWaiyivdzhOEivlljZoaSjiSnVO0hkv8CigT7hdAzlqessWIHGsoNImeOEGBguvGaWB5pk1 l/+3M1ww==; 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 1dk4Ig-0003Rg-K1; Tue, 22 Aug 2017 08:12:38 +0000 Received: from mail-wr0-x243.google.com ([2a00:1450:400c:c0c::243]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk4H2-0001NK-2h; Tue, 22 Aug 2017 08:11:08 +0000 Received: by mail-wr0-x243.google.com with SMTP id f8so16134242wrf.3; Tue, 22 Aug 2017 01:10:37 -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=cPpE6pYe2dmhKfxMV64nwVjfhKe78eZLkSjMtkKHEWaJCA1vAnYNz+G7sJf1szGOFn I2cxJsGg6beViLH/GHsTE9cv1j5TW6bivO30ePmqoKFrqucdC7yguT1xV42Cb8g1yznJ Cs+hK8s4HTVJkhE3op05BGrWgzs/QCSnTjqpZ8lGko1DnNKNSH6fxdKy0ACxHaZFD8+W ThrRVpAZb4VXp6xLLCffOsNP4Nrxf8NtLgOnCTRjhXK8x+eRTJtHM8nRIbWTGxjdpUnN Qtg4eR36IrAMBE4Pig9D8fq8yKE1gJvR5z57eIHj2R++CqNw83uoy796DyIMde3+6mKQ tiNw== X-Gm-Message-State: AHYfb5i+Pk7gcsStrwzjj1xyJGSx3xtnKXQsuh3nAgNdnKnKmq41FTgM MC1YpzcHAMSvKA== 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 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> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170822_011056_842094_AD713C11 X-CRM114-Status: GOOD ( 10.73 ) 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/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