keystore: Add SOTER support in keystore
Get and append the ASK key blob to the params set for SOTER.
Change-Id: Id4d935af5b62e01727eeb23e72e31b5c00bd2587
diff --git a/keystore/keystore.cpp b/keystore/keystore.cpp
index 9c1e92c..4a4e3ab 100644
--- a/keystore/keystore.cpp
+++ b/keystore/keystore.cpp
@@ -2388,6 +2388,31 @@
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;