Skip to contentSkip to conversation

KEYS: asymmetric: Add missing dependencies of FIPS_SIGNATURE_SELFTEST

PATCH In review Eric Biggers 3 participants 4 messages Apr 22, 2024 – Apr 23, 2024

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KEYS: asymmetric: Add missing dependencies of FIPS_SIGNATURE_SELFTEST

From: Eric Biggers <[email protected]>

Since the signature self-test uses RSA and SHA-256, it must only be enabled when those algorithms are enabled. Otherwise it fails and panics the kernel on boot-up.

---
 crypto/asymmetric_keys/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
crypto/asymmetric_keys/Kconfig +2 -0
index 59ec726b7c77..4abc58c55efa 100644
@@ -83,7 +83,9 @@ config FIPS_SIGNATURE_SELFTEST
 	  for FIPS.
 	depends on KEYS
 	depends on ASYMMETRIC_KEY_TYPE
 	depends on PKCS7_MESSAGE_PARSER=X509_CERTIFICATE_PARSER
 	depends on X509_CERTIFICATE_PARSER
+	depends on CRYPTO_RSA
+	depends on CRYPTO_SHA256
 
 endif # ASYMMETRIC_KEY_TYPE

base-commit: ed30a4a51bb196781c8058073ea720133a65596f

Signature · 1 line
2.44.0
#1 lore raw

Hi Eric,

Quoted 5 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Since the signature self-test uses RSA and SHA-256, it must only be enabled when those algorithms are enabled. Otherwise it fails and panics the kernel on boot-up.

I actually submitted two related patch recently which change the structure of the PKCS#7 self-tests and add an ECDSA self-test. See "[PATCH v2 1/2] certs: Move RSA self-test data to separate file" and "[PATCH v2 2/2] certs: Add ECDSA signature verification self-test" on 2024-04-20. The explicit dependency on CRYPTO_RSA shouldn't be necessary with those patches (I think).

However, I didn't consider CRYPTO_SHA256 there. I think it can remain since both the RSA and proposed ECDSA self-tests use SHA-256.

Quoted 28 lines
---
  crypto/asymmetric_keys/Kconfig | 2 ++
  1 file changed, 2 insertions(+)
crypto/asymmetric_keys/Kconfig +2 -0
index 59ec726b7c77..4abc58c55efa 100644
@@ -83,7 +83,9 @@ config FIPS_SIGNATURE_SELFTEST
  	  for FIPS.
  	depends on KEYS
  	depends on ASYMMETRIC_KEY_TYPE
  	depends on PKCS7_MESSAGE_PARSER=X509_CERTIFICATE_PARSER
  	depends on X509_CERTIFICATE_PARSER
+	depends on CRYPTO_RSA
+	depends on CRYPTO_SHA256
 
  endif # ASYMMETRIC_KEY_TYPE

base-commit: ed30a4a51bb196781c8058073ea720133a65596f

maintainer
#2 lore raw
Quoted 16 lines · Joachim Vandersmissen

Hi Eric,

Quoted 5 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Since the signature self-test uses RSA and SHA-256, it must only be enabled when those algorithms are enabled. Otherwise it fails and panics the kernel on boot-up.

I actually submitted two related patch recently which change the structure of the PKCS#7 self-tests and add an ECDSA self-test. See "[PATCH v2 1/2] certs: Move RSA self-test data to separate file" and "[PATCH v2 2/2] certs: Add ECDSA signature verification self-test" on 2024-04-20. The explicit dependency on CRYPTO_RSA shouldn't be necessary with those patches (I think).

Quoted 2 lines

However, I didn't consider CRYPTO_SHA256 there. I think it can remain since both the RSA and proposed ECDSA self-tests use SHA-256.

Their how in my master branch, I'll mirror them to linux-next in day or two.

BR, Jarkko

maintainer Reviewed-by on v1 1/1
#3 lore raw
In reply to Eric Biggers
Quoted 32 lines · Eric Biggers

From: Eric Biggers <[email protected]>

Since the signature self-test uses RSA and SHA-256, it must only be enabled when those algorithms are enabled. Otherwise it fails and panics the kernel on boot-up.

---
 crypto/asymmetric_keys/Kconfig | 2 ++
 1 file changed, 2 insertions(+)
crypto/asymmetric_keys/Kconfig +2 -0
index 59ec726b7c77..4abc58c55efa 100644
@@ -83,7 +83,9 @@ config FIPS_SIGNATURE_SELFTEST
 	  for FIPS.
 	depends on KEYS
 	depends on ASYMMETRIC_KEY_TYPE
 	depends on PKCS7_MESSAGE_PARSER=X509_CERTIFICATE_PARSER
 	depends on X509_CERTIFICATE_PARSER
+	depends on CRYPTO_RSA
+	depends on CRYPTO_SHA256
 
 endif # ASYMMETRIC_KEY_TYPE
Quoted 1 line

base-commit: ed30a4a51bb196781c8058073ea720133a65596f

Also, picked.

BR, Jarkko