linux-crypto.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] crypto: certs: fix FIPS selftest depenency
@ 2022-12-15 17:02 Arnd Bergmann
  2022-12-27 19:22 ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2022-12-15 17:02 UTC (permalink / raw)
  To: David Howells, Herbert Xu, David S. Miller
  Cc: Arnd Bergmann, Jarkko Sakkinen, Ard Biesheuvel, Eric Biggers,
	Vitaly Chikunov, keyrings, linux-crypto, linux-kernel

From: Arnd Bergmann <arnd@arndb.de>

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 <arnd@arndb.de>
---
 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


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: certs: fix FIPS selftest depenency
  2022-12-15 17:02 [PATCH] crypto: certs: fix FIPS selftest depenency Arnd Bergmann
@ 2022-12-27 19:22 ` Jarkko Sakkinen
  2022-12-28 13:19   ` Ben Boeckel
  0 siblings, 1 reply; 4+ messages in thread
From: Jarkko Sakkinen @ 2022-12-27 19:22 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: David Howells, Herbert Xu, David S. Miller, Arnd Bergmann,
	Ard Biesheuvel, Eric Biggers, Vitaly Chikunov, keyrings,
	linux-crypto, linux-kernel

On Thu, Dec 15, 2022 at 06:02:52PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.de>
> 
> 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 <arnd@arndb.de>
> ---
>  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 <jarkko@kernel.org>

BR, Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: certs: fix FIPS selftest depenency
  2022-12-27 19:22 ` Jarkko Sakkinen
@ 2022-12-28 13:19   ` Ben Boeckel
  2023-01-04 13:05     ` Jarkko Sakkinen
  0 siblings, 1 reply; 4+ messages in thread
From: Ben Boeckel @ 2022-12-28 13:19 UTC (permalink / raw)
  To: Jarkko Sakkinen
  Cc: Arnd Bergmann, David Howells, Herbert Xu, David S. Miller,
	Arnd Bergmann, Ard Biesheuvel, Eric Biggers, Vitaly Chikunov,
	keyrings, linux-crypto, linux-kernel

On Tue, Dec 27, 2022 at 19:22:38 +0000, Jarkko Sakkinen wrote:
> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>

Might want to fix this when picked:

> Subject: Re: [PATCH] crypto: certs: fix FIPS selftest depenency
                                             dependency ^^^^^^^^^

--Ben

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] crypto: certs: fix FIPS selftest depenency
  2022-12-28 13:19   ` Ben Boeckel
@ 2023-01-04 13:05     ` Jarkko Sakkinen
  0 siblings, 0 replies; 4+ messages in thread
From: Jarkko Sakkinen @ 2023-01-04 13:05 UTC (permalink / raw)
  To: Ben Boeckel
  Cc: Arnd Bergmann, David Howells, Herbert Xu, David S. Miller,
	Arnd Bergmann, Ard Biesheuvel, Eric Biggers, Vitaly Chikunov,
	keyrings, linux-crypto, linux-kernel

On Wed, Dec 28, 2022 at 08:19:30AM -0500, Ben Boeckel wrote:
> On Tue, Dec 27, 2022 at 19:22:38 +0000, Jarkko Sakkinen wrote:
> > Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org>
> 
> Might want to fix this when picked:
> 
> > Subject: Re: [PATCH] crypto: certs: fix FIPS selftest depenency
>                                              dependency ^^^^^^^^^
> 
> --Ben

Thank you! I updated the patch accordingly.

It should be soon available in linux-next tree.

BR, Jarkko

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-01-04 13:06 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-15 17:02 [PATCH] crypto: certs: fix FIPS selftest depenency Arnd Bergmann
2022-12-27 19:22 ` Jarkko Sakkinen
2022-12-28 13:19   ` Ben Boeckel
2023-01-04 13:05     ` Jarkko Sakkinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).