[LTP] [PATCH 01/33] lapi/keyctl.h: Add fallback definitions for extended ops
Andrea Cervesato
andrea.cervesato@suse.de
Wed Sep 2 13:04:16 CEST 2026
From: Andrea Cervesato <andrea.cervesato@suse.com>
Add fallback definitions for KEYCTL_LINK, KEYCTL_RESTRICT_KEYRING,
KEYCTL_MOVE, and KEYCTL_MOVE_EXCL, as well as fallback definitions
for struct keyctl_dh_params and struct keyctl_kdf_params when built
without keyutils.h or linux/keyctl.h.
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
include/lapi/keyctl.h | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/include/lapi/keyctl.h b/include/lapi/keyctl.h
index 83fa09303..a056ddaad 100644
--- a/include/lapi/keyctl.h
+++ b/include/lapi/keyctl.h
@@ -20,6 +20,21 @@
# include "lapi/syscalls.h"
typedef int32_t key_serial_t;
+#if !defined(HAVE_KEYUTILS_H) && !defined(HAVE_LINUX_KEYCTL_H)
+struct keyctl_dh_params {
+ int32_t priv;
+ int32_t prime;
+ int32_t base;
+};
+
+struct keyctl_kdf_params {
+ char *hashname;
+ char *otherinfo;
+ uint32_t otherinfolen;
+ uint32_t __spare[8];
+};
+#endif
+
static inline key_serial_t add_key(const char *type,
const char *description,
const void *payload,
@@ -124,6 +139,10 @@ static inline key_serial_t keyctl_join_session_keyring(const char *name) {
# define KEYCTL_CLEAR 7
#endif
+#ifndef KEYCTL_LINK
+# define KEYCTL_LINK 8
+#endif
+
#ifndef KEYCTL_UNLINK
# define KEYCTL_UNLINK 9
#endif
@@ -168,6 +187,18 @@ static inline key_serial_t keyctl_join_session_keyring(const char *name) {
# define KEYCTL_WATCH_KEY 32
#endif
+#ifndef KEYCTL_RESTRICT_KEYRING
+# define KEYCTL_RESTRICT_KEYRING 29
+#endif
+
+#ifndef KEYCTL_MOVE
+# define KEYCTL_MOVE 30
+#endif
+
+#ifndef KEYCTL_MOVE_EXCL
+# define KEYCTL_MOVE_EXCL 0x00000001 /* do not displace from the to-keyring */
+#endif
+
/* key permissions */
#ifndef KEY_POS_VIEW
# define KEY_POS_VIEW 0x01000000
--
2.51.0
More information about the ltp
mailing list