Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ad4ecd96 authored by Tri Vo's avatar Tri Vo Committed by Gerrit Code Review
Browse files

Merge "Implement getHardwareInfo() in Trusty KM TA"

parents ef8ea8f9 025b7f3c
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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_; }

+1 −0
Original line number Diff line number Diff line
@@ -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),
+11 −4
Original line number Diff line number Diff line
@@ -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();
}