am ee8068b9: Set encrypted flag when appropriate
* commit 'ee8068b9e7bfb2770635062fc9c2035be2142bd8':
Set encrypted flag when appropriate
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 7c6d0f4..441a3bd 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -421,7 +421,11 @@
mBlob.version = CURRENT_BLOB_VERSION;
mBlob.type = uint8_t(type);
- mBlob.flags = KEYSTORE_FLAG_NONE;
+ if (type == TYPE_MASTER_KEY) {
+ mBlob.flags = KEYSTORE_FLAG_ENCRYPTED;
+ } else {
+ mBlob.flags = KEYSTORE_FLAG_NONE;
+ }
}
Blob(blob b) {
@@ -1492,6 +1496,8 @@
String8 filename(mKeyStore->getKeyNameForUidWithDir(name8, targetUid));
Blob keyBlob(item, itemLength, NULL, 0, ::TYPE_GENERIC);
+ keyBlob.setEncrypted(flags & KEYSTORE_FLAG_ENCRYPTED);
+
return mKeyStore->put(filename.string(), &keyBlob, callingUid);
}
@@ -1848,6 +1854,7 @@
Blob keyBlob(data, dataLength, NULL, 0, TYPE_KEY_PAIR);
free(data);
+ keyBlob.setEncrypted(flags & KEYSTORE_FLAG_ENCRYPTED);
keyBlob.setFallback(isFallback);
return mKeyStore->put(filename.string(), &keyBlob, callingUid);