Keymaster 4.1 VTS tests
Test: VtsHalKeymasterV4_1TargetTest
Change-Id: I488402079ebb3940e021ac1558aeee15c4b133c9
diff --git a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
index 2d2ba63..d0ad433 100644
--- a/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
+++ b/keymaster/4.0/vts/functional/KeymasterHidlTest.cpp
@@ -44,11 +44,9 @@
using namespace std::literals::chrono_literals;
-void KeymasterHidlTest::InitializeKeymaster() {
- std::string instance_name = GetParam();
- keymaster_ = IKeymasterDevice::getService(GetParam());
- ASSERT_NE(keymaster_, nullptr);
-
+void KeymasterHidlTest::InitializeKeymaster(sp<IKeymasterDevice> keymaster) {
+ ASSERT_NE(keymaster, nullptr);
+ keymaster_ = keymaster;
ASSERT_TRUE(keymaster_
->getHardwareInfo([&](SecurityLevel securityLevel, const hidl_string& name,
const hidl_string& author) {
@@ -57,15 +55,15 @@
author_ = author;
})
.isOk());
-}
-
-void KeymasterHidlTest::SetUp() {
- InitializeKeymaster();
os_version_ = support::getOsVersion();
os_patch_level_ = support::getOsPatchlevel();
}
+void KeymasterHidlTest::SetUp() {
+ InitializeKeymaster(IKeymasterDevice::getService(GetParam()));
+}
+
ErrorCode KeymasterHidlTest::GenerateKey(const AuthorizationSet& key_desc, HidlBuf* key_blob,
KeyCharacteristics* key_characteristics) {
EXPECT_NE(key_blob, nullptr) << "Key blob pointer must not be null. Test bug";