From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EB73EC433EF for ; Mon, 21 Feb 2022 14:15:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377472AbiBUOQT (ORCPT ); Mon, 21 Feb 2022 09:16:19 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:51222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234756AbiBUOQS (ORCPT ); Mon, 21 Feb 2022 09:16:18 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AD151EADE; Mon, 21 Feb 2022 06:15:54 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id EA47D2111A; Mon, 21 Feb 2022 14:15:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1645452952; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/dWqt3VWBGlRkPBTMmfSvFa9xtdEZO2vK14SIjOC8a8=; b=aBBaOWgmlRdt3USVzLbh0kZQrjvNCWNzZWYpEooLwgLnvtDRJSdiiAuNq+cF3SMdCDK4YP Ejqy+AI9PfyuJuky/xAGeuUXskj2EwF9GQdtumvVlQES3ugomDhBvWNvKv6VIXrCDE9F0p 921s0Zvc20Y4mWsobvj4dmPBOyMTqWA= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1645452952; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=/dWqt3VWBGlRkPBTMmfSvFa9xtdEZO2vK14SIjOC8a8=; b=ElqO+pSvHlSR2OseQaUnS32gtmkOVD5nCH+bIWY3U1NtkR//7kGdmZR8jhpGS2XVN4XFvA ytajUS8+tMCU5iDA== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 7A2DE13B21; Mon, 21 Feb 2022 14:15:52 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gbinHJieE2LsIAAAMHmgww (envelope-from ); Mon, 21 Feb 2022 14:15:52 +0000 Message-ID: <354c93c4-1a3a-a22b-1bd6-0815d4128aa0@suse.de> Date: Mon, 21 Feb 2022 15:15:51 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.4.0 Subject: Re: [PATCH v4 07/15] crypto: dh - implement ffdheXYZ(dh) templates Content-Language: en-US To: Nicolai Stange , Herbert Xu , "David S. Miller" Cc: =?UTF-8?Q?Stephan_M=c3=bcller?= , Torsten Duwe , David Howells , Jarkko Sakkinen , linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org, keyrings@vger.kernel.org References: <20220221121101.1615-1-nstange@suse.de> <20220221121101.1615-8-nstange@suse.de> From: Hannes Reinecke In-Reply-To: <20220221121101.1615-8-nstange@suse.de> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2/21/22 13:10, Nicolai Stange wrote: > Current work on NVME in-band authentication support ([1]) needs to invoke > DH with the FFDHE safe-prime group parameters specified in RFC 7919. > > Introduce a new CRYPTO_DH_RFC7919_GROUPS Kconfig option. If enabled, make > dh_generic register a couple of ffdheXYZ(dh) templates, one for each group: > ffdhe2048(dh), ffdhe3072(dh), ffdhe4096(dh), ffdhe6144(dh) and > ffdhe8192(dh). Their respective ->set_secret() expects a (serialized) > struct dh, just like the underlying "dh" implementation does, but with the > P and G values unset so that the safe-prime constants for the given group > can be filled in by the wrapping template. > > Internally, a struct dh_safe_prime instance is being defined for each of > the ffdheXYZ(dh) templates as appropriate. In order to prepare for future > key generation, fill in the maximum security strength values as specified > by SP800-56Arev3 on the go, even though they're not needed at this point > yet. > > Implement the respective ffdheXYZ(dh) crypto_template's ->create() by > simply forwarding any calls to the __dh_safe_prime_create() helper > introduced with the previous commit, passing the associated dh_safe_prime > in addition to the received ->create() arguments. > > [1] https://lore.kernel.org/r/20211202152358.60116-1-hare@suse.de > > Signed-off-by: Nicolai Stange > --- > crypto/Kconfig | 6 + > crypto/dh.c | 298 ++++++++++++++++++++++++++++++++++++++++++++++++- > 2 files changed, 303 insertions(+), 1 deletion(-) > Reviewed-by: Hannes Reinecke Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@suse.de +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer