summaryrefslogtreecommitdiff
path: root/init/builtins.cpp
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2015-05-28 17:35:06 +0100
committerPaul Crowley <paulcrowley@google.com>2015-06-23 15:21:51 +0000
commit749af8c08f6db8da4202ad93f9a6d06884b27c0d (patch)
tree75e05aa61b8c858d3c20d64f82d581ef6ca63885 /init/builtins.cpp
parentbd5cb997233acbfa2bebcafa698994d744e5c9a7 (diff)
Set up user directory crypto in init.
(cherry-picked from commit b94032b79c3cded501e2d5f7c328cf8c0c3911c4) Bug: 19704432 Change-Id: Ife4928ffbee39c8ae69e6ba66d9ce5ef5a0beb76
Diffstat (limited to 'init/builtins.cpp')
-rw-r--r--init/builtins.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/init/builtins.cpp b/init/builtins.cpp
index 9e5f9ff89..335f37141 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]);
+}