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).
This change also enables message versioning support.
Bug: 18409838
Change-Id: Ia22791356db3453deab4c21f06a16a08fac32d0e
diff --git a/google_keymaster_test.cpp b/google_keymaster_test.cpp
index 9924a56..a124126 100644
--- a/google_keymaster_test.cpp
+++ b/google_keymaster_test.cpp
@@ -1078,5 +1078,16 @@
ASSERT_EQ(KM_ERROR_IMPORT_PARAMETER_MISMATCH, import_response.error);
}
+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