Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp2186727pxb; Fri, 5 Mar 2021 09:10:47 -0800 (PST) X-Google-Smtp-Source: ABdhPJwTLB6m+Ib6wI9S9niHrR0gRR9rEymJC9J9ccXAML6cbqqJFu3qwtZd9V1Cv3aNFCojbMKl X-Received: by 2002:a05:6402:12cf:: with SMTP id k15mr9717198edx.192.1614964247515; Fri, 05 Mar 2021 09:10:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614964247; cv=none; d=google.com; s=arc-20160816; b=CI1HTHr0dxUqSbPiz2J/RxifFLlP2l/yuGLijz1lg5hCdKGO5pj8NQmQALZe1wqjpH vp2ucmrU+Qd+GxeQ96h3W7nAxVgbK3SQSAP5zVQfzNS/qJxQZYMm6qPLCZECbz0QHH6v KpReSp7YST3DQm/W1XYrH5H/AcMXPmFqeHqHwDV+7KTPTvbKN4dJuXXQ6hTXpZy4FTia HCW3UStoHPd+tfvKtuh7VrB7EC5xjKlgoGk99TF8aUjI9JLQlRSpzJGTg0mecqNE8beC BmwbqAlSROBCDPU2JyzyUhh5bxzHfEUitawYPXmL5UQUMiEGiK+d8G+QP85sVcpI2W19 jZgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=k+QZ5Lcd0AEOTptKPmE0RBY+egBlQhZr+jBJ06+PV9o=; b=HDKjS8FeiltUoCD99AVddtsImEdiYatoeNJSL16a5Mm0WC/R2B4z+Ek3eY2gonS0vW i+ZwUE550arFSKN0Lj3jcvHX2vLrqPp0bWCJUSsPv7suHT/O5/x8YEhOlz52ipK8qmyc G9xFlJ0FqO8jLpTKFokC/aOYBomX6JegGbfLaqwJyjcfVEcLTqvmA8ItTSgBkr93RFFf /ds8UIjbLfx8GXQzPpqMpvPR40eikY/uv0xKqvm3LXYJXpNSZEnxAqzOJ9IllvPsvXD8 ZSF/8ThUlZSpr/asbvGVGulnRwc9VaF/ccnQ8/D6jOf5fZRFZz3jhdIFlaX/OIRqWDc6 fRtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DUEnl0ps; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hb26si1561591ejb.144.2021.03.05.09.10.09; Fri, 05 Mar 2021 09:10:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DUEnl0ps; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229882AbhCERJb (ORCPT + 99 others); Fri, 5 Mar 2021 12:09:31 -0500 Received: from mail.kernel.org ([198.145.29.99]:46070 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231469AbhCERJO (ORCPT ); Fri, 5 Mar 2021 12:09:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id E50966508F; Fri, 5 Mar 2021 17:09:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1614964154; bh=iSAxKgFD/vwZRUOiqlVYdnhWDpsTAXlNHuTrJlxdo8c=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=DUEnl0psYsE4jB1uic3SFSWjDijlhb5GA7D+kx8gfQaJ1FujXcoQEGnLlAAACPN2/ SKdbRPLK26f4zd7PQwZw7nUGvdQBPGLqYnKi4pzfEAFt6RUUi8uT5va44+hv9dLM2c 7hT5CX2K/kk0n2oFHpAedP/oh76zXTD4qIc/82r9b3rENKL4qB8VblROkysiKrYQgn E9AK28EjOxOrSWk+vC6kENxZpDH6Ng3nepoc6yx0jzUB/orSm4AFlAl0RqTyxk2f01 /Buebh3sdiLmGtsMAbV4/sLCmBA10sEXTLAckFMNCh+iiWoARk3Dp4UZaTo09psJ30 /3p13m4QdjZTw== Date: Fri, 5 Mar 2021 19:08:54 +0200 From: Jarkko Sakkinen To: Stefan Berger Cc: keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, davem@davemloft.net, herbert@gondor.apana.org.au, dhowells@redhat.com, zohar@linux.ibm.com, linux-kernel@vger.kernel.org, patrick@puiterwijk.org, linux-integrity@vger.kernel.org, Saulo Alessandre , Stefan Berger Subject: Re: [PATCH v10 2/9] crypto: Add NIST P384 curve parameters Message-ID: References: <20210305005203.3547587-1-stefanb@linux.vnet.ibm.com> <20210305005203.3547587-3-stefanb@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210305005203.3547587-3-stefanb@linux.vnet.ibm.com> Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Thu, Mar 04, 2021 at 07:51:56PM -0500, Stefan Berger wrote: > From: Saulo Alessandre > > * crypto/ecc_curve_defs.h > - add nist_p384 params > > * include/crypto/ecdh.h > - add ECC_CURVE_NIST_P384 > > * crypto/ecc.c > - change ecc_get_curve to accept nist_p384 > > Signed-off-by: Saulo Alessandre > Tested-by: Stefan Berger No explanation what the commit does. We don't need a duplicate diffstat. Instead, provide a plain English no-nonsense explanation. /Jarkko > --- > crypto/ecc.c | 2 ++ > crypto/ecc_curve_defs.h | 32 ++++++++++++++++++++++++++++++++ > include/crypto/ecdh.h | 1 + > 3 files changed, 35 insertions(+) > > diff --git a/crypto/ecc.c b/crypto/ecc.c > index 25e79fd70566..f6cef5a7942d 100644 > --- a/crypto/ecc.c > +++ b/crypto/ecc.c > @@ -50,6 +50,8 @@ const struct ecc_curve *ecc_get_curve(unsigned int curve_id) > return fips_enabled ? NULL : &nist_p192; > case ECC_CURVE_NIST_P256: > return &nist_p256; > + case ECC_CURVE_NIST_P384: > + return &nist_p384; > default: > return NULL; > } > diff --git a/crypto/ecc_curve_defs.h b/crypto/ecc_curve_defs.h > index 69be6c7d228f..b327732f6ef5 100644 > --- a/crypto/ecc_curve_defs.h > +++ b/crypto/ecc_curve_defs.h > @@ -54,4 +54,36 @@ static struct ecc_curve nist_p256 = { > .b = nist_p256_b > }; > > +/* NIST P-384 */ > +static u64 nist_p384_g_x[] = { 0x3A545E3872760AB7ull, 0x5502F25DBF55296Cull, > + 0x59F741E082542A38ull, 0x6E1D3B628BA79B98ull, > + 0x8Eb1C71EF320AD74ull, 0xAA87CA22BE8B0537ull }; > +static u64 nist_p384_g_y[] = { 0x7A431D7C90EA0E5Full, 0x0A60B1CE1D7E819Dull, > + 0xE9DA3113B5F0B8C0ull, 0xF8F41DBD289A147Cull, > + 0x5D9E98BF9292DC29ull, 0x3617DE4A96262C6Full }; > +static u64 nist_p384_p[] = { 0x00000000FFFFFFFFull, 0xFFFFFFFF00000000ull, > + 0xFFFFFFFFFFFFFFFEull, 0xFFFFFFFFFFFFFFFFull, > + 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull }; > +static u64 nist_p384_n[] = { 0xECEC196ACCC52973ull, 0x581A0DB248B0A77Aull, > + 0xC7634D81F4372DDFull, 0xFFFFFFFFFFFFFFFFull, > + 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull }; > +static u64 nist_p384_a[] = { 0x00000000FFFFFFFCull, 0xFFFFFFFF00000000ull, > + 0xFFFFFFFFFFFFFFFEull, 0xFFFFFFFFFFFFFFFFull, > + 0xFFFFFFFFFFFFFFFFull, 0xFFFFFFFFFFFFFFFFull }; > +static u64 nist_p384_b[] = { 0x2a85c8edd3ec2aefull, 0xc656398d8a2ed19dull, > + 0x0314088f5013875aull, 0x181d9c6efe814112ull, > + 0x988e056be3f82d19ull, 0xb3312fa7e23ee7e4ull }; > +static struct ecc_curve nist_p384 = { > + .name = "nist_384", > + .g = { > + .x = nist_p384_g_x, > + .y = nist_p384_g_y, > + .ndigits = 6, > + }, > + .p = nist_p384_p, > + .n = nist_p384_n, > + .a = nist_p384_a, > + .b = nist_p384_b > +}; > + > #endif > diff --git a/include/crypto/ecdh.h b/include/crypto/ecdh.h > index a5b805b5526d..e4ba1de961e4 100644 > --- a/include/crypto/ecdh.h > +++ b/include/crypto/ecdh.h > @@ -25,6 +25,7 @@ > /* Curves IDs */ > #define ECC_CURVE_NIST_P192 0x0001 > #define ECC_CURVE_NIST_P256 0x0002 > +#define ECC_CURVE_NIST_P384 0x0003 > > /** > * struct ecdh - define an ECDH private key > -- > 2.29.2 > >