Merge "Allow Device IDs in Key attestation request"
diff --git a/keystore/key_store_service.cpp b/keystore/key_store_service.cpp
index a61f7dc..00d20bc 100644
--- a/keystore/key_store_service.cpp
+++ b/keystore/key_store_service.cpp
@@ -1547,14 +1547,15 @@
return Status::ok();
}
- if (isDeviceIdAttestationRequested(params)) {
- // There is a dedicated attestDeviceIds() method for device ID attestation.
+ uid_t callingUid = IPCThreadState::self()->getCallingUid();
+
+ if (isDeviceIdAttestationRequested(params) && (callingUid != AID_SYSTEM)) {
+ // Only the system context may request Device ID attestation combined with key attestation.
+ // Otherwise, There is a dedicated attestDeviceIds() method for device ID attestation.
*aidl_return = static_cast<int32_t>(KeyStoreServiceReturnCode(ErrorCode::INVALID_ARGUMENT));
return Status::ok();
}
- uid_t callingUid = IPCThreadState::self()->getCallingUid();
-
AuthorizationSet mutableParams = params.getParameters();
KeyStoreServiceReturnCode rc = updateParamsForAttestation(callingUid, &mutableParams);
if (!rc.isOk()) {