[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <16d9e3a3-f463-35e9-ddc7-632bfb278eda@suse.de>
Date: Mon, 21 Feb 2022 15:17:47 +0100
From: Hannes Reinecke <hare@...e.de>
To: Nicolai Stange <nstange@...e.de>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: Stephan Müller <smueller@...onox.de>,
Torsten Duwe <duwe@...e.de>,
David Howells <dhowells@...hat.com>,
Jarkko Sakkinen <jarkko@...nel.org>,
linux-crypto@...r.kernel.org, linux-kernel@...r.kernel.org,
keyrings@...r.kernel.org
Subject: Re: [PATCH v4 09/15] crypto: dh - implement private key generation
primitive for ffdheXYZ(dh)
On 2/21/22 13:10, Nicolai Stange wrote:
> The support for NVME in-band authentication currently in the works ([1])
> needs to generate ephemeral DH keys for use with the RFC 7919 safe-prime
> FFDHE groups.
>
> In analogy to ECDH and its ecc_gen_privkey(), implement a
> dh_safe_prime_gen_privkey() and invoke it from the ffdheXYZ(dh) templates'
> common ->set_secret(), i.e. dh_safe_prime_set_secret(), in case the input
> ->key_size is zero.
>
> As the RFC 7919 FFDHE groups are classified as approved safe-prime groups
> by SP800-56Arev3, it's worthwhile to make the new
> dh_safe_prime_gen_privkey() to follow the approach specified in
> SP800-56Arev3, sec. 5.6.1.1.3 ("Key-Pair Generation Using Extra Random
> Bits") in order to achieve conformance.
>
> SP800-56Arev3 specifies a lower as well as an upper bound on the generated
> key's length:
> - it must be >= two times the maximum supported security strength of
> the group in question and
> - it must be <= the length of the domain parameter Q.
>
> For any safe-prime group Q = (P - 1)/2 by definition and the individual
> maximum supported security strengths as specified by SP800-56Arev3 have
> been made available as part of the FFDHE dh_safe_prime definitions
> introduced with a previous patch. Make dh_safe_prime_gen_privkey() pick
> twice the maximum supported strength rounded up to the next power of two
> for the output key size. This choice respects both, the lower and upper
> bounds given by SP800-90Arev3 for any of the approved safe-prime groups and
> is also in line with the NVME base spec 2.0, which requires the key size to
> be >= 256bits.
>
> [1] https://lore.kernel.org/r/20211202152358.60116-1-hare@suse.de
>
> Signed-off-by: Nicolai Stange <nstange@...e.de>
> ---
> crypto/Kconfig | 1 +
> crypto/dh.c | 140 +++++++++++++++++++++++++++++++++++++++++++++++--
> 2 files changed, 138 insertions(+), 3 deletions(-)
>
Reviewed-by: Hannes Reinecke <hare@...e.de>
Cheers,
Hannes
--
Dr. Hannes Reinecke Kernel Storage Architect
hare@...e.de +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 36809 (AG Nürnberg), GF: Felix Imendörffer
Powered by blists - more mailing lists