hc
2024-05-10 61598093bbdd283a7edc367d900f223070ead8d2
kernel/include/uapi/linux/keyctl.h
....@@ -61,7 +61,15 @@
6161 #define KEYCTL_INVALIDATE 21 /* invalidate a key */
6262 #define KEYCTL_GET_PERSISTENT 22 /* get a user's persistent keyring */
6363 #define KEYCTL_DH_COMPUTE 23 /* Compute Diffie-Hellman values */
64
+#define KEYCTL_PKEY_QUERY 24 /* Query public key parameters */
65
+#define KEYCTL_PKEY_ENCRYPT 25 /* Encrypt a blob using a public key */
66
+#define KEYCTL_PKEY_DECRYPT 26 /* Decrypt a blob using a public key */
67
+#define KEYCTL_PKEY_SIGN 27 /* Create a public key signature */
68
+#define KEYCTL_PKEY_VERIFY 28 /* Verify a public key signature */
6469 #define KEYCTL_RESTRICT_KEYRING 29 /* Restrict keys allowed to link to a keyring */
70
+#define KEYCTL_MOVE 30 /* Move keys between keyrings */
71
+#define KEYCTL_CAPABILITIES 31 /* Find capabilities of keyrings subsystem */
72
+#define KEYCTL_WATCH_KEY 32 /* Watch a key or ring of keys for changes */
6573
6674 /* keyctl structures */
6775 struct keyctl_dh_params {
....@@ -82,4 +90,47 @@
8290 __u32 __spare[8];
8391 };
8492
93
+#define KEYCTL_SUPPORTS_ENCRYPT 0x01
94
+#define KEYCTL_SUPPORTS_DECRYPT 0x02
95
+#define KEYCTL_SUPPORTS_SIGN 0x04
96
+#define KEYCTL_SUPPORTS_VERIFY 0x08
97
+
98
+struct keyctl_pkey_query {
99
+ __u32 supported_ops; /* Which ops are supported */
100
+ __u32 key_size; /* Size of the key in bits */
101
+ __u16 max_data_size; /* Maximum size of raw data to sign in bytes */
102
+ __u16 max_sig_size; /* Maximum size of signature in bytes */
103
+ __u16 max_enc_size; /* Maximum size of encrypted blob in bytes */
104
+ __u16 max_dec_size; /* Maximum size of decrypted blob in bytes */
105
+ __u32 __spare[10];
106
+};
107
+
108
+struct keyctl_pkey_params {
109
+ __s32 key_id; /* Serial no. of public key to use */
110
+ __u32 in_len; /* Input data size */
111
+ union {
112
+ __u32 out_len; /* Output buffer size (encrypt/decrypt/sign) */
113
+ __u32 in2_len; /* 2nd input data size (verify) */
114
+ };
115
+ __u32 __spare[7];
116
+};
117
+
118
+#define KEYCTL_MOVE_EXCL 0x00000001 /* Do not displace from the to-keyring */
119
+
120
+/*
121
+ * Capabilities flags. The capabilities list is an array of 8-bit integers;
122
+ * each integer can carry up to 8 flags.
123
+ */
124
+#define KEYCTL_CAPS0_CAPABILITIES 0x01 /* KEYCTL_CAPABILITIES supported */
125
+#define KEYCTL_CAPS0_PERSISTENT_KEYRINGS 0x02 /* Persistent keyrings enabled */
126
+#define KEYCTL_CAPS0_DIFFIE_HELLMAN 0x04 /* Diffie-Hellman computation enabled */
127
+#define KEYCTL_CAPS0_PUBLIC_KEY 0x08 /* Public key ops enabled */
128
+#define KEYCTL_CAPS0_BIG_KEY 0x10 /* big_key-type enabled */
129
+#define KEYCTL_CAPS0_INVALIDATE 0x20 /* KEYCTL_INVALIDATE supported */
130
+#define KEYCTL_CAPS0_RESTRICT_KEYRING 0x40 /* KEYCTL_RESTRICT_KEYRING supported */
131
+#define KEYCTL_CAPS0_MOVE 0x80 /* KEYCTL_MOVE supported */
132
+#define KEYCTL_CAPS1_NS_KEYRING_NAME 0x01 /* Keyring names are per-user_namespace */
133
+#define KEYCTL_CAPS1_NS_KEY_TAG 0x02 /* Key indexing can include a namespace tag */
134
+#define KEYCTL_CAPS1_NOTIFICATIONS 0x04 /* Keys generate watchable notifications */
135
+
85136 #endif /* _LINUX_KEYCTL_H */