Merge "Implement GetRootOfTrust"

This commit is contained in:
Treehugger Robot 2022-06-07 22:43:20 +00:00 committed by Gerrit Code Review
commit 7e25d3e8fa
4 changed files with 22 additions and 3 deletions

View file

@ -279,4 +279,10 @@ ConfigureVendorPatchlevelResponse TrustyKeymaster::ConfigureVendorPatchlevel(
return response;
}
GetRootOfTrustResponse TrustyKeymaster::GetRootOfTrust(const GetRootOfTrustRequest& request) {
GetRootOfTrustResponse response(message_version());
ForwardCommand(KM_GET_ROOT_OF_TRUST, request, &response);
return response;
}
} // namespace keymaster

View file

@ -66,6 +66,7 @@ class TrustyKeymaster {
DeviceLockedResponse DeviceLocked(const DeviceLockedRequest& request);
ConfigureVendorPatchlevelResponse ConfigureVendorPatchlevel(
const ConfigureVendorPatchlevelRequest& request);
GetRootOfTrustResponse GetRootOfTrust(const GetRootOfTrustRequest& request);
uint32_t message_version() const { return message_version_; }

View file

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

View file

@ -325,9 +325,20 @@ ScopedAStatus TrustyKeyMintDevice::getRootOfTrustChallenge(array<uint8_t, 16>* /
return kmError2ScopedAStatus(KM_ERROR_UNIMPLEMENTED);
}
ScopedAStatus TrustyKeyMintDevice::getRootOfTrust(const array<uint8_t, 16>& /* challenge */,
vector<uint8_t>* /* rootOfTrust */) {
return kmError2ScopedAStatus(KM_ERROR_UNIMPLEMENTED);
ScopedAStatus TrustyKeyMintDevice::getRootOfTrust(const array<uint8_t, 16>& challenge,
vector<uint8_t>* rootOfTrust) {
if (!rootOfTrust) {
return kmError2ScopedAStatus(KM_ERROR_UNEXPECTED_NULL_POINTER);
}
keymaster::GetRootOfTrustRequest request(impl_->message_version(),
{challenge.begin(), challenge.end()});
keymaster::GetRootOfTrustResponse response = impl_->GetRootOfTrust(request);
if (response.error != KM_ERROR_OK) {
return kmError2ScopedAStatus(response.error);
}
*rootOfTrust = std::move(response.rootOfTrust);
return ScopedAStatus::ok();
}
ScopedAStatus TrustyKeyMintDevice::sendRootOfTrust(const vector<uint8_t>& /* rootOfTrust */) {