• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /****************************************************************************
2   ****************************************************************************
3   ***
4   ***   This header was automatically generated from a Linux kernel header
5   ***   of the same name, to make information necessary for userspace to
6   ***   call into the kernel available to libc.  It contains only constants,
7   ***   structures, and macros generated from the original header, and thus,
8   ***   contains no copyrightable information.
9   ***
10   ***   To edit the content of this header, modify the corresponding
11   ***   source file (e.g. under external/kernel-headers/original/) then
12   ***   run bionic/libc/kernel/tools/update_all.py
13   ***
14   ***   Any manual change here will be lost the next time this script will
15   ***   be run. You've been warned!
16   ***
17   ****************************************************************************
18   ****************************************************************************/
19  #ifndef _UAPI_LINUX_FSCRYPT_H
20  #define _UAPI_LINUX_FSCRYPT_H
21  #include <linux/ioctl.h>
22  #include <linux/types.h>
23  #define FSCRYPT_POLICY_FLAGS_PAD_4 0x00
24  #define FSCRYPT_POLICY_FLAGS_PAD_8 0x01
25  #define FSCRYPT_POLICY_FLAGS_PAD_16 0x02
26  #define FSCRYPT_POLICY_FLAGS_PAD_32 0x03
27  #define FSCRYPT_POLICY_FLAGS_PAD_MASK 0x03
28  #define FSCRYPT_POLICY_FLAG_DIRECT_KEY 0x04
29  #define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_64 0x08
30  #define FSCRYPT_POLICY_FLAG_IV_INO_LBLK_32 0x10
31  #define FSCRYPT_MODE_AES_256_XTS 1
32  #define FSCRYPT_MODE_AES_256_CTS 4
33  #define FSCRYPT_MODE_AES_128_CBC 5
34  #define FSCRYPT_MODE_AES_128_CTS 6
35  #define FSCRYPT_MODE_SM4_XTS 7
36  #define FSCRYPT_MODE_SM4_CTS 8
37  #define FSCRYPT_MODE_ADIANTUM 9
38  #define FSCRYPT_MODE_AES_256_HCTR2 10
39  #define FSCRYPT_POLICY_V1 0
40  #define FSCRYPT_KEY_DESCRIPTOR_SIZE 8
41  struct fscrypt_policy_v1 {
42    __u8 version;
43    __u8 contents_encryption_mode;
44    __u8 filenames_encryption_mode;
45    __u8 flags;
46    __u8 master_key_descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
47  };
48  #define FSCRYPT_KEY_DESC_PREFIX "fscrypt:"
49  #define FSCRYPT_KEY_DESC_PREFIX_SIZE 8
50  #define FSCRYPT_MAX_KEY_SIZE 64
51  struct fscrypt_key {
52    __u32 mode;
53    __u8 raw[FSCRYPT_MAX_KEY_SIZE];
54    __u32 size;
55  };
56  #define FSCRYPT_POLICY_V2 2
57  #define FSCRYPT_KEY_IDENTIFIER_SIZE 16
58  struct fscrypt_policy_v2 {
59    __u8 version;
60    __u8 contents_encryption_mode;
61    __u8 filenames_encryption_mode;
62    __u8 flags;
63    __u8 __reserved[4];
64    __u8 master_key_identifier[FSCRYPT_KEY_IDENTIFIER_SIZE];
65  };
66  struct fscrypt_get_policy_ex_arg {
67    __u64 policy_size;
68    union {
69      __u8 version;
70      struct fscrypt_policy_v1 v1;
71      struct fscrypt_policy_v2 v2;
72    } policy;
73  };
74  #define FSCRYPT_KEY_SPEC_TYPE_DESCRIPTOR 1
75  #define FSCRYPT_KEY_SPEC_TYPE_IDENTIFIER 2
76  struct fscrypt_key_specifier {
77    __u32 type;
78    __u32 __reserved;
79    union {
80      __u8 __reserved[32];
81      __u8 descriptor[FSCRYPT_KEY_DESCRIPTOR_SIZE];
82      __u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE];
83    } u;
84  };
85  struct fscrypt_provisioning_key_payload {
86    __u32 type;
87    __u32 __reserved;
88    __u8 raw[];
89  };
90  struct fscrypt_add_key_arg {
91    struct fscrypt_key_specifier key_spec;
92    __u32 raw_size;
93    __u32 key_id;
94    __u32 __reserved[7];
95  #define __FSCRYPT_ADD_KEY_FLAG_HW_WRAPPED 0x00000001
96    __u32 __flags;
97    __u8 raw[];
98  };
99  struct fscrypt_remove_key_arg {
100    struct fscrypt_key_specifier key_spec;
101  #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_FILES_BUSY 0x00000001
102  #define FSCRYPT_KEY_REMOVAL_STATUS_FLAG_OTHER_USERS 0x00000002
103    __u32 removal_status_flags;
104    __u32 __reserved[5];
105  };
106  struct fscrypt_get_key_status_arg {
107    struct fscrypt_key_specifier key_spec;
108    __u32 __reserved[6];
109  #define FSCRYPT_KEY_STATUS_ABSENT 1
110  #define FSCRYPT_KEY_STATUS_PRESENT 2
111  #define FSCRYPT_KEY_STATUS_INCOMPLETELY_REMOVED 3
112    __u32 status;
113  #define FSCRYPT_KEY_STATUS_FLAG_ADDED_BY_SELF 0x00000001
114    __u32 status_flags;
115    __u32 user_count;
116    __u32 __out_reserved[13];
117  };
118  #define FS_IOC_SET_ENCRYPTION_POLICY _IOR('f', 19, struct fscrypt_policy_v1)
119  #define FS_IOC_GET_ENCRYPTION_PWSALT _IOW('f', 20, __u8[16])
120  #define FS_IOC_GET_ENCRYPTION_POLICY _IOW('f', 21, struct fscrypt_policy_v1)
121  #define FS_IOC_GET_ENCRYPTION_POLICY_EX _IOWR('f', 22, __u8[9])
122  #define FS_IOC_ADD_ENCRYPTION_KEY _IOWR('f', 23, struct fscrypt_add_key_arg)
123  #define FS_IOC_REMOVE_ENCRYPTION_KEY _IOWR('f', 24, struct fscrypt_remove_key_arg)
124  #define FS_IOC_REMOVE_ENCRYPTION_KEY_ALL_USERS _IOWR('f', 25, struct fscrypt_remove_key_arg)
125  #define FS_IOC_GET_ENCRYPTION_KEY_STATUS _IOWR('f', 26, struct fscrypt_get_key_status_arg)
126  #define FS_IOC_GET_ENCRYPTION_NONCE _IOR('f', 27, __u8[16])
127  #define fscrypt_policy fscrypt_policy_v1
128  #define FS_KEY_DESCRIPTOR_SIZE FSCRYPT_KEY_DESCRIPTOR_SIZE
129  #define FS_POLICY_FLAGS_PAD_4 FSCRYPT_POLICY_FLAGS_PAD_4
130  #define FS_POLICY_FLAGS_PAD_8 FSCRYPT_POLICY_FLAGS_PAD_8
131  #define FS_POLICY_FLAGS_PAD_16 FSCRYPT_POLICY_FLAGS_PAD_16
132  #define FS_POLICY_FLAGS_PAD_32 FSCRYPT_POLICY_FLAGS_PAD_32
133  #define FS_POLICY_FLAGS_PAD_MASK FSCRYPT_POLICY_FLAGS_PAD_MASK
134  #define FS_POLICY_FLAG_DIRECT_KEY FSCRYPT_POLICY_FLAG_DIRECT_KEY
135  #define FS_POLICY_FLAGS_VALID 0x07
136  #define FS_ENCRYPTION_MODE_INVALID 0
137  #define FS_ENCRYPTION_MODE_AES_256_XTS FSCRYPT_MODE_AES_256_XTS
138  #define FS_ENCRYPTION_MODE_AES_256_GCM 2
139  #define FS_ENCRYPTION_MODE_AES_256_CBC 3
140  #define FS_ENCRYPTION_MODE_AES_256_CTS FSCRYPT_MODE_AES_256_CTS
141  #define FS_ENCRYPTION_MODE_AES_128_CBC FSCRYPT_MODE_AES_128_CBC
142  #define FS_ENCRYPTION_MODE_AES_128_CTS FSCRYPT_MODE_AES_128_CTS
143  #define FS_ENCRYPTION_MODE_ADIANTUM FSCRYPT_MODE_ADIANTUM
144  #define FS_KEY_DESC_PREFIX FSCRYPT_KEY_DESC_PREFIX
145  #define FS_KEY_DESC_PREFIX_SIZE FSCRYPT_KEY_DESC_PREFIX_SIZE
146  #define FS_MAX_KEY_SIZE FSCRYPT_MAX_KEY_SIZE
147  #endif
148