summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Crowley <paulcrowley@google.com>2015-05-28 16:45:52 +0100
committerPaul Crowley <paulcrowley@google.com>2015-07-09 18:09:17 +0100
commit45f1a1fd1f1cea461abea44de4b0696b6c45767f (patch)
treedce26eb4098355f912e71df2f8144e8dd42e58d2
parent15e73f525c38d9ccdf8806a6227e83867b8e259b (diff)
downloadextras-45f1a1fd1f1cea461abea44de4b0696b6c45767f.tar.gz
Add e4crypt_set_user_crypto_policies, calls vdc setusercryptopolicies
Bug: 19704432 (cherry picked from commit 09d3fdffad0ccbed36f0ece966e85aed23c626d7) Change-Id: Ib7ef9365063ed69774169b22071f2a42d2f5ef21
-rw-r--r--ext4_utils/ext4_crypt_init_extensions.cpp10
-rw-r--r--ext4_utils/ext4_crypt_init_extensions.h1
2 files changed, 11 insertions, 0 deletions
diff --git a/ext4_utils/ext4_crypt_init_extensions.cpp b/ext4_utils/ext4_crypt_init_extensions.cpp
index e1b69e1e..5e167a54 100644
--- a/ext4_utils/ext4_crypt_init_extensions.cpp
+++ b/ext4_utils/ext4_crypt_init_extensions.cpp
@@ -164,3 +164,13 @@ int e4crypt_set_directory_policy(const char* dir)
return 0;
}
+
+int e4crypt_set_user_crypto_policies(const char* dir)
+{
+ auto command = std::string() + "cryptfs setusercryptopolicies " + dir;
+ auto result = vold_command(command);
+ // ext4enc:TODO proper error handling
+ KLOG_INFO(TAG, "setusercryptopolicies 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 79311246..d02d181d 100644
--- a/ext4_utils/ext4_crypt_init_extensions.h
+++ b/ext4_utils/ext4_crypt_init_extensions.h
@@ -11,5 +11,6 @@ int e4crypt_create_device_key(const char* path,
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);
__END_DECLS