Eric Biggers | f3dc420 | 2019-09-30 13:05:58 -0700 | [diff] [blame] | 1 | #ifndef _UAPI_LINUX_FSCRYPT_H |
| 2 | #define _UAPI_LINUX_FSCRYPT_H |
| 3 | |
| 4 | // Definitions for FS_IOC_ADD_ENCRYPTION_KEY and FS_IOC_REMOVE_ENCRYPTION_KEY |
| 5 | |
| 6 | // TODO: switch to <linux/fscrypt.h> once it's in Bionic |
| 7 | |
| 8 | #ifndef FS_IOC_ADD_ENCRYPTION_KEY |
| 9 | |
| 10 | #include <linux/types.h> |
| 11 | |
| 12 | #define FSCRYPT_KEY_DESCRIPTOR_SIZE 8 |
| 13 | #define FSCRYPT_KEY_IDENTIFIER_SIZE 16 |
| 14 | |
| 15 | #define FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR 1 |
| 16 | #define FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER 2 |
| 17 | |
| 18 | struct fscrypt_key_specifier { |
| 19 | __u32 type; |
| 20 | __u32 __reserved; |
| 21 | union { |
| 22 | __u8 __reserved[32]; |
| 23 | __u8 descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE]; |
| 24 | __u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]; |
| 25 | } u; |
| 26 | }; |
| 27 | |
| 28 | struct fscrypt_add_key_arg { |
| 29 | struct fscrypt_key_specifier key_spec; |
| 30 | __u32 raw_size; |
| 31 | __u32 __reserved[9]; |
| 32 | __u8 raw[]; |
| 33 | }; |
| 34 | |
| 35 | struct fscrypt_remove_key_arg { |
| 36 | struct fscrypt_key_specifier key_spec; |
| 37 | #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY 0x00000001 |
| 38 | #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS 0x00000002 |
| 39 | __u32 removal_status_flags; |
| 40 | __u32 __reserved[5]; |
| 41 | }; |
| 42 | |
| 43 | #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg) |
| 44 | #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg) |
| 45 | |
| 46 | #endif /* FS_IOC_ADD_ENCRYPTION_KEY */ |
| 47 | |
| 48 | #endif /* _UAPI_LINUX_FSCRYPT_H */ |