KM default implementations: Add vendor and boot pachlevels.
Default (software) implementations need to return vendor and boot patch
levels. This CL sets this information. Since software imiplementations
have no means of getting information from the bootloader, the os
patchlevel is used in its place.
Bug: 189973657
Test: keystore2_km_compat_test
Change-Id: I4f60caabf6459ecd9bdc15ed3aabd9f91a04b197
diff --git a/ng/AndroidKeymaster3Device.cpp b/ng/AndroidKeymaster3Device.cpp
index 4539cc2..88cbea7 100644
--- a/ng/AndroidKeymaster3Device.cpp
+++ b/ng/AndroidKeymaster3Device.cpp
@@ -224,6 +224,12 @@
[]() -> auto {
auto context = new PureSoftKeymasterContext(KmVersion::KEYMASTER_3);
context->SetSystemVersion(GetOsVersion(), GetOsPatchlevel());
+ context->SetVendorPatchlevel(GetVendorPatchlevel());
+ // Software devices cannot be configured by the boot loader but they have
+ // to return a boot patch level. So lets just return the OS patch level.
+ // The OS patch level only has a year and a month so we just add the 1st
+ // of the month as day field.
+ context->SetBootPatchlevel(GetOsPatchlevel() * 100 + 1);
return context;
}(),
kOperationTableSize)),