summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChad Brubaker <cbrubaker@google.com>2015-06-04 13:49:44 -0700
committerChad Brubaker <cbrubaker@google.com>2015-06-04 13:57:56 -0700
commit3cc40125e8b495e7f0784dad53bb9acdb5b9a8eb (patch)
treecfa3c65e74325c2e9c8ce63cc51f0938f8d5d379
parentf82cd5c843faddb89156d331c8d96522878a0524 (diff)
downloadandroid_system_security-3cc40125e8b495e7f0784dad53bb9acdb5b9a8eb.tar.gz
android_system_security-3cc40125e8b495e7f0784dad53bb9acdb5b9a8eb.tar.bz2
android_system_security-3cc40125e8b495e7f0784dad53bb9acdb5b9a8eb.zip
Allow keymaster 0.3 keys to interopt with keymaster 1.0 methods
Keymaster 0.3 keys are all valid keymaster 1.0 keys, so allow get to return a keymaster 0.3 when looking for a 1.0 key to allow new methods to work on old keys. Change-Id: I20a32e39769a548224bcca7a42ef967285431c5d
-rw-r--r--keystore/keystore.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index a17ca20..b23770f 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -1182,6 +1182,12 @@ public:
}
}
+ // Keymaster 0.3 keys are valid keymaster 1.0 keys, so silently upgrade
+ // them if needed.
+ if (type == TYPE_KEYMASTER_10 && keyBlob->getType() == TYPE_KEY_PAIR) {
+ keyBlob->setType(TYPE_KEYMASTER_10);
+ }
+
if (type != TYPE_ANY && keyBlob->getType() != type) {
ALOGW("key found but type doesn't match: %d vs %d", keyBlob->getType(), type);
return KEY_NOT_FOUND;