[PATCH v6 21/25] keys: Guard asymmetric-type.h behind CONFIG_KEYS

From: alistair23

Date: Mon Nov 09 2026 - 23:49:42 EST


From: Alistair Francis <alistair.francis@xxxxxxx>

The header keys/asymmetric-type.h includes linux/key-type.h,
which is where `struct key_type` is defined.

linux/key-type.h has a `#ifdef CONFIG_KEYS` guard around the entire file,
yet keys/asymmetric-type.h doesn't. So if CONFIG_KEYS is not defined
including keys/asymmetric-type.h will cause build failures as
`struct key_type` isn't defined.

Guard keys/asymmetric-type.h with a `#ifdef CONFIG_KEYS` to fix the
failures seen when including keys/asymmetric-type.h in the Rust bindgen.

Signed-off-by: Alistair Francis <alistair.francis@xxxxxxx>
---
include/keys/asymmetric-type.h | 3 +++
1 file changed, 3 insertions(+)

diff --git a/include/keys/asymmetric-type.h b/include/keys/asymmetric-type.h
index 301efa952e263..b77bfa7bd5904 100644
--- a/include/keys/asymmetric-type.h
+++ b/include/keys/asymmetric-type.h
@@ -13,6 +13,8 @@
#include <linux/key-type.h>
#include <linux/verification.h>

+#ifdef CONFIG_KEYS
+
extern struct key_type key_type_asymmetric;

/*
@@ -93,4 +95,5 @@ int x509_load_certificate_list(const u8 cert_list[], const unsigned long list_si
* The payload is at the discretion of the subtype.
*/

+#endif /* CONFIG_KEYS */
#endif /* _KEYS_ASYMMETRIC_TYPE_H */
--
2.56.0