Add GetVersion to GoogleKeymaster implementation.
The GetVersion command will be used by the GoogleKeymaster HAL
implementation to verify that HAL implementation and keymaster
implementation are compatible. Note that the GetVersion API is not
exposed through the HAL, and there's no requirement that other keymaster
implementations provide versioning (it's a good idea, though).
Bug: 18409838
Change-Id: Ia081404991b1f0f75b0e937058363d95c3e4213c
diff --git a/google_keymaster_test.cpp b/google_keymaster_test.cpp
index adc931e..f6ee1d0 100644
--- a/google_keymaster_test.cpp
+++ b/google_keymaster_test.cpp
@@ -1135,5 +1135,16 @@
EXPECT_EQ(0, result.size());
}
+typedef KeymasterTest VersionTest;
+TEST_F(VersionTest, GetVersion) {
+ GetVersionRequest req;
+ GetVersionResponse rsp;
+ device.GetVersion(req, &rsp);
+ EXPECT_EQ(KM_ERROR_OK, rsp.error);
+ EXPECT_EQ(1, rsp.major_ver);
+ EXPECT_EQ(0, rsp.minor_ver);
+ EXPECT_EQ(0, rsp.subminor_ver);
+}
+
} // namespace test
} // namespace keymaster