Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp3582433rwl; Tue, 27 Dec 2022 11:23:44 -0800 (PST) X-Google-Smtp-Source: AMrXdXt1Dt6Unvu8VwDU27o4T71p7ZGWyuiwXCMl4R1A7ya3d1G2tL9iJC3JuuqLIesxuoRFeszb X-Received: by 2002:a17:90a:7d13:b0:223:21d5:6901 with SMTP id g19-20020a17090a7d1300b0022321d56901mr24929791pjl.45.1672169024125; Tue, 27 Dec 2022 11:23:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1672169024; cv=none; d=google.com; s=arc-20160816; b=cQaQl8arg64CLSR44C2ccfD+Az4tkW9FvwS8JR4+A6Pus15TAhJV+z5T4KF63ZRxK+ YGBHjVCHUmaQ29ZGuHn44r+pq6NSTWUeBEMxdkQ9BBiMrEDgBOMZlNpLYV/HLwSeTHnF q7xpsFy3dX6yIsljkQKVgwM/IvE3ZMdQG6bkorL1Ukbee8C1IiUfpLQBQrN3bLffMnmn eh8gzr+uBatG07OABud9iSBSSKloDcV3V99wo34c+T0m2c5RI21sZIqukgnFJJISKwQD H5Sj4sh63ziYxy1BNhEURDZ85cI7/3zNwOtq028JDEL/aL5zfHp4YP5uuzs5um8sheDs SExg== 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-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=2+/aL8qV9kicDTVVbzCDMWsuaoms91YxBILFf0mMAPI=; b=SUEqWDRumgmMTY8gGc/61dEpnHTaO+axs7thIVs78AXD4OFGCwdyQZrziwqlvvjR2M 29K+s5mw0PoHc8K+M0kL1pUR4sBriwzwz53E0FuIwqc2kXYjFu4akEUO8+qw5lON2C2c b19+atX7M6dtHvDNkkyPNrptJVK/e2tuoIMwR5cd9zcLpT6U45S+Rm+e3fUnKltvYKhP foLIV0uY/EmQf9yUfczWSxUbUl4TQXHCl5cGeLpkOQ9RWYoGl7aRq9R6TcrC0LksNp6v TrpMXXGEVCmaFWQNdNk/olNkRnPFeuoMBLUlgzeaBVz6S4NgzpB7cf3QMSTh3Ggxvx9G 2IKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uRBmMG5y; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n2-20020a654cc2000000b0049ac863877asi2260540pgt.523.2022.12.27.11.23.24; Tue, 27 Dec 2022 11:23:44 -0800 (PST) Received-SPF: pass (google.com: domain of linux-crypto-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=uRBmMG5y; spf=pass (google.com: domain of linux-crypto-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-crypto-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 S230268AbiL0TXB (ORCPT + 99 others); Tue, 27 Dec 2022 14:23:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44378 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229488AbiL0TXA (ORCPT ); Tue, 27 Dec 2022 14:23:00 -0500 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 02AB2D4C; Tue, 27 Dec 2022 11:22:58 -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 ams.source.kernel.org (Postfix) with ESMTPS id 968D9B80E8C; Tue, 27 Dec 2022 19:22:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 08BFFC433EF; Tue, 27 Dec 2022 19:22:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1672168976; bh=JZVucA8oHxLNl9U1Lb781S9ah8U4/JhduG51boVtfvw=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uRBmMG5yRCzun79mh5c6fhtVgNPwQO7Vm3IBaHwZT5Kk49+ecVp4FMvGcHWFQOGTl caYQd12doLUszoP0i14aqrgjbsm4oB9lZbVVXKI2V0gHItCEQXTarFBB18u9PXkDNT ChmJNuWHnGIAATLRtuCsWVKRO0AYGZ65e5o9pXF78kFEefJZvzzmBZFJCDZsdWdunQ RsTpBikc9CcuyPrVCQ1VzgIu4+4PcpTtP8UXqMUn1mLCMTWeCcb2ND46PqOH+zL+/S CJudYAfqPXSeoWxfXue9W7mRYUmtaNLvRxl8gcu51WgG0fQoFwMhEAWjy66fg+/ybx GeGfRX42jFhzQ== Date: Tue, 27 Dec 2022 19:22:38 +0000 From: Jarkko Sakkinen To: Arnd Bergmann Cc: David Howells , Herbert Xu , "David S. Miller" , Arnd Bergmann , Ard Biesheuvel , Eric Biggers , Vitaly Chikunov , keyrings@vger.kernel.org, linux-crypto@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] crypto: certs: fix FIPS selftest depenency Message-ID: References: <20221215170259.2553400-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221215170259.2553400-1-arnd@kernel.org> 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-crypto@vger.kernel.org On Thu, Dec 15, 2022 at 06:02:52PM +0100, Arnd Bergmann wrote: > 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 > --- > 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); > -- > 2.35.1 > Reviewed-by: Jarkko Sakkinen BR, Jarkko