1 #ifndef _KEY_CONTROL_H_
2 #define _KEY_CONTROL_H_
3 
4 #include <sys/cdefs.h>
5 #include <sys/types.h>
6 
7 __BEGIN_DECLS
8 
9 // ext4enc:TODO - get these keyring standard definitions from proper system file
10 // keyring serial number type
11 typedef int32_t key_serial_t;
12 
13 // special process keyring shortcut IDs
14 #define KEY_SPEC_THREAD_KEYRING       (-1) // key ID for thread-specific keyring
15 #define KEY_SPEC_PROCESS_KEYRING      (-2) // key ID for process-specific keyring
16 #define KEY_SPEC_SESSION_KEYRING      (-3) // key ID for session-specific keyring
17 #define KEY_SPEC_USER_KEYRING         (-4) // key ID for UID-specific keyring
18 #define KEY_SPEC_USER_SESSION_KEYRING (-5) // key ID for UID-session keyring
19 #define KEY_SPEC_GROUP_KEYRING        (-6) // key ID for GID-specific keyring
20 
21 key_serial_t add_key(const char *type,
22                      const char *description,
23                      const void *payload,
24                      size_t plen,
25                      key_serial_t ringid);
26 
27 long keyctl_unlink(key_serial_t key, key_serial_t keyring);
28 
29 long keyctl_setperm(key_serial_t id, int permissions);
30 
31 long keyctl_search(key_serial_t ringid, const char *type,
32                    const char *description, key_serial_t destringid);
33 
34 __END_DECLS
35 
36 #endif // _KEY_CONTROL_H_
37