aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2019-02-06 10:36:29 -0800
committernagendra modadugu <ngm@google.com>2019-03-25 21:49:40 -0700
commite511a9c6e5faad152754e7dbe21d5859d124004f (patch)
treecd45940b345a8b4a7d728f0471555769f7ea6ea4
parentf29bb53671e5aa9f88f84cd38dc1d2fd6e390c80 (diff)
downloadandroid-e511a9c6e5faad152754e7dbe21d5859d124004f.tar.gz
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> (cherry picked from commit 5eb6baddb394ae11a5947867058be2923497babd)
-rw-r--r--hals/keymaster/KeymasterDevice.cpp13
1 files changed, 3 insertions, 10 deletions
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 @@ uint32_t VersionToUint32(const std::string& version) {
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 DateCodeToUint32(const std::string& code, bool include_day) {
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 @@ KeymasterDevice::KeymasterDevice(KeymasterClient& keymaster) :
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();