[LTP] [PATCH 27/33] lapi/keyctl.h: Add capability fallback defines
Andrea Cervesato
andrea.cervesato@suse.de
Wed Sep 2 13:04:42 CEST 2026
From: Andrea Cervesato <andrea.cervesato@suse.com>
Add fallback definitions for KEYCTL_CAPABILITIES, KEYCTL_CAPS0_*,
and KEYCTL_CAPS1_* constants, and update safe_keyctl to handle
KEYCTL_CAPABILITIES.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
include/lapi/keyctl.h | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index 8820c3ddb..27b0f8dd2 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -219,6 +219,10 @@ static inline key_serial_t keyctl_join_session_keyring(const char *name) {
# define KEYCTL_MOVE_EXCL 0x00000001 /* do not displace from the to-keyring */
#endif
+#ifndef KEYCTL_CAPABILITIES
+# define KEYCTL_CAPABILITIES 31
+#endif
+
#ifndef KEYCTL_PKEY_QUERY
# define KEYCTL_PKEY_QUERY 24
#endif
@@ -246,6 +250,20 @@ static inline key_serial_t keyctl_join_session_keyring(const char *name) {
# define KEYCTL_SUPPORTS_VERIFY 0x08
#endif
+#ifndef KEYCTL_CAPS0_CAPABILITIES
+# define KEYCTL_CAPS0_CAPABILITIES 0x01
+# define KEYCTL_CAPS0_PERSISTENT_KEYRINGS 0x02
+# define KEYCTL_CAPS0_DIFFIE_HELLMAN 0x04
+# define KEYCTL_CAPS0_PUBLIC_KEY 0x08
+# define KEYCTL_CAPS0_BIG_KEY 0x10
+# define KEYCTL_CAPS0_INVALIDATE 0x20
+# define KEYCTL_CAPS0_RESTRICT_KEYRING 0x40
+# define KEYCTL_CAPS0_MOVE 0x80
+# define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01
+# define KEYCTL_CAPS1_NS_KEY_TAG 0x02
+# define KEYCTL_CAPS1_NOTIFICATIONS 0x04
+#endif
+
/* key permissions */
#ifndef KEY_POS_VIEW
# define KEY_POS_VIEW 0x01000000
@@ -311,6 +329,7 @@ static inline long safe_keyctl(const char *file, const int lineno,
case KEYCTL_PKEY_DECRYPT:
case KEYCTL_PKEY_SIGN:
case KEYCTL_PKEY_VERIFY:
+ case KEYCTL_CAPABILITIES:
if (rval < 0)
failure = 1;
break;
--
2.51.0
More information about the ltp
mailing list