keymaster: include date in os_patchlevel
The date field was mysteriously missing
from the originally patchset. Further
attendance has addressed the issue.
Bug: 119549128
Test: attest cert format is as expected
Change-Id: I2a8b055a6ad2b7d6b26fcdd65b9c2140a866d17c
Signed-off-by: nagendra modadugu <ngm@google.com>
diff --git a/hals/keymaster/KeymasterDevice.cpp b/hals/keymaster/KeymasterDevice.cpp
index cb3d6ff..c7e33d3 100644
--- a/hals/keymaster/KeymasterDevice.cpp
+++ b/hals/keymaster/KeymasterDevice.cpp
@@ -97,7 +97,7 @@
return major * 10000 + minor * 100 + subminor;
}
-uint32_t DateCodeToUint32(const std::string& code, bool include_day) {
+uint32_t DateCodeToUint32(const std::string& code) {
// Keep digits only.
std::string filtered_code = DigitsOnly(code);
@@ -105,14 +105,9 @@
uint32_t return_value = 0;
if (filtered_code.size() == 8) {
return_value = std::stoi(filtered_code);
- if (!include_day) {
- return_value /= 100;
- }
} else if (filtered_code.size() == 6) {
return_value = std::stoi(filtered_code);
- if (include_day) {
return_value *= 100;
- }
} else {
LOG(ERROR) << "Unexpected patchset format: \"" << code << "\"";
}
@@ -309,11 +304,9 @@
WaitForPropertyCreation(PROPERTY_VENDOR_PATCHLEVEL))) {}
_os_version = VersionToUint32(GetProperty(PROPERTY_OS_VERSION, ""));
- _os_patchlevel = DateCodeToUint32(GetProperty(PROPERTY_OS_PATCHLEVEL, ""),
- false /* include_day */);
+ _os_patchlevel = DateCodeToUint32(GetProperty(PROPERTY_OS_PATCHLEVEL, ""));
_vendor_patchlevel = DateCodeToUint32(
- GetProperty(PROPERTY_VENDOR_PATCHLEVEL, ""),
- true /* include_day */);
+ GetProperty(PROPERTY_VENDOR_PATCHLEVEL, ""));
SendSystemVersionInfo();
GetBootInfo();