Implement getHardwareInfo() in Trusty KM TA

Bug: 253109915
Test: VtsHalRemotelyProvisionedComponentTargetTest
Change-Id: I579d563759a3af97100da95dab6a99ca52d0b384
This commit is contained in:
Tri Vo 2022-10-11 17:37:45 -07:00
parent 1d0fec78c4
commit 025b7f3cd8
4 changed files with 19 additions and 4 deletions

View file

@ -285,4 +285,10 @@ GetRootOfTrustResponse TrustyKeymaster::GetRootOfTrust(const GetRootOfTrustReque
return response;
}
GetHwInfoResponse TrustyKeymaster::GetHwInfo() {
GetHwInfoResponse response(message_version());
ForwardCommand(KM_GET_HW_INFO, GetHwInfoRequest(message_version()), &response);
return response;
}
} // namespace keymaster

View file

@ -67,6 +67,7 @@ class TrustyKeymaster {
ConfigureVendorPatchlevelResponse ConfigureVendorPatchlevel(
const ConfigureVendorPatchlevelRequest& request);
GetRootOfTrustResponse GetRootOfTrust(const GetRootOfTrustRequest& request);
GetHwInfoResponse GetHwInfo();
uint32_t message_version() const { return message_version_; }

View file

@ -60,6 +60,7 @@ enum keymaster_command : uint32_t {
KM_GENERATE_CSR = (32 << KEYMASTER_REQ_SHIFT),
KM_CONFIGURE_VENDOR_PATCHLEVEL = (33 << KEYMASTER_REQ_SHIFT),
KM_GET_ROOT_OF_TRUST = (34 << KEYMASTER_REQ_SHIFT),
KM_GET_HW_INFO = (35 << KEYMASTER_REQ_SHIFT),
// Bootloader/provisioning calls.
KM_SET_BOOT_PARAMS = (0x1000 << KEYMASTER_REQ_SHIFT),

View file

@ -30,6 +30,8 @@ using keymaster::GenerateCsrRequest;
using keymaster::GenerateCsrResponse;
using keymaster::GenerateRkpKeyRequest;
using keymaster::GenerateRkpKeyResponse;
using keymaster::GetHwInfoRequest;
using keymaster::GetHwInfoResponse;
using keymaster::KeymasterBlob;
using ::std::string;
using ::std::unique_ptr;
@ -71,10 +73,15 @@ class Status {
} // namespace
ScopedAStatus TrustyRemotelyProvisionedComponentDevice::getHardwareInfo(RpcHardwareInfo* info) {
info->versionNumber = 2;
info->rpcAuthorName = "Google";
info->supportedEekCurve = RpcHardwareInfo::CURVE_25519;
info->uniqueId = "Trusty: My password is ******";
GetHwInfoResponse response = impl_->GetHwInfo();
if (response.error != KM_ERROR_OK) {
return Status(-static_cast<int32_t>(response.error), "Failed to get hardware info.");
}
info->versionNumber = response.version;
info->rpcAuthorName = std::move(response.rpcAuthorName);
info->supportedEekCurve = response.supportedEekCurve;
info->uniqueId = std::move(response.uniqueId);
return ScopedAStatus::ok();
}