X-Received: by 2002:a17:90a:a510:b0:1bc:5887:d957 with SMTP id a16-20020a17090aa51000b001bc5887d957mr2375446pjq.38.1645506308818; Mon, 21 Feb 2022 21:05:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645506308; cv=none; d=google.com; s=arc-20160816; b=C2yenuHEok9PIaB8gIH/LGFmxmpmFqL80RQN9Arl4tNUBy/ijeyZE+UPNp9obXb0E4 svz8TkFHmKPk4ZPqnqbmq5CbtGDwfvb3rymwylCfLYsY6iH67LZshKmXFgplRNJO3hAI udRgXiGXgB16t49ipX4SbOMfpRU+8gJvjC6RUGsB+9eZ/+/9QLGUPw95y6cAGHiwHitM yVs4d55O7+UfjibjhfeRtri0wqm5Op8OrMbINWMEwjKItKF7zucpL17FZJofPRaqixRk 8GUIojEox/A4tFlP5FmyTqflM3LCOtDlUj/8ob1Kb5eJDW6wK3mdWY7jpMGTTmwjwXHt Pwgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=/dWqt3VWBGlRkPBTMmfSvFa9xtdEZO2vK14SIjOC8a8=; b=0SVNNGvw7VF/WctuAm3NbsweWPqSqbOvHPLSdkVESuJZuhwDpTll4CP0wjY/vmNj1I 1eu6MCSR+4dh91Yv9nky7eP9nlKmwNAU4PnYiDE0LUCUIUExjsjQlf5VGdSF0+HURQNv /S05aqnGOaNm+GVk22HWDzGmOfE8ksCcxoHSsUx1chOVa8SBsTQy5ufml2n+PJoA9OWm BueM+RklXmzNKr2e9OnZfPcAV92CKCatLoDo1OO746/H2ni4sAvkjCW8vB3JXeycrSY4 eO+LRAvg3P6u8BIPpy2LdEbo//EXJeju3Gqh7KcDN2k5HvFj90ETL07tDzWLNfojaeN9 MI+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=aBBaOWgm; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id j15si10531984pfu.212.2022.02.21.21.05.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Feb 2022 21:05:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=aBBaOWgm; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E330B9AE42; Mon, 21 Feb 2022 20:38:26 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1377468AbiBUOQT (ORCPT + 99 others); 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 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net 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