Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp555600pxf; Thu, 8 Apr 2021 08:26:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzNtiqxXM7hFCWnrfg94CRaBKLy4Gg7XBkTXtUUd/iCN+vttFDCmLRD/0mo6cJOsY/j3NQ X-Received: by 2002:a05:6402:4242:: with SMTP id g2mr12055433edb.329.1617895571027; Thu, 08 Apr 2021 08:26:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1617895571; cv=none; d=google.com; s=arc-20160816; b=s+UpViF++XIKAc3ie54PHATUPe2ZBLyNq+4/YGtjjFWRS+ZR2BMR9+UBO5arTBqi9G e8u0FYTDsryeQab21Bn9gfuB/9siopIECGlTLcSi8EX0bgXtGZrwiqPpiurHE0xaY3CT 36tBX0LrT24BAKKFEZnaWG8s36fnq5iqr6qfW9ZU97yd0YNIYix0CQHHfSFWYdvpyTFh gc2EzRSZqI6G51MkexcDubQ7k13dRsk157+L29jem+HccqdIRPLFsu8iGSL3sb8Djlbq 5T2YDbGNRht8uJybLVtFfh+H1eZaEWCwPSU1hZMvP7YB+trQRNxALYPSs5dwRa18OGfB 82Dw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=13VxI2u/uzl1rsCou/jlybKaB3Fcj4Hk8iNuw0hp8ss=; b=dPEuW42TMI1ZNmA98+aubPX/JrTd0GYpJ0SAw0nOpHlKnHabHPKXTu2fmMANX/Sj84 z8ecDAmdJCKpedcH/is5Sr2OVH2dzsnn99kHXqzBhBmvgLombkGA8j0y9KZP8DRUjJu8 5jYAlWVCL3kq9nj0Dxm8C7zIVErfcNTFX4SrLznfjNu6v06Thcixe9oZR6eu99aE87/1 0SPHiLa18qxhYE2jFOrdHlX/xzGWW0o5VEPBUFfK63vAttuGADPrMpaU0JJpnkYFBCxs w+ymdIRztJj+CE3sFExlUiYkGQYPID997xTyFtqN0nra/hYiqAPzAKd09ZaRXPDIlTNP UbDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=OkbCeoVc; 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id cc15si22842004edb.389.2021.04.08.08.25.47; Thu, 08 Apr 2021 08:26:11 -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=@ibm.com header.s=pp1 header.b=OkbCeoVc; 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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232212AbhDHPY2 (ORCPT + 99 others); Thu, 8 Apr 2021 11:24:28 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:11128 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S231955AbhDHPYV (ORCPT ); Thu, 8 Apr 2021 11:24:21 -0400 Received: from pps.filterd (m0098416.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 138FALZI160012; Thu, 8 Apr 2021 11:24:08 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=13VxI2u/uzl1rsCou/jlybKaB3Fcj4Hk8iNuw0hp8ss=; b=OkbCeoVcTJ1F9yIY5WpqQowQcgWj4HvfA+B/HdA0ED0VFCk9AB/biKkQyxpQQk0OME2Q n3c2EUoyauIgFhszq1mY7OxtOxS31lNf6b9BaUHEjkkTyiyFQifcHavkU3IFVKmE/qIr 6l6uU7zBp1836XuXbLUHGMwz5fvShYW9mPNs6f8DBVQgBUSQetQbT2487pxVdqIiMBB2 PCOVxf62KaFRroyMX78QmiRHMQkZHzTVGiKF2+pBcJ+NHMWkTknt0f9yVA3rFVWqvqI7 d+ygYk2pPEHF/3/7UeW55vc2mOYf14Dl2TtTCvvLawgPxrT82kHTvUnkjBq6J84afvR+ BA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0b-001b2d01.pphosted.com with ESMTP id 37rwf1krhj-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 11:24:08 -0400 Received: from m0098416.ppops.net (m0098416.ppops.net [127.0.0.1]) by pps.reinject (8.16.0.43/8.16.0.43) with SMTP id 138FAPx2160433; Thu, 8 Apr 2021 11:24:07 -0400 Received: from ppma03dal.us.ibm.com (b.bd.3ea9.ip4.static.sl-reverse.com [169.62.189.11]) by mx0b-001b2d01.pphosted.com with ESMTP id 37rwf1krh4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 11:24:07 -0400 Received: from pps.filterd (ppma03dal.us.ibm.com [127.0.0.1]) by ppma03dal.us.ibm.com (8.16.0.43/8.16.0.43) with SMTP id 138FMdOO026221; Thu, 8 Apr 2021 15:24:07 GMT Received: from b01cxnp22035.gho.pok.ibm.com (b01cxnp22035.gho.pok.ibm.com [9.57.198.25]) by ppma03dal.us.ibm.com with ESMTP id 37rvc2sd11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 08 Apr 2021 15:24:07 +0000 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 138FO6eO24707440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 8 Apr 2021 15:24:06 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5C7F5112067; Thu, 8 Apr 2021 15:24:06 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 44DD6112065; Thu, 8 Apr 2021 15:24:06 +0000 (GMT) Received: from localhost.localdomain (unknown [9.47.158.152]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 8 Apr 2021 15:24:06 +0000 (GMT) From: Stefan Berger To: keyrings@vger.kernel.org, dhowells@redhat.com, zohar@linux.ibm.com, jarkko@kernel.org Cc: nayna@linux.ibm.com, linux-integrity@vger.kernel.org, linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Berger Subject: [PATCH v2 1/2] certs: Trigger creation of RSA module signing key if it's not an RSA key Date: Thu, 8 Apr 2021 11:24:02 -0400 Message-Id: <20210408152403.1189121-2-stefanb@linux.ibm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210408152403.1189121-1-stefanb@linux.ibm.com> References: <20210408152403.1189121-1-stefanb@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: 3QNguRayzkW5kw3IyuqH-1Ge7cc3uRr7 X-Proofpoint-ORIG-GUID: QeIhrBMURocd0-TB0Dyj0CFIXzoVzQWh X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.391,18.0.761 definitions=2021-04-08_03:2021-04-08,2021-04-08 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 clxscore=1015 bulkscore=0 malwarescore=0 impostorscore=0 phishscore=0 suspectscore=0 lowpriorityscore=0 priorityscore=1501 mlxlogscore=999 mlxscore=0 spamscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2104060000 definitions=main-2104080104 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Address a kbuild issue where a developer created an ECDSA key for signing kernel modules and then builds an older version of the kernel, when bi- secting the kernel for example, that does not support ECDSA keys. Trigger the creation of an RSA module signing key if it is not an RSA key. Fixes: cfc411e7fff3 ("Move certificate handling to its own directory") Signed-off-by: Stefan Berger --- certs/Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/certs/Makefile b/certs/Makefile index e3185c57fbd8..f64bc89ccbf1 100644 --- a/certs/Makefile +++ b/certs/Makefile @@ -59,6 +59,11 @@ silent_redirect_openssl = 2>/dev/null # external private key, because 'make randconfig' might enable such a # boolean option and we unfortunately can't make it depend on !RANDCONFIG. ifeq ($(CONFIG_MODULE_SIG_KEY),"certs/signing_key.pem") + +X509TEXT=$(shell openssl x509 -in $(CONFIG_MODULE_SIG_KEY) -text) + +$(if $(findstring rsaEncryption,$(X509TEXT)),,$(shell rm -f $(CONFIG_MODULE_SIG_KEY))) + $(obj)/signing_key.pem: $(obj)/x509.genkey @$(kecho) "###" @$(kecho) "### Now generating an X.509 key pair to be used for signing modules." -- 2.29.2