From d889aff463acf825a53ffed6796477bf4d0e33c9 Mon Sep 17 00:00:00 2001 From: Chirag Pathak Date: Tue, 2 Feb 2021 07:35:38 +0000 Subject: [PATCH] Added the deviceLocked and earlyBootEnded implementations to KeyMintDevice in km)compat. This fixes the build errors. Test: n/a Bug: b/179062062 Change-Id: I7458faa917317612536d640f42372489d30d960f --- keystore2/src/km_compat/km_compat.cpp | 23 +++++++++++++++++++++++ keystore2/src/km_compat/km_compat.h | 4 +++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/keystore2/src/km_compat/km_compat.cpp b/keystore2/src/km_compat/km_compat.cpp index 429a038f..dedca6d4 100644 --- a/keystore2/src/km_compat/km_compat.cpp +++ b/keystore2/src/km_compat/km_compat.cpp @@ -500,6 +500,29 @@ ScopedAStatus KeyMintDevice::begin(KeyPurpose in_inPurpose, return convertErrorCode(errorCode); } +ScopedAStatus KeyMintDevice::deviceLocked(bool passwordOnly, + const std::optional& timestampToken) { + V4_0_VerificationToken token; + if (timestampToken.has_value()) { + token = convertTimestampTokenToLegacy(timestampToken.value()); + } + auto ret = mDevice->deviceLocked(passwordOnly, token); + if (!ret.isOk()) { + return convertErrorCode(KMV1::ErrorCode::UNKNOWN_ERROR); + } else { + return convertErrorCode(KMV1::ErrorCode::OK); + } +} + +ScopedAStatus KeyMintDevice::earlyBootEnded() { + auto ret = mDevice->earlyBootEnded(); + if (!ret.isOk()) { + return convertErrorCode(KMV1::ErrorCode::UNKNOWN_ERROR); + } else { + return convertErrorCode(KMV1::ErrorCode::OK); + } +} + ScopedAStatus KeyMintOperation::update(const std::optional& in_inParams, const std::optional>& in_input, const std::optional& in_inAuthToken, diff --git a/keystore2/src/km_compat/km_compat.h b/keystore2/src/km_compat/km_compat.h index 5637b583..7abccdeb 100644 --- a/keystore2/src/km_compat/km_compat.h +++ b/keystore2/src/km_compat/km_compat.h @@ -110,7 +110,9 @@ class KeyMintDevice : public aidl::android::hardware::security::keymint::BnKeyMi const std::vector& in_inParams, const HardwareAuthToken& in_inAuthToken, BeginResult* _aidl_return) override; - + ScopedAStatus deviceLocked(bool passwordOnly, + const std::optional& timestampToken) override; + ScopedAStatus earlyBootEnded() override; // These are public to allow testing code to use them directly. // This class should not be used publicly anyway.