blob: cc692735647634d947f519e7139e1a8369f3a8ee [file] [log] [blame]
Paul Lawrence92da49d2015-02-25 15:11:13 -08001#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
8int e4crypt_install_keyring();
9int e4crypt_install_key(const char* dir);
Paul Lawrencef9768752015-03-30 09:16:09 -070010int e4crypt_create_device_key(const char* dir,
11 int ensure_dir_exists(const char* dir));
Paul Lawrence92da49d2015-02-25 15:11:13 -080012
13// General functions
14bool e4crypt_non_default_key(const char* dir);
15int e4crypt_set_directory_policy(const char* dir);
16int e4crypt_main(int argc, char* argv[]);
17int e4crypt_change_password(const char* path, int crypt_type,
18 const char* password);
19int e4crypt_get_password_type(const char* path);
20int e4crypt_crypto_complete(const char* dir);
21int e4crypt_check_passwd(const char* dir, const char* password);
22const char* e4crypt_get_password(const char* dir);
23int 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
29typedef 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
39key_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
45long keyctl_setperm(key_serial_t id, int permissions);
46
47// Set policy on directory
48int do_policy_set(const char *directory, const char *policy);
49
50__END_DECLS