aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornagendra modadugu <ngm@google.com>2019-02-07 23:18:44 -0800
committernagendra modadugu <ngm@google.com>2019-02-07 23:22:23 -0800
commit7b1e22985ded6a0767fed36d884dd350f11e8b91 (patch)
tree441ff8eaec7b9a578b5a95e66185eb75527709df
parent5eb6baddb394ae11a5947867058be2923497babd (diff)
downloadandroid-7b1e22985ded6a0767fed36d884dd350f11e8b91.tar.gz
Revert "keymaster: include date in os_patchlevel"
Turns out that the bug was in nugget, with firmware using SYSTEM_PATCH_LEVEL in place of BOOT_PATCH_LEVEL. This reverts commit 5eb6baddb394ae11a5947867058be2923497babd. The original commit message is below. 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 & VTS pass Change-Id: I99da4db36489d356c897c3d77223b9bf174dee29 Signed-off-by: nagendra modadugu <ngm@google.com>
-rw-r--r--hals/keymaster/KeymasterDevice.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/hals/keymaster/KeymasterDevice.cpp b/hals/keymaster/KeymasterDevice.cpp
index c7e33d3..cb3d6ff 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) {
+uint32_t DateCodeToUint32(const std::string& code, bool include_day) {
// Keep digits only.
std::string filtered_code = DigitsOnly(code);
@@ -105,9 +105,14 @@ uint32_t DateCodeToUint32(const std::string& code) {
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 << "\"";
}
@@ -304,9 +309,11 @@ KeymasterDevice::KeymasterDevice(KeymasterClient& keymaster) :
WaitForPropertyCreation(PROPERTY_VENDOR_PATCHLEVEL))) {}
_os_version = VersionToUint32(GetProperty(PROPERTY_OS_VERSION, ""));
- _os_patchlevel = DateCodeToUint32(GetProperty(PROPERTY_OS_PATCHLEVEL, ""));
+ _os_patchlevel = DateCodeToUint32(GetProperty(PROPERTY_OS_PATCHLEVEL, ""),
+ false /* include_day */);
_vendor_patchlevel = DateCodeToUint32(
- GetProperty(PROPERTY_VENDOR_PATCHLEVEL, ""));
+ GetProperty(PROPERTY_VENDOR_PATCHLEVEL, ""),
+ true /* include_day */);
SendSystemVersionInfo();
GetBootInfo();