From patchwork Tue Aug 22 08:08:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9914541 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 794E5600C5 for ; Tue, 22 Aug 2017 08:16:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80C8828806 for ; Tue, 22 Aug 2017 08:16:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7569528820; Tue, 22 Aug 2017 08:16:13 +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 05C5C28806 for ; Tue, 22 Aug 2017 08:16:13 +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=Z9CBWTvRA4zjK8MCTd6YSXUUJ0TBvI+SXpadsDhEjhk=; b=hKtj2UljuINBqO1tLhyXZvzv+d YTKGMbT0lF6WXG3IfDf4vVqdgUYVUgA7Ve/WyBc7l+cYp4lkZg9pPXgWE1NipV640iLDtpIKBCOSe IqmaMFJf7boKct0rJ7iUrjm7rMGASGFHN3DFTySrj4EQZMJYQESU6Ln3Zjeg+CrCBNUehP0UWUOed RplAl7GwXiO0nDVH9QH2KQUb0Ep75NtRLfRAQ9x66kS6A5kMTb6gwRoZePA2xHF1g3ciX4kuRmE3O FtA0kcd7M6K9hYN1DraMK4Y3z2kUGRezB4B+OOq1dNkxU/uVaI/HurpF3ks3oURbn6GU0B+tnKiWs Ydr5fMsA==; 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 1dk4M7-0008Pz-Bb; Tue, 22 Aug 2017 08:16:11 +0000 Received: from mail-wr0-x244.google.com ([2a00:1450:400c:c0c::244]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1dk4H7-0001S4-M8; Tue, 22 Aug 2017 08:11:17 +0000 Received: by mail-wr0-x244.google.com with SMTP id p8so18630548wrf.2; Tue, 22 Aug 2017 01:10:45 -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=dIwp+3sz/7hbMxubWLE06UFA7xbHV/SEuKAsP5IKeiQ=; b=mOH6/dIDEz3iTEdMWzJqSBzqLC95QamaVVn7B5GkzJjMp95LEpsZGPtcN0Au3n36m6 CKl1CrOeiB9ZPxQF9Yj+4JvjDxZC/uErHAkP/XJXa1ZkQdCJKttHHG8t3VK5vCCzsG/4 5DNNIddxh75ABpspW6q2OIofE1FSYfXR0cahQYyjYAcmFsDVCWsHH9gfu1+mF5AFVuOX cC0Exz2k0G0lWrLJquRcQMjS+h56eirfOkCcHEneMT7BDIb8f7hM2q2knOJs8Ql7X4RL cMkY17CZ3PbR/fge+Zw+S7P7zEn47o+sb3APa3d/PTj0CEJhCclITDBvXQDlrX0CmSOg ZNCg== 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=dIwp+3sz/7hbMxubWLE06UFA7xbHV/SEuKAsP5IKeiQ=; b=PNXb9kSKx1NdiPYIb3/yNOnEnc3Pv3at765agFiULuUG5VqEfjygKp0X9mM4pqQrpu Q5PHwRw3eUS5YkyBYbDQSkKQK1dT1mmC4zt45k6UkMf5V1jdTsjkAqfWOFFon/hRHf+Q cHw120iklQYaUS8Fhyo67+Mc7Bq+NnqpAYPttBFt/lzjKiifpSDeJxuU4k89uf98Y/Lu kpM1FFad7AXDTt8RY3ayHO/tDlIqgDdWpQlDyJaZfAw1TY+CnuEwHKXDtPF5EjgW8gld z6PSo+K03tD1Q9KfUHJwBsHf8AnzPm+qtIM0mk4zyHH/Vioq630Fmtu2KjlCIRR234KF 8SCQ== X-Gm-Message-State: AHYfb5j3DelTAV1f7QbFkpCyd9llBgcpnU4mPHK8utz+UcrzASp1oK43 uPFzqfezWhG7CQ== X-Received: by 10.223.179.211 with SMTP id x19mr13229887wrd.7.1503389443972; Tue, 22 Aug 2017 01:10:43 -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.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:10:43 -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 08/11] crypto: chelsio - Use GCM IV size constant Date: Tue, 22 Aug 2017 10:08:15 +0200 Message-Id: <20170822080818.12486-9-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_011102_846412_B0BB8924 X-CRM114-Status: UNSURE ( 9.43 ) 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/chelsio/chcr_algo.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/chelsio/chcr_algo.c b/drivers/crypto/chelsio/chcr_algo.c index 0e8160701833..936bdd895efa 100644 --- a/drivers/crypto/chelsio/chcr_algo.c +++ b/drivers/crypto/chelsio/chcr_algo.c @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -2534,9 +2535,9 @@ static struct sk_buff *create_gcm_wr(struct aead_request *req, if (get_aead_subtype(tfm) == CRYPTO_ALG_SUB_TYPE_AEAD_RFC4106) { memcpy(reqctx->iv, aeadctx->salt, 4); - memcpy(reqctx->iv + 4, req->iv, 8); + memcpy(reqctx->iv + 4, req->iv, GCM_RFC4106_IV_SIZE); } else { - memcpy(reqctx->iv, req->iv, 12); + memcpy(reqctx->iv, req->iv, GCM_AES_IV_SIZE); } *((unsigned int *)(reqctx->iv + 12)) = htonl(0x01); @@ -3385,7 +3386,7 @@ static struct chcr_alg_template driver_algs[] = { sizeof(struct chcr_aead_ctx) + sizeof(struct chcr_gcm_ctx), }, - .ivsize = 12, + .ivsize = GCM_AES_IV_SIZE, .maxauthsize = GHASH_DIGEST_SIZE, .setkey = chcr_gcm_setkey, .setauthsize = chcr_gcm_setauthsize, @@ -3405,7 +3406,7 @@ static struct chcr_alg_template driver_algs[] = { sizeof(struct chcr_gcm_ctx), }, - .ivsize = 8, + .ivsize = GCM_RFC4106_IV_SIZE, .maxauthsize = GHASH_DIGEST_SIZE, .setkey = chcr_gcm_setkey, .setauthsize = chcr_4106_4309_setauthsize,