summaryrefslogtreecommitdiff
path: root/crypto/asymmetric_keys/selftest.h
diff options
context:
space:
mode:
authorJoachim Vandersmissen <git@jvdsn.com>2024-05-12 23:55:06 -0500
committerJarkko Sakkinen <jarkko@kernel.org>2024-05-14 05:01:03 +0300
commit3066766751b22258206552bc0e134f6788bf76e7 (patch)
treec442c7d6eb5b8bab8fbda8d0ef9a04500f5201da /crypto/asymmetric_keys/selftest.h
parent05d223af0a9273be52951a1533751df1b5169794 (diff)
downloadlinux-crypto-3066766751b22258206552bc0e134f6788bf76e7.tar.gz
linux-crypto-3066766751b22258206552bc0e134f6788bf76e7.zip
certs: Move RSA self-test data to separate file
In preparation of adding new ECDSA self-tests, the existing data for the RSA self-tests is moved to a separate file. This file is only compiled if the new CONFIG_FIPS_SIGNATURE_SELFTEST_RSA configuration option is set, which ensures that the required dependencies (RSA, SHA-256) are present. Otherwise, the kernel would panic when trying to execute the self-test. The introduction of this new option, rather than adding the dependencies to the existing CONFIG_FIPS_SIGNATURE_SELFTEST option, allows for additional self-tests to be added for different algorithms. The kernel can then be configured to only execute the self-tests for those algorithms that are included. Signed-off-by: Joachim Vandersmissen <git@jvdsn.com> Reviewed-by: Jarkko Sakkinen <jarkko@kernel.org> Acked-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Jarkko Sakkinen <jarkko@kernel.org>
Diffstat (limited to 'crypto/asymmetric_keys/selftest.h')
-rw-r--r--crypto/asymmetric_keys/selftest.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/crypto/asymmetric_keys/selftest.h b/crypto/asymmetric_keys/selftest.h
new file mode 100644
index 00000000..842ac3cf
--- /dev/null
+++ b/crypto/asymmetric_keys/selftest.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+/* Helper function for self-testing PKCS#7 signature verification.
+ *
+ * Copyright (C) 2024 Joachim Vandersmissen <git@jvdsn.com>
+ */
+
+void fips_signature_selftest(const char *name,
+ const u8 *keys, size_t keys_len,
+ const u8 *data, size_t data_len,
+ const u8 *sig, size_t sig_len);
+
+#ifdef CONFIG_FIPS_SIGNATURE_SELFTEST_RSA
+void __init fips_signature_selftest_rsa(void);
+#else
+static inline void __init fips_signature_selftest_rsa(void) { }
+#endif