update_engine: Fix TPM variable name max_kernel_rollfoward
- In a previous CL I named the variable incorrectly
BUG=chromium:814090
TEST=FEATURES=test emerge-samus update_engine
Change-Id: I17cbc85d42ba03040bfdae436cedd0238698b47e
Reviewed-on: https://chromium-review.googlesource.com/1059944
Commit-Ready: Zentaro Kavanagh <zentaro@chromium.org>
Tested-by: Zentaro Kavanagh <zentaro@chromium.org>
Reviewed-by: Amin Hassani <ahassani@chromium.org>
diff --git a/common/fake_hardware.h b/common/fake_hardware.h
index 68fdd5b..d699fb7 100644
--- a/common/fake_hardware.h
+++ b/common/fake_hardware.h
@@ -40,7 +40,7 @@
// Default value for crossystem tpm_fwver.
static const int kMinFirmwareKeyVersion = 13;
- // Default value for crossystem max_kernel_rollforward. This value is the
+ // Default value for crossystem kernel_max_rollforward. This value is the
// default for consumer devices and effectively means "unlimited rollforward
// is allowed", which is the same as the behavior prior to implementing
// roll forward prevention.
@@ -79,8 +79,8 @@
return min_firmware_key_version_;
}
- bool SetMaxKernelKeyRollforward(int max_kernel_rollforward) override {
- max_kernel_rollforward_ = max_kernel_rollforward;
+ bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override {
+ kernel_max_rollforward_ = kernel_max_rollforward;
return true;
}
@@ -167,7 +167,7 @@
}
// Getters to verify state.
- int GetMaxKernelKeyRollforward() const { return max_kernel_rollforward_; }
+ int GetMaxKernelKeyRollforward() const { return kernel_max_rollforward_; }
private:
bool is_official_build_{true};
@@ -182,7 +182,7 @@
std::string ec_version_{"Fake EC v1.0a"};
int min_kernel_key_version_{kMinKernelKeyVersion};
int min_firmware_key_version_{kMinFirmwareKeyVersion};
- int max_kernel_rollforward_{kMaxKernelRollforward};
+ int kernel_max_rollforward_{kMaxKernelRollforward};
int powerwash_count_{kPowerwashCountNotSet};
bool powerwash_scheduled_{false};
bool first_active_omaha_ping_sent_{false};
diff --git a/common/hardware_interface.h b/common/hardware_interface.h
index 4946b91..4d7c162 100644
--- a/common/hardware_interface.h
+++ b/common/hardware_interface.h
@@ -79,9 +79,9 @@
virtual int GetMinFirmwareKeyVersion() const = 0;
// Sets the maximum kernel key version that verified boot should roll
- // forward to. This is the value of crossystem max_kernel_rollforward.
+ // forward to. This is the value of crossystem kernel_max_rollforward.
// Returns false if the value cannot be set, or if not running on Chrome OS.
- virtual bool SetMaxKernelKeyRollforward(int max_kernel_rollforward) = 0;
+ virtual bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) = 0;
// Returns the powerwash_count from the stateful. If the file is not found
// or is invalid, returns -1. Brand new machines out of the factory or after
diff --git a/common/mock_hardware.h b/common/mock_hardware.h
index fcbb0d5..662ccd9 100644
--- a/common/mock_hardware.h
+++ b/common/mock_hardware.h
@@ -93,7 +93,7 @@
MOCK_CONST_METHOD0(GetMinKernelKeyVersion, int());
MOCK_CONST_METHOD0(GetMinFirmwareKeyVersion, int());
MOCK_CONST_METHOD1(SetMaxKernelKeyRollforward,
- bool(int max_kernel_rollforward));
+ bool(int kernel_max_rollforward));
MOCK_CONST_METHOD0(GetPowerwashCount, int());
MOCK_CONST_METHOD1(GetNonVolatileDirectory, bool(base::FilePath*));
MOCK_CONST_METHOD1(GetPowerwashSafeDirectory, bool(base::FilePath*));
diff --git a/hardware_android.cc b/hardware_android.cc
index 6812c71..7958fbf 100644
--- a/hardware_android.cc
+++ b/hardware_android.cc
@@ -175,8 +175,8 @@
return -1;
}
-bool HardwareAndroid::SetMaxKernelKeyRollforward(int max_kernel_rollforward) {
- LOG(WARNING) << "STUB: Setting max_kernel_rollforward is not supported.";
+bool HardwareAndroid::SetMaxKernelKeyRollforward(int kernel_max_rollforward) {
+ LOG(WARNING) << "STUB: Setting kernel_max_rollforward is not supported.";
return false;
}
diff --git a/hardware_android.h b/hardware_android.h
index 4d354ac..a6c9f6a 100644
--- a/hardware_android.h
+++ b/hardware_android.h
@@ -44,7 +44,7 @@
std::string GetECVersion() const override;
int GetMinKernelKeyVersion() const override;
int GetMinFirmwareKeyVersion() const override;
- bool SetMaxKernelKeyRollforward(int max_kernel_rollforward) override;
+ bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
int GetPowerwashCount() const override;
bool SchedulePowerwash() override;
bool CancelPowerwash() override;
diff --git a/hardware_chromeos.cc b/hardware_chromeos.cc
index 3099151..c0f2b67 100644
--- a/hardware_chromeos.cc
+++ b/hardware_chromeos.cc
@@ -190,9 +190,9 @@
return VbGetSystemPropertyInt("tpm_fwver");
}
-bool HardwareChromeOS::SetMaxKernelKeyRollforward(int max_kernel_rollforward) {
- return VbSetSystemPropertyInt("max_kernel_rollforward",
- max_kernel_rollforward) == 0;
+bool HardwareChromeOS::SetMaxKernelKeyRollforward(int kernel_max_rollforward) {
+ return VbSetSystemPropertyInt("kernel_max_rollforward",
+ kernel_max_rollforward) == 0;
}
int HardwareChromeOS::GetPowerwashCount() const {
diff --git a/hardware_chromeos.h b/hardware_chromeos.h
index 9cb02f8..8e9ad1e 100644
--- a/hardware_chromeos.h
+++ b/hardware_chromeos.h
@@ -49,7 +49,7 @@
std::string GetECVersion() const override;
int GetMinKernelKeyVersion() const override;
int GetMinFirmwareKeyVersion() const override;
- bool SetMaxKernelKeyRollforward(int max_kernel_rollforward) override;
+ bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override;
int GetPowerwashCount() const override;
bool SchedulePowerwash() override;
bool CancelPowerwash() override;
diff --git a/omaha_request_action.cc b/omaha_request_action.cc
index 13a58fb..c18f38f 100644
--- a/omaha_request_action.cc
+++ b/omaha_request_action.cc
@@ -1867,7 +1867,7 @@
// sliding window of versions that can be rolled back to.
int min_kernel_version =
system_state_->hardware()->GetMinKernelKeyVersion();
- LOG(INFO) << "Rollback is enabled. Setting max_kernel_rollforward to "
+ LOG(INFO) << "Rollback is enabled. Setting kernel_max_rollforward to "
<< min_kernel_version;
max_rollforward_set = system_state_->hardware()->SetMaxKernelKeyRollforward(
min_kernel_version);
@@ -1876,14 +1876,14 @@
// max kernel key version is set to 0xfffffffe, which is logically
// infinity. This maintains the previous behavior that that kernel key
// versions roll forward each time they are incremented.
- LOG(INFO) << "Rollback is disabled. Setting max_kernel_rollforward to "
+ LOG(INFO) << "Rollback is disabled. Setting kernel_max_rollforward to "
<< kRollforwardInfinity;
max_rollforward_set = system_state_->hardware()->SetMaxKernelKeyRollforward(
kRollforwardInfinity);
}
if (!max_rollforward_set) {
- LOG(ERROR) << "Failed to set max_kernel_rollforward";
+ LOG(ERROR) << "Failed to set kernel_max_rollforward";
}
}
diff --git a/omaha_request_action_unittest.cc b/omaha_request_action_unittest.cc
index a70712a..2ad3eec 100644
--- a/omaha_request_action_unittest.cc
+++ b/omaha_request_action_unittest.cc
@@ -2801,7 +2801,7 @@
3 /* rollback_allowed_milestones */,
false /* is_policy_loaded */);
- // Verify max_kernel_rollforward was set to the current minimum
+ // Verify kernel_max_rollforward was set to the current minimum
// kernel key version. This has the effect of freezing roll
// forwards indefinitely. This will hold the rollback window
// open until a future change will be able to move this forward
@@ -2828,7 +2828,7 @@
3 /* rollback_allowed_milestones */,
false /* is_policy_loaded */);
- // Verify that with rollback disabled that max_kernel_rollforward
+ // Verify that with rollback disabled that kernel_max_rollforward
// was set to logical infinity. This is the expected behavior for
// consumer devices and matches the existing behavior prior to the
// rollback features.
@@ -2836,7 +2836,7 @@
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());
}
-// Verifies that a device with rollback enabled sets max_kernel_rollforward
+// Verifies that a device with rollback enabled sets kernel_max_rollforward
// in the TPM to prevent roll forward.
TEST_F(OmahaRequestActionTest, RollbackEnabledDevicesSetMaxRollback) {
FakeHardware* fake_hw = fake_system_state_.fake_hardware();
@@ -2854,7 +2854,7 @@
allowed_milestones,
true /* is_policy_loaded */);
- // Verify that with rollback enabled that max_kernel_rollforward
+ // Verify that with rollback enabled that kernel_max_rollforward
// was set to the current minimum kernel key version. This has
// the effect of freezing roll forwards indefinitely. This will
// hold the rollback window open until a future change will
@@ -2863,7 +2863,7 @@
EXPECT_EQ(min_kernel_version, fake_hw->GetMaxKernelKeyRollforward());
}
-// Verifies that a device with rollback disabled sets max_kernel_rollforward
+// Verifies that a device with rollback disabled sets kernel_max_rollforward
// in the TPM to logical infinity, to allow roll forward.
TEST_F(OmahaRequestActionTest, RollbackDisabledDevicesSetMaxRollback) {
FakeHardware* fake_hw = fake_system_state_.fake_hardware();
@@ -2881,7 +2881,7 @@
allowed_milestones,
true /* is_policy_loaded */);
- // Verify that with rollback disabled that max_kernel_rollforward
+ // Verify that with rollback disabled that kernel_max_rollforward
// was set to logical infinity.
EXPECT_EQ(min_kernel_version, fake_hw->GetMinKernelKeyVersion());
EXPECT_EQ(kRollforwardInfinity, fake_hw->GetMaxKernelKeyRollforward());