diff options
| author | LuK1337 <priv.luk@gmail.com> | 2019-08-19 01:01:45 +0200 |
|---|---|---|
| committer | doc HD <doc.divxm@gmail.com> | 2019-11-01 23:08:23 +0300 |
| commit | 51179232d4ec3314e3a5135be928c669ff8970a4 (patch) | |
| tree | 92b599c34ac7406f5b93e65574a18f3c0abb52d8 | |
| parent | c7c0d3c4c0ce6c2f338ec917cbfc0b513f6dade2 (diff) | |
Add "changepw" command to vdc.q10.0-backup
* 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
| -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], args[3])); } else if (args[0] == "cryptfs" && args[1] == "encryptFstab" && args.size() == 4) { checkStatus(vold->encryptFstab(args[2], args[3])); + } 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 if (args[0] == "checkpoint" && args[1] == "supportsCheckpoint" && args.size() == 2) { bool supported = false; checkStatus(vold->supportsCheckpoint(&supported)); |
