summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZhen Kong <zkong@codeaurora.org>2015-09-30 18:42:58 -0700
committerLinux Build Service Account <lnxbuild@localhost>2015-10-06 03:22:48 -0600
commit52415c53e2c0cf1dbbcad11d5ff22e9817709b22 (patch)
tree4d06cbbc6c275cec503d1f986af60c6133d124b6
parentcbfdeefef7a12fcb383e8b0f840771f6983927aa (diff)
downloadandroid_system_security-52415c53e2c0cf1dbbcad11d5ff22e9817709b22.tar.gz
android_system_security-52415c53e2c0cf1dbbcad11d5ff22e9817709b22.tar.bz2
android_system_security-52415c53e2c0cf1dbbcad11d5ff22e9817709b22.zip
keystore: Read KeyBlob after type change
During type change, the keyblob gets encrypted, read keyblob again to decrypt the keyblob. Change-Id: I74e9c4b835e165d71a5e4a265496247bf72a6737
-rw-r--r--keystore/keystore.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 65a8ea9..609a578 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -1201,6 +1201,15 @@ public:
if (keyBlob->getType() == TYPE_KEY_PAIR) {
keyBlob->setType(TYPE_KEYMASTER_10);
rc = this->put(filename, keyBlob, userId);
+ if (rc != NO_ERROR) {
+ return rc;
+ }
+
+ rc = keyBlob->readBlob(filename, userState->getDecryptionKey(),
+ userState->getState());
+ if (rc != NO_ERROR) {
+ return rc;
+ }
}
if (type != TYPE_ANY && keyBlob->getType() != type) {