Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp483176pxy; Wed, 21 Apr 2021 07:39:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNxtKZqz7MOLxV20Tu89Vln+8/W6g4/oluCulgahN6zZdHlYkRlsXRbWMOmGVZ/NtT7lru X-Received: by 2002:a05:6402:26c9:: with SMTP id x9mr38542470edd.322.1619015967584; Wed, 21 Apr 2021 07:39:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619015967; cv=none; d=google.com; s=arc-20160816; b=vS28E1UXFMng5TzoTqI0mnQ/q87Hc1GdinXPOk84j6SuduEo3hkKB4tiU+f/ew1Ucf FD2mE71JNrvO6cDkP/Xh3pAfT0+u8pABe3BXbyIXdc0VJkZ5T6XLsLcJUSGqbMSQ6yzJ lRWNfBcvZ811OoGbUuDog7+ZWBFy3eojVavSp6LN3eSKMoRSnIW4tPdHzUC1bhMbvb8m 1m0KD5UsDZF/QW0fQ1hJC2xiootmWfVbn7LbHUE6c+d4kzd53S3AKCSVCoRfcujjhfqJ fUS4g9H95ns1ioquo3hr212wOC1DnZn2QDz1igNU6RKxw/Uphf74JeKiOsLDPlG95Rlx g77A== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=hRPxU0No5B7ZXwhs0qwY6kDIcNY9jJraFqgqYctl1gc=; b=dT3Q8DdC9zdQYcbT2hDKgbQ91/eUyKrBX+8pZxj9w8j8ubql9o85lwgOwGZJnkA9R9 f0p7n7ZA0uwwTPMjzX29fiK/Q/BBSYuQv4Qh7z3p7azzb9XJviY96DrEx9voLrKPJwFD vA3kYl6CMRrHL5jDaB2X/fTqnmWlviovo0Igucd3tz+O6NeJlszv+dv7IuYWuTahKJ5T QonTl2hoYkk0UTNm749v5LgoMERZAINj2B1ngpe9WirGlOun6xiqwkGn5fdJvXIUvs3g u888FQYpGy84Gobj5pB+EPN5DUbBkVcKF9TA4hSYA+ZAGe3RaLuTPuMSihyNoI2/aRra wCSw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Xio9DuO3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 d8si2020084ejp.214.2021.04.21.07.39.04; Wed, 21 Apr 2021 07:39:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=Xio9DuO3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-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 S237856AbhDUM6s (ORCPT + 99 others); Wed, 21 Apr 2021 08:58:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:38676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235456AbhDUM6s (ORCPT ); Wed, 21 Apr 2021 08:58:48 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D941E61434; Wed, 21 Apr 2021 12:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1619009890; bh=+Vokp/hoysnd0ul6sqTObqxG1xjfg9z0T5zVe8JDfTM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=Xio9DuO3AqovPWlvpx123fd2rDGmBn9t1ZYqhU2C9FB8wir4Q4gQzSyCpeblX7Dxt 6Gq5HQSvAoruL6ZkEmTfcYVJsBNwNYuVV5UjohZ8sxkguGQW9hViA4tcZks/8R9Y9y vPCxoeuccfxC7SGtL+8t3oxsl8mWRlSRIV3b80wlqf93W5RDC7mmogbw+UEb2a2fAB zlTC6DphLLDKCtSCuqxmhWhUPCQvU37UqtEkR46zH9E3sCIKMq4oAkmb0zVxAn/rGa 1Mt5tVLIJgaFWNMbQE27nbxvEeSLPMojiKozl06eIu2uL/7q6JvxkGi4d7suR5elAz rdD4W7uE7ZWGQ== Date: Wed, 21 Apr 2021 14:58:05 +0200 From: Jessica Yu To: Stefan Berger Cc: keyrings@vger.kernel.org, dhowells@redhat.com, zohar@linux.ibm.com, jarkko@kernel.org, nayna@linux.ibm.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] certs: Add support for using elliptic curve keys for signing modules Message-ID: References: <20210408152403.1189121-1-stefanb@linux.ibm.com> <20210408152403.1189121-3-stefanb@linux.ibm.com> <794ef635-de91-9207-f28b-ab6805fd95c9@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-OS: Linux gunter 5.11.12-1-default x86_64 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org +++ Stefan Berger [21/04/21 08:54 -0400]: > >On 4/21/21 8:52 AM, Jessica Yu wrote: >>+++ Stefan Berger [20/04/21 17:02 -0400]: >>> >>>On 4/20/21 10:03 AM, Jessica Yu wrote: >>>>+++ Stefan Berger [08/04/21 11:24 -0400]: >>>>> >>>>>diff --git a/crypto/asymmetric_keys/pkcs7_parser.c >>>>>b/crypto/asymmetric_keys/pkcs7_parser.c >>>>>index 967329e0a07b..2546ec6a0505 100644 >>>>>--- a/crypto/asymmetric_keys/pkcs7_parser.c >>>>>+++ b/crypto/asymmetric_keys/pkcs7_parser.c >>>>>@@ -269,6 +269,10 @@ int pkcs7_sig_note_pkey_algo(void >>>>>*context, size_t hdrlen, >>>>>??????? ctx->sinfo->sig->pkey_algo = "rsa"; >>>>>??????? ctx->sinfo->sig->encoding = "pkcs1"; >>>>>??????? break; >>>>>+??? case OID_id_ecdsa_with_sha256: >>>>>+??????? ctx->sinfo->sig->pkey_algo = "ecdsa"; >>>>>+??????? ctx->sinfo->sig->encoding = "x962"; >>>>>+??????? break; >>>> >>>>Hi Stefan, >>>> >>>>Does CONFIG_MODULE_SIG_KEY_TYPE_ECDSA have a dependency on >>>>MODULE_SIG_SHA256? >>> >>>You are right, per the code above it does have a dependency on >>>SHA256. ECDSA is using NIST p384 (secp384r1) for signing and per >>>my tests it can be paired with all the sha hashes once the code >>>above is extended. Now when it comes to module signing, should we >>>pair it with a particular hash? I am not currently aware of a >>>guidance document on this but sha256 and sha384 seem to be good >>>choices these days, so maybe selecting ECDSA module signing should >>>have a 'depends on' on these? >> >>Yeah, I would tack on the 'depends on' until the code above has been >>extended to cover more sha hashes - because currently if someone >>builds and signs a bunch of modules with an ECDSA key, they will fail >>to load if they picked something other than sha256. I am unfortunately >>not knowledgeable enough to suggest an official guideline on choice of >>hash, but for now it is reasonable to have a 'depends on' for which >>hashes the code currently supports, so that users don't run into >>module loading rejection issues. > > >I was going to repost this series now with the additional OIDs >supported above and a recommendation to use sha384 in the help text >for ECDSA-signed modules, but not enforcing this but instead trusting >the user that they will choose a reasonable hash (probably >= sha256). OK, that sounds good to me. Thanks Stefan!