diff options
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index bab30d7..9901786 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -816,9 +816,9 @@ int do_load_persist_props(int nargs, char **args) { return -1; } -int do_load_all_props(int nargs, char **args) { +int do_load_system_props(int nargs, char **args) { if (nargs == 1) { - load_all_props(); + load_system_props(); return 0; } return -1; @@ -846,18 +846,31 @@ static int do_installkeys_ensure_dir_exists(const char* dir) return 0; } +static bool is_file_crypto() { + char prop_value[PROP_VALUE_MAX] = {0}; + property_get("ro.crypto.type", prop_value); + return strcmp(prop_value, "file") == 0; +} + int do_installkey(int nargs, char **args) { if (nargs != 2) { return -1; } - - char prop_value[PROP_VALUE_MAX] = {0}; - property_get("ro.crypto.type", prop_value); - if (strcmp(prop_value, "file")) { + if (!is_file_crypto()) { return 0; } - return e4crypt_create_device_key(args[1], do_installkeys_ensure_dir_exists); } + +int do_setusercryptopolicies(int nargs, char **args) +{ + if (nargs != 2) { + return -1; + } + if (!is_file_crypto()) { + return 0; + } + return e4crypt_set_user_crypto_policies(args[1]); +} |