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

Commit 7e25d3e8 authored by Treehugger Robot's avatar Treehugger Robot Committed by Gerrit Code Review
Browse files

Merge "Implement GetRootOfTrust"

parents f3e2a9d5 396bc3f9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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
+1 −0
Original line number Diff line number Diff line
@@ -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_; }

+1 −0
Original line number Diff line number Diff line
@@ -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),
+14 −3
Original line number Diff line number Diff line
@@ -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 */) {