diff options
author | Paul Crowley <paulcrowley@google.com> | 2015-07-13 20:52:43 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2015-07-13 20:52:45 +0000 |
commit | ee923139c346e6751203fc7d2a341388e01c7b19 (patch) | |
tree | eaf54658aca60e6ad33661782138f7b210406f50 /init/builtins.cpp | |
parent | d5ef984195779aa9e27d7baabdd751d641eea1a0 (diff) | |
parent | 749af8c08f6db8da4202ad93f9a6d06884b27c0d (diff) |
Merge "Set up user directory crypto in init." into mnc-dr-dev
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r-- | init/builtins.cpp | 23 |
1 files changed, 18 insertions, 5 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp index 64a363e98..8eb5b5b32 100644 --- a/init/builtins.cpp +++ b/init/builtins.cpp @@ -833,18 +833,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]); +} |