1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <inttypes.h> 5 #include <linux/keyctl.h> 6 7 #ifndef KEYCTL_JOIN_SESSION_KEYRING 8 #define KEYCTL_JOIN_SESSION_KEYRING 1 9 #endif 10 11 #ifndef KEYCTL_CHOWN 12 #define KEYCTL_CHOWN 4 13 #endif 14 15 #ifndef KEYCTL_SETPERM 16 #define KEYCTL_SETPERM 5 17 #endif 18 19 #ifndef KEYCTL_DESCRIBE 20 #define KEYCTL_DESCRIBE 6 21 #endif 22 23 #ifndef KEYCTL_LINK 24 #define KEYCTL_LINK 8 25 #endif 26 27 #ifndef KEYCTL_READ 28 #define KEYCTL_READ 11 29 #endif 30 31 #ifndef KEYCTL_SET_TIMEOUT 32 #define KEYCTL_SET_TIMEOUT 15 33 #endif 34 35 #ifndef KEY_SPEC_USER_KEYRING 36 #define KEY_SPEC_USER_KEYRING -4 37 #endif 38 39 #ifndef KEY_SPEC_SESSION_KEYRING 40 #define KEY_SPEC_SESSION_KEYRING -3 41 #endif 42 43 /* From linux/key.h */ 44 #ifndef KEY_POS_VIEW 45 46 typedef int32_t key_serial_t; 47 48 #define KEY_POS_VIEW 0x01000000 49 #define KEY_POS_READ 0x02000000 50 #define KEY_POS_WRITE 0x04000000 51 #define KEY_POS_SEARCH 0x08000000 52 #define KEY_POS_LINK 0x10000000 53 #define KEY_POS_SETATTR 0x20000000 54 #define KEY_POS_ALL 0x3f000000 55 56 #define KEY_USR_VIEW 0x00010000 57 #define KEY_USR_READ 0x00020000 58 #define KEY_USR_WRITE 0x00040000 59 #define KEY_USR_SEARCH 0x00080000 60 #define KEY_USR_LINK 0x00100000 61 #define KEY_USR_SETATTR 0x00200000 62 #define KEY_USR_ALL 0x003f0000 63 64 #define KEY_GRP_VIEW 0x00000100 65 #define KEY_GRP_READ 0x00000200 66 #define KEY_GRP_WRITE 0x00000400 67 #define KEY_GRP_SEARCH 0x00000800 68 #define KEY_GRP_LINK 0x00001000 69 #define KEY_GRP_SETATTR 0x00002000 70 #define KEY_GRP_ALL 0x00003f00 71 72 #define KEY_OTH_VIEW 0x00000001 73 #define KEY_OTH_READ 0x00000002 74 #define KEY_OTH_WRITE 0x00000004 75 #define KEY_OTH_SEARCH 0x00000008 76 #define KEY_OTH_LINK 0x00000010 77 #define KEY_OTH_SETATTR 0x00000020 78 #define KEY_OTH_ALL 0x0000003f 79 #endif 80