update_engine: Add hardware support for firmware_max_rollforward

- Adds the methods to get and set firmware_max_rollforward
- This is for supporting the rollback feature
- A future CL will set these values based on policy

BUG=chromium:840432
TEST=unittests

Change-Id: I560f4cef9595d4a52d011fcfeb7b2675a096aefa
Reviewed-on: https://chromium-review.googlesource.com/1062766
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 d68b0f8..55dcc2c 100644
--- a/common/fake_hardware.h
+++ b/common/fake_hardware.h
@@ -44,7 +44,13 @@
   // default for consumer devices and effectively means "unlimited rollforward
   // is allowed", which is the same as the behavior prior to implementing
   // roll forward prevention.
-  static const int kMaxKernelRollforward = 0xfffffffe;
+  static const int kKernelMaxRollforward = 0xfffffffe;
+
+  // Default value for crossystem firmware_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.
+  static const int kFirmwareMaxRollforward = 0xfffffffe;
 
   FakeHardware() = default;
 
@@ -79,6 +85,18 @@
     return min_firmware_key_version_;
   }
 
+  int GetMaxFirmwareKeyRollforward() const override {
+    return firmware_max_rollforward_;
+  }
+
+  bool SetMaxFirmwareKeyRollforward(int firmware_max_rollforward) override {
+    if (GetMaxFirmwareKeyRollforward() == -1)
+      return false;
+
+    firmware_max_rollforward_ = firmware_max_rollforward;
+    return true;
+  }
+
   bool SetMaxKernelKeyRollforward(int kernel_max_rollforward) override {
     kernel_max_rollforward_ = kernel_max_rollforward;
     return true;
@@ -183,7 +201,8 @@
   std::string ec_version_{"Fake EC v1.0a"};
   int min_kernel_key_version_{kMinKernelKeyVersion};
   int min_firmware_key_version_{kMinFirmwareKeyVersion};
-  int kernel_max_rollforward_{kMaxKernelRollforward};
+  int kernel_max_rollforward_{kKernelMaxRollforward};
+  int firmware_max_rollforward_{kFirmwareMaxRollforward};
   int powerwash_count_{kPowerwashCountNotSet};
   bool powerwash_scheduled_{false};
   bool first_active_omaha_ping_sent_{false};