diff options
Diffstat (limited to 'ext4_utils')
-rw-r--r-- | ext4_utils/ext4_crypt_init_extensions.cpp | 13 | ||||
-rw-r--r-- | ext4_utils/ext4_crypt_init_extensions.h | 2 |
2 files changed, 15 insertions, 0 deletions
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp index 50f4683d..ec8b9379 100644 --- a/ext4_utils/ext4_crypt_init_extensions.cpp +++ b/ext4_utils/ext4_crypt_init_extensions.cpp @@ -184,3 +184,16 @@ int e4crypt_set_user_crypto_policies(const char* dir) result.c_str()); return 0; } + +int e4crypt_create_user_key(userid_t user_id, int serial, bool ephemeral) +{ + auto command = std::string() + "cryptfs create_user_key " + + std::to_string(user_id) + " " + + std::to_string(serial) + " " + + (ephemeral ? "1" : "0"); + auto result = vold_command(command); + // ext4enc:TODO proper error handling + KLOG_INFO(TAG, "create_user_key returned with result %s\n", + result.c_str()); + return 0; +} diff --git a/ext4_utils/ext4_crypt_init_extensions.h b/ext4_utils/ext4_crypt_init_extensions.h index d02d181d..3bd19377 100644 --- a/ext4_utils/ext4_crypt_init_extensions.h +++ b/ext4_utils/ext4_crypt_init_extensions.h @@ -1,5 +1,6 @@ #include <sys/cdefs.h> #include <stdbool.h> +#include <cutils/multiuser.h> __BEGIN_DECLS @@ -12,5 +13,6 @@ int e4crypt_set_directory_policy(const char* path); bool e4crypt_non_default_key(const char* path); int do_policy_set(const char *directory, const char *policy, int policy_length); int e4crypt_set_user_crypto_policies(const char* path); +int e4crypt_create_user_key(userid_t user_id, int serial, bool ephemeral); __END_DECLS |