From patchwork Thu Dec 15 17:02:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 33760 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:e747:0:0:0:0:0 with SMTP id c7csp486677wrn; Thu, 15 Dec 2022 09:08:41 -0800 (PST) X-Google-Smtp-Source: AA0mqf6Iz43zn9nTX6S/FMhp6niEpzjjKFOIwSvTqp6J+/SWsyoPwaHxCbyl1ahBa8XevvqTrxzp X-Received: by 2002:a05:6402:5011:b0:469:ee22:d97a with SMTP id p17-20020a056402501100b00469ee22d97amr11713526eda.32.1671124121500; Thu, 15 Dec 2022 09:08:41 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671124121; cv=none; d=google.com; s=arc-20160816; b=HIjvxNuRGru//qavBvgHdQ5i8/N7c3//iWQPSZaLKUGJjH2HTrqCT2rnSjvrdONnIB HR4jPMYeWhLzrqKtU/6VMYot/PzSdZj5AnPUl4wM2XtWjlei3iP0fAANUzwArsZVc1PN w6Cq5KWu+ysitmfJ6aP0ylaDdogZGPs3m5T8jw8BuDW3/C0VHSwayBEP3g1Ldv/o05nI GYiDDMxnIrwVzOItSf5SWJaBmi8ivDTBQrjAEB0N+b7dRwIq6G1ZZ/a/FCFTE7/vjqCB yfQAEK5PXZh2rpNTgmG07rrzcADIoh5J/gunIi5jbBQJGDh3/F8HGiIEieMrUjMlaDgB fwOw== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=vphHsaisWdCf1lD5m/boFMlgyl6ttS7MkBuVZM13rlw=; b=cYw6rNbjbxZaKr39QrO8MFHI3bXjPLWmdt4reCblGl8bjO0UTxmy59pKkGrblWVXXP rc7zQPWbb8y0BcUCgF9NsGBzGHFILnKebBM7ZTKHk9LbgrUNwfgPN1njduY3lwce+wNX UR77W4JKfTIplK8/Uzk3KOeD5K+vmmnkQh4/SYGN0+KxcFHUtrdzhy9xntLBmjs50rJD dsZfE8ZgopjY9umWtwm0MTTQJgvjDxxFkmLPk6wclEYHOGpEZaJ+K/in7Oy/mmiPKCXI uzm3bRfn6Qe3XZrtA20zFMd4CNsoLm9xDnFHN4B8bF+hlif17SNRvOYHfItvtwCXgQ8B hEjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rdhphr6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id cr13-20020a170906d54d00b007c0ef0592fasi7577671ejc.645.2022.12.15.09.08.17; Thu, 15 Dec 2022 09:08:41 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=Rdhphr6z; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S231173AbiLORFR (ORCPT + 99 others); Thu, 15 Dec 2022 12:05:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53420 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230510AbiLOREj (ORCPT ); Thu, 15 Dec 2022 12:04:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BD73947318; Thu, 15 Dec 2022 09:03:23 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id DDF6061E60; Thu, 15 Dec 2022 17:03:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E2ED6C433F0; Thu, 15 Dec 2022 17:03:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1671123784; bh=+j5/PKCDX4da27Gaivbi0EyxiiyB/ME/Rriq9u2O0TY=; h=From:To:Cc:Subject:Date:From; b=Rdhphr6zRApiRnlYm2ku5gSx7V/yGOq92PaGnKYjhZPPUVQdH59PWSgjC0XCU6Q5N YeHalqiRnE/nHreZTmbvVyhEnNzkyRuhPFhGuH3ZkzOGUHsfwRHyXoek+iMr070KGh Ym9FLBs2zeY7chwGn6vkid5iuAu6MMiL7AfWiQKM1l/8Y0IWV+eYSkVVZz+2XIMPqN pJj2gYM/PKhx8cYvWI1L7IxAo6Vr3itYmj9SGLgm8CUX9z59X2Ys3jRsDa6kcXw3xC RILQmpNwwPj0FPZanru6qWAOG4BNYGLu3xUBOUEWVJ0Be1aT6nban6HUVz3GLK/WbJ bIuoYHVAcItWg== From: Arnd Bergmann To: David Howells , Herbert Xu , "David S. Miller" Cc: Arnd Bergmann , Jarkko Sakkinen , Ard Biesheuvel , Eric Biggers , Vitaly Chikunov , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] crypto: certs: fix FIPS selftest depenency Date: Thu, 15 Dec 2022 18:02:52 +0100 Message-Id: <20221215170259.2553400-1-arnd@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1752300646736005686?= X-GMAIL-MSGID: =?utf-8?q?1752300646736005686?= From: Arnd Bergmann The selftest code is built into the x509_key_parser module, and depends on the pkcs7_message_parser module, which in turn has a dependency on the key parser, creating a dependency loop and a resulting link failure when the pkcs7 code is a loadable module: ld: crypto/asymmetric_keys/selftest.o: in function `fips_signature_selftest': crypto/asymmetric_keys/selftest.c:205: undefined reference to `pkcs7_parse_message' ld: crypto/asymmetric_keys/selftest.c:209: undefined reference to `pkcs7_supply_detached_data' ld: crypto/asymmetric_keys/selftest.c:211: undefined reference to `pkcs7_verify' ld: crypto/asymmetric_keys/selftest.c:215: undefined reference to `pkcs7_validate_trust' ld: crypto/asymmetric_keys/selftest.c:219: undefined reference to `pkcs7_free_message' Avoid this by only allowing the selftest to be enabled when either both parts are loadable modules, or both are built-in. Signed-off-by: Arnd Bergmann Reviewed-by: Jarkko Sakkinen --- crypto/asymmetric_keys/Kconfig | 2 +- crypto/asymmetric_keys/pkcs7_verify.c | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crypto/asymmetric_keys/Kconfig b/crypto/asymmetric_keys/Kconfig index 3df3fe4ed95f..1ef3b46d6f6e 100644 --- a/crypto/asymmetric_keys/Kconfig +++ b/crypto/asymmetric_keys/Kconfig @@ -83,6 +83,6 @@ config FIPS_SIGNATURE_SELFTEST for FIPS. depends on KEYS depends on ASYMMETRIC_KEY_TYPE - depends on PKCS7_MESSAGE_PARSER + depends on PKCS7_MESSAGE_PARSER=X509_CERTIFICATE_PARSER endif # ASYMMETRIC_KEY_TYPE diff --git a/crypto/asymmetric_keys/pkcs7_verify.c b/crypto/asymmetric_keys/pkcs7_verify.c index f6321c785714..4fa769c4bcdb 100644 --- a/crypto/asymmetric_keys/pkcs7_verify.c +++ b/crypto/asymmetric_keys/pkcs7_verify.c @@ -485,3 +485,4 @@ int pkcs7_supply_detached_data(struct pkcs7_message *pkcs7, pkcs7->data_len = datalen; return 0; } +EXPORT_SYMBOL_GPL(pkcs7_supply_detached_data);