From 0f89bc1270dc08ebdeea2c4ce5456d8a5e0c34c5 Mon Sep 17 00:00:00 2001 From: Shawn Willden Date: Thu, 17 Feb 2022 15:49:27 -0700 Subject: [PATCH] Provide alternate SE RoT provisioning path. On some devices it is infeasible to provision the KeyMint RoT bits in the Android Bootloader. This provides an alternate path to provision them from the TEE during early boot. Bug: 219076736 Test: VtsAidlKeyMintTargetTest Change-Id: Ibae9050b9a102dad3710f9495d3dfa43fa1d1b3f Merged-In: Ibae9050b9a102dad3710f9495d3dfa43fa1d1b3f --- .../trusty_keymaster/TrustyKeyMintDevice.h | 10 ++++++++-- trusty/keymaster/keymint/TrustyKeyMintDevice.cpp | 15 ++++++++++++++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/trusty/keymaster/include/trusty_keymaster/TrustyKeyMintDevice.h b/trusty/keymaster/include/trusty_keymaster/TrustyKeyMintDevice.h index 5fd628f3c..c8d8932c4 100644 --- a/trusty/keymaster/include/trusty_keymaster/TrustyKeyMintDevice.h +++ b/trusty/keymaster/include/trusty_keymaster/TrustyKeyMintDevice.h @@ -27,6 +27,7 @@ namespace aidl::android::hardware::security::keymint::trusty { using ::keymaster::TrustyKeymaster; using ::ndk::ScopedAStatus; using secureclock::TimeStampToken; +using ::std::array; using ::std::optional; using ::std::shared_ptr; using ::std::vector; @@ -77,8 +78,13 @@ class TrustyKeyMintDevice : public BnKeyMintDevice { const optional& timestampToken) override; ScopedAStatus earlyBootEnded() override; - ScopedAStatus convertStorageKeyToEphemeral(const std::vector& storageKeyBlob, - std::vector* ephemeralKeyBlob) override; + ScopedAStatus convertStorageKeyToEphemeral(const vector& storageKeyBlob, + vector* ephemeralKeyBlob) override; + + ScopedAStatus getRootOfTrustChallenge(array* challenge) override; + ScopedAStatus getRootOfTrust(const array& challenge, + vector* rootOfTrust) override; + ScopedAStatus sendRootOfTrust(const vector& rootOfTrust) override; protected: std::shared_ptr impl_; diff --git a/trusty/keymaster/keymint/TrustyKeyMintDevice.cpp b/trusty/keymaster/keymint/TrustyKeyMintDevice.cpp index 68a791259..44780e835 100644 --- a/trusty/keymaster/keymint/TrustyKeyMintDevice.cpp +++ b/trusty/keymaster/keymint/TrustyKeyMintDevice.cpp @@ -306,7 +306,7 @@ ScopedAStatus TrustyKeyMintDevice::earlyBootEnded() { } ScopedAStatus TrustyKeyMintDevice::convertStorageKeyToEphemeral( - const std::vector& storageKeyBlob, std::vector* ephemeralKeyBlob) { + const vector& storageKeyBlob, vector* ephemeralKeyBlob) { keymaster::ExportKeyRequest request(impl_->message_version()); request.SetKeyMaterial(storageKeyBlob.data(), storageKeyBlob.size()); request.key_format = KM_KEY_FORMAT_RAW; @@ -321,4 +321,17 @@ ScopedAStatus TrustyKeyMintDevice::convertStorageKeyToEphemeral( return ScopedAStatus::ok(); } +ScopedAStatus TrustyKeyMintDevice::getRootOfTrustChallenge(array* /* challenge */) { + return kmError2ScopedAStatus(KM_ERROR_UNIMPLEMENTED); +} + +ScopedAStatus TrustyKeyMintDevice::getRootOfTrust(const array& /* challenge */, + vector* /* rootOfTrust */) { + return kmError2ScopedAStatus(KM_ERROR_UNIMPLEMENTED); +} + +ScopedAStatus TrustyKeyMintDevice::sendRootOfTrust(const vector& /* rootOfTrust */) { + return kmError2ScopedAStatus(KM_ERROR_UNIMPLEMENTED); +} + } // namespace aidl::android::hardware::security::keymint::trusty