Implementation for supporting earlyBootEnded, deviceLocked and supporting timestampRequired flag in HardwareInfo.
Test: atest VtsAidlKeyMintTargetTest
Bug: b/173425868, 178222844, 179062062.
Change-Id: I4d158e3beaecf6de4dc23421848cb472ce532396
diff --git a/ng/AndroidKeyMintDevice.cpp b/ng/AndroidKeyMintDevice.cpp
index 690abf2..52cad22 100644
--- a/ng/AndroidKeyMintDevice.cpp
+++ b/ng/AndroidKeyMintDevice.cpp
@@ -32,6 +32,7 @@
using namespace ::keymaster;
using namespace km_utils;
+using secureclock::TimeStampToken;
namespace {
@@ -195,7 +196,7 @@
info->securityLevel = securityLevel_;
info->keyMintName = "FakeKeyMintDevice";
info->keyMintAuthorName = "Google";
-
+ info->timestampTokenRequired = false;
return ScopedAStatus::ok();
}
@@ -365,6 +366,26 @@
return ScopedAStatus::ok();
}
+ScopedAStatus AndroidKeyMintDevice::deviceLocked(
+ bool in_passwordOnly,
+ const std::optional<::aidl::android::hardware::security::secureclock::TimeStampToken>&
+ in_timestampToken) {
+ DeviceLockedRequest request(impl_->message_version());
+ request.passwordOnly = in_passwordOnly;
+ if (in_timestampToken.has_value()) {
+ request.token.challenge = in_timestampToken->challenge;
+ request.token.mac = {in_timestampToken->mac.data(), in_timestampToken->mac.size()};
+ request.token.timestamp = in_timestampToken->timestamp.milliSeconds;
+ }
+ DeviceLockedResponse response = impl_->DeviceLocked(request);
+ return kmError2ScopedAStatus(response.error);
+}
+
+ScopedAStatus AndroidKeyMintDevice::earlyBootEnded() {
+ EarlyBootEndedResponse response = impl_->EarlyBootEnded();
+ return kmError2ScopedAStatus(response.error);
+}
+
IKeyMintDevice* CreateKeyMintDevice(SecurityLevel securityLevel) {
return ::new AndroidKeyMintDevice(securityLevel);