libsparse: remove unused files
[project/make_ext4fs.git] / ext4_crypt.h
1 #include <stdbool.h>
2 #include <sys/cdefs.h>
3 #include <sys/types.h>
4
5 __BEGIN_DECLS
6 // These functions assume they are being called from init
7 // They will not operate properly outside of init
8 int e4crypt_install_keyring();
9 int e4crypt_install_key(const char* dir);
10 int e4crypt_create_device_key(const char* dir,
11                               int ensure_dir_exists(const char* dir));
12
13 // General functions
14 bool e4crypt_non_default_key(const char* dir);
15 int e4crypt_set_directory_policy(const char* dir);
16 int e4crypt_main(int argc, char* argv[]);
17 int e4crypt_change_password(const char* path, int crypt_type,
18                             const char* password);
19 int e4crypt_get_password_type(const char* path);
20 int e4crypt_crypto_complete(const char* dir);
21 int e4crypt_check_passwd(const char* dir, const char* password);
22 const char* e4crypt_get_password(const char* dir);
23 int e4crypt_restart(const char* dir);
24
25 // Key functions. ext4enc:TODO Move to own file
26
27 // ext4enc:TODO - get these keyring standard definitions from proper system file
28 // keyring serial number type
29 typedef int32_t key_serial_t;
30
31 // special process keyring shortcut IDs
32 #define KEY_SPEC_THREAD_KEYRING       -1 // key ID for thread-specific keyring
33 #define KEY_SPEC_PROCESS_KEYRING      -2 // key ID for process-specific keyring
34 #define KEY_SPEC_SESSION_KEYRING      -3 // key ID for session-specific keyring
35 #define KEY_SPEC_USER_KEYRING         -4 // key ID for UID-specific keyring
36 #define KEY_SPEC_USER_SESSION_KEYRING -5 // key ID for UID-session keyring
37 #define KEY_SPEC_GROUP_KEYRING        -6 // key ID for GID-specific keyring
38
39 key_serial_t add_key(const char *type,
40                      const char *description,
41                      const void *payload,
42                      size_t plen,
43                      key_serial_t ringid);
44
45 long keyctl_setperm(key_serial_t id, int permissions);
46
47 // Set policy on directory
48 int do_policy_set(const char *directory, const char *policy);
49
50 __END_DECLS