summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMao Li <maol@codeaurora.org>2015-12-07 20:14:55 +0800
committerzhouxin96 <i@zhouxin96.cn>2016-08-19 12:53:07 +0800
commitb926925d638eefb2345256361bdae7b4bbead4dc (patch)
tree39117f756ca765563594cf42c634f47a2a0809fc
parente9010a79710b9012c11fe62e389e3fbe827bd119 (diff)
downloadandroid_system_security-b926925d638eefb2345256361bdae7b4bbead4dc.tar.gz
android_system_security-b926925d638eefb2345256361bdae7b4bbead4dc.tar.bz2
android_system_security-b926925d638eefb2345256361bdae7b4bbead4dc.zip
keystore: Add SOTER support in keystore
Get and append the ASK key blob to the params set for SOTER. Change-Id: Id4d935af5b62e01727eeb23e72e31b5c00bd2587
-rw-r--r--keystore/keystore.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 8f276f5..e9fa408 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -2433,6 +2433,31 @@ public:
const keymaster1_device_t* device = mKeyStore->getDevice();
const keymaster1_device_t* fallback = mKeyStore->getFallbackDevice();
std::vector<keymaster_key_param_t> opParams(params.params);
+
+ for (auto param: params.params)
+ {
+ switch (param.tag) {
+ case KM_TAG_SOTER_AUTO_SIGNED_COMMON_KEY_WHEN_GET_PUBLIC_KEY:
+ {
+ uid_t callingUid = IPCThreadState::self()->getCallingUid();
+ Blob keyBlob;
+ String8 name8(reinterpret_cast<const char*>(param.blob.data));
+ ResponseCode responseCode = mKeyStore->getKeyForName(&keyBlob,
+ name8, callingUid, TYPE_KEYMASTER_10);
+ if (responseCode != ::NO_ERROR) {
+ return responseCode;
+ }
+ opParams.push_back(keymaster_param_blob(
+ KM_TAG_SOTER_AUTO_SIGNED_COMMON_KEY_WHEN_GET_PUBLIC_KEY_BLOB,
+ keyBlob.getValue(),
+ keyBlob.getLength()));
+ break;
+ }
+ default:
+ break;
+ }
+ }
+
const keymaster_key_param_set_t inParams = {opParams.data(), opParams.size()};
if (device == NULL) {
return ::SYSTEM_ERROR;