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/AndroidKeyMintDevice.cpp b/ng/AndroidKeyMintDevice.cpp
index f511c3f..4cbf1d7 100644
--- a/ng/AndroidKeyMintDevice.cpp
+++ b/ng/AndroidKeyMintDevice.cpp
@@ -219,6 +219,12 @@
                   KmVersion::KEYMINT_1, static_cast<keymaster_security_level_t>(securityLevel));
               context->SetSystemVersion(::keymaster::GetOsVersion(),
                                         ::keymaster::GetOsPatchlevel());
+              context->SetVendorPatchlevel(::keymaster::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)),