From patchwork Tue Aug 22 08:08:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Labbe X-Patchwork-Id: 9914499 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 10F82600C5 for ; Tue, 22 Aug 2017 08:14:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AF72287EC for ; Tue, 22 Aug 2017 08:14:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F9982881A; Tue, 22 Aug 2017 08:14:04 +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 BCB42287EC for ; Tue, 22 Aug 2017 08:14:03 +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=IKQgdBYdzYoCa2X6jKkStknpxYlVktA3uXRuTEsiaV8=; b=U95LWmwltpg41hmv5b7U6EgFy3 ZEvRJIs2VHE02ihuhF7U3MEwEqE7ktpTIYnXbH78OlT73d0WgS7V17/MUUJE5wz20TcpgejMSqtWx Sk0fNK5kxdHJJV7uogkm6HpYNA8Di209o1wd8Ir7TJlut04VS98oe2dPX7GbylBHhB8O+QVH1y4B/ AyonhY/kcHpZW+YpdYkhUlnevX6beL8afdwmqaQT6RnfEcomdnzhGqt7K3/GqsW+nsp5jItmGoJLr 0t9I+WpMwX5noxnTVLklOE5q1JoiplVnZOuywqLnbIY+tmgvghGma/NeksDbyOxDe5rW1Lm0qmuhr F6BXpdAg==; 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 1dk4K2-0004u7-Pn; Tue, 22 Aug 2017 08:14:02 +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 1dk4H5-0001Os-Fs; Tue, 22 Aug 2017 08:11:10 +0000 Received: by mail-wr0-x242.google.com with SMTP id p8so18630205wrf.2; Tue, 22 Aug 2017 01:10:39 -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=vHzAPeWHnFxx8vk/gVblHqi5iL+gz1mFl1BtWqeZmrU=; b=NIEwOsChVq7CAa9BQMPgpr9OXuWkp18NfBWnynp5EhUN1DF4kZrAlAqvNnd1tqMTbf ppuCIz1Axy9DUDaYU0mFmQ81Tawl+f1gl9baaJhnt4M01/OwWP4vhCK3kdQqMweoLXiv 9FC6GIYsvZkOqFe5qIIWYuCZtl2vLC7RXy7pbzTXrPN+6imQkdv78ZBZKezHrfQTaZWU VZITtF5GtKmCx3peRokeBJ+a5ZDtINUB57W4W5zOUXsekhacvckc1H4UioJyRdrCVtad GUUPJoFLJMtUOzh6Vf9SlwU9c1ic1T/CAWPlFVSjKa1qnHWy5s7GqmlBl7SSVsP260k0 XSyg== 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=vHzAPeWHnFxx8vk/gVblHqi5iL+gz1mFl1BtWqeZmrU=; b=Khroztxl4YcSBoLzixmlrp0xnN1q4ivga2s4XFCBsjlEb4WS982n4k5QsvTwZqI0NI uqaBQKUxTtZ/Xybxi8qxKPB9bnuGaECqfkmnUwo3guEGTqY3oYakAHZcnuePv1F1+peP lFxbFhVE2FVshiaJDRvNph3PpHgHaMEdWS8qcY+d/eYnMca1BVnYHYhiGZahCwc4NxyB mppG96JQrz7I8hTKpgIuyTnbFLI64yCj0yXxJ+P68v6p2CTrzHz7z3Z2aE/XG4gA/Epe 31LJZiHaTZ3jFXxBqAVEwx9IqjfXkHpvwufZi+8D0clhf5i/fStGPLdAIw12rC5/yxMa Voog== X-Gm-Message-State: AHYfb5jNCHlhnYJte7+uyKMCJ2GYYgxB0c4X8KXdyjNSCHBepFS1eBRL YJhHYybA9Maujw== X-Received: by 10.28.27.69 with SMTP id b66mr1030148wmb.11.1503389438643; Tue, 22 Aug 2017 01:10:38 -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.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 22 Aug 2017 01:10:38 -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 04/11] crypto: nx - Use GCM IV size constant Date: Tue, 22 Aug 2017 10:08:11 +0200 Message-Id: <20170822080818.12486-5-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_011100_652785_3F0C33C8 X-CRM114-Status: UNSURE ( 8.96 ) 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/nx/nx-aes-gcm.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/crypto/nx/nx-aes-gcm.c b/drivers/crypto/nx/nx-aes-gcm.c index abd465f479c4..a810596b97c2 100644 --- a/drivers/crypto/nx/nx-aes-gcm.c +++ b/drivers/crypto/nx/nx-aes-gcm.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include #include @@ -433,7 +434,7 @@ static int gcm_aes_nx_encrypt(struct aead_request *req) struct nx_gcm_rctx *rctx = aead_request_ctx(req); char *iv = rctx->iv; - memcpy(iv, req->iv, 12); + memcpy(iv, req->iv, GCM_AES_IV_SIZE); return gcm_aes_nx_crypt(req, 1, req->assoclen); } @@ -443,7 +444,7 @@ static int gcm_aes_nx_decrypt(struct aead_request *req) struct nx_gcm_rctx *rctx = aead_request_ctx(req); char *iv = rctx->iv; - memcpy(iv, req->iv, 12); + memcpy(iv, req->iv, GCM_AES_IV_SIZE); return gcm_aes_nx_crypt(req, 0, req->assoclen); } @@ -498,7 +499,7 @@ struct aead_alg nx_gcm_aes_alg = { }, .init = nx_crypto_ctx_aes_gcm_init, .exit = nx_crypto_ctx_aead_exit, - .ivsize = 12, + .ivsize = GCM_AES_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, .setkey = gcm_aes_nx_set_key, .encrypt = gcm_aes_nx_encrypt, @@ -516,7 +517,7 @@ struct aead_alg nx_gcm4106_aes_alg = { }, .init = nx_crypto_ctx_aes_gcm_init, .exit = nx_crypto_ctx_aead_exit, - .ivsize = 8, + .ivsize = GCM_RFC4106_IV_SIZE, .maxauthsize = AES_BLOCK_SIZE, .setkey = gcm4106_aes_nx_set_key, .setauthsize = gcm4106_aes_nx_setauthsize,