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: 804322 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [103.22.144.68]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3xc3W26t4fz9t16 for ; Tue, 22 Aug 2017 18:24:14 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I74WEDpd"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 3xc3W25nLQzDqFw for ; Tue, 22 Aug 2017 18:24:14 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I74WEDpd"; dkim-atps=neutral X-Original-To: linuxppc-dev@lists.ozlabs.org Delivered-To: linuxppc-dev@lists.ozlabs.org Received: from mail-wr0-x241.google.com (mail-wr0-x241.google.com [IPv6:2a00:1450:400c:c0c::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 3xc3CR6mdYzDql8 for ; Tue, 22 Aug 2017 18:10:43 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="I74WEDpd"; dkim-atps=neutral Received: by mail-wr0-x241.google.com with SMTP id a47so753538wra.0 for ; Tue, 22 Aug 2017 01:10:43 -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=NotoaxGtU5QaiX/4JrxVeya+pg8dxUEZ720GYbmIcageEDijx0f641Rwa2T5LYgxpn QaegyG4q8x+qbGY00pqEizUH1HSo7ZDND0+Eh+d6RB9Sqw6dkInBPbR5f0IipHAesDNI uAJumDMO3izKJI3d0IfAGr5y22Xh+1IKWjpfP8lDEvjmi2f846WKBxaRidXao66bNxWu 42tL7PHf6PaWfq4h6pNuNOXm2QX/msHtXhisCw5lk0vJilQw6zNVeL/beUiqBDE9mr7g RIZsS+WuEY6CqquZ9atEd+WjqivfnJFr2WVdgRONFW9B+eT77b4MNx2nlKVRiBPiP1IU tLIw== X-Gm-Message-State: AHYfb5gsNmDAAaZcGRJ/oeYc2856CpyQvo1d00+u3kY8TEi/Qk2/Gy6l rSwxUPgiolagEQ== 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-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Linux on PowerPC Developers Mail List 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 Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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