diff options
| author | LuK1337 <priv.luk@gmail.com> | 2019-08-19 01:01:45 +0200 |
|---|---|---|
| committer | Michele Bono <bono.michele94@gmail.com> | 2019-08-19 23:21:37 +0200 |
| commit | 79a7bc07826dca033c9606b2779bbe9cccd2ef53 (patch) | |
| tree | 47ae9abdd5a50dc6652b87eb4f9ee1832b1ae3dd /vdc.cpp | |
| parent | 2c21e1bf424cf5d775229178a9e51b4f11716984 (diff) | |
Add "changepw" command to vdc.p9.0
* Before moving to binder, 'changepw' was
supported, and people used it to set
different FDE decryption pwd from the
lockscreen one. This change adds it back.
Change-Id: Id83ebb8eafe15263d8a694da9a3353866f912e3f
Diffstat (limited to 'vdc.cpp')
| -rw-r--r-- | vdc.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
@@ -38,6 +38,8 @@ #include <private/android_filesystem_config.h> +#include "cryptfs.h" + static void usage(char *progname); static android::sp<android::IBinder> getServiceAggressive() { @@ -61,6 +63,20 @@ static void checkStatus(android::binder::Status status) { exit(ENOTTY); } +static int getType(const std::string &type) { + if (type == "default") { + return CRYPT_TYPE_DEFAULT; + } else if (type == "password") { + return CRYPT_TYPE_PASSWORD; + } else if (type == "pin") { + return CRYPT_TYPE_PIN; + } else if (type == "pattern") { + return CRYPT_TYPE_PATTERN; + } else { + return -1; + } +} + int main(int argc, char** argv) { setenv("ANDROID_LOG_TAGS", "*:v", 1); if (getppid() == 1) { @@ -105,6 +121,9 @@ int main(int argc, char** argv) { checkStatus(vold->mountFstab(args[2])); } else if (args[0] == "cryptfs" && args[1] == "encryptFstab" && args.size() == 3) { checkStatus(vold->encryptFstab(args[2])); + } else if (args[0] == "cryptfs" && args[1] == "changepw" && args.size() == 5) { + int type = getType(args[2]); + checkStatus(vold->fdeChangePassword(type, args[3], args[4])); } else { LOG(ERROR) << "Raw commands are no longer supported"; exit(EINVAL); |
