update_engine: Merge remote-tracking branch 'cros/upstream' into cros/master

Done with:
git merge cros/upstream --commit -s recursive

- Added EC key support and its unittests.
- Resolved a conlict on error codes. Since Android versions are not
  uploading any UMA metrics, I gave the priority to the Android version
  Since they can't be changed.
- Changed the openssl functions to get1 version (from get0) version
  because of a current issue with gale. Once the issue is resolved we
  need to change them back.
- Some remaining styling issues fixed by clang-format

BUG=b:163153182
TEST=CQ passes
TEST=unittests

Change-Id: Ib95034422b92433ce26e28336bc4806b34910d38
diff --git a/BUILD.gn b/BUILD.gn
index 43bc787..59aa004 100644
--- a/BUILD.gn
+++ b/BUILD.gn
@@ -44,6 +44,7 @@
       ":test_subprocess",
       ":update_engine-test_images",
       ":update_engine-testkeys",
+      ":update_engine-testkeys-ec",
       ":update_engine_test_libs",
       ":update_engine_unittests",
     ]
@@ -135,6 +136,7 @@
     "common/clock.cc",
     "common/constants.cc",
     "common/cpu_limiter.cc",
+    "common/dynamic_partition_control_stub.cc",
     "common/error_code_utils.cc",
     "common/hash_calculator.cc",
     "common/http_common.cc",
@@ -149,6 +151,7 @@
     "common/utils.cc",
     "payload_consumer/bzip_extent_writer.cc",
     "payload_consumer/cached_file_descriptor.cc",
+    "payload_consumer/certificate_parser_stub.cc",
     "payload_consumer/delta_performer.cc",
     "payload_consumer/download_action.cc",
     "payload_consumer/extent_reader.cc",
@@ -159,6 +162,7 @@
     "payload_consumer/filesystem_verifier_action.cc",
     "payload_consumer/install_plan.cc",
     "payload_consumer/mount_history.cc",
+    "payload_consumer/partition_update_generator_stub.cc",
     "payload_consumer/payload_constants.cc",
     "payload_consumer/payload_metadata.cc",
     "payload_consumer/payload_verifier.cc",
@@ -202,6 +206,7 @@
     "hardware_chromeos.cc",
     "image_properties_chromeos.cc",
     "libcurl_http_fetcher.cc",
+    "logging.cc",
     "metrics_reporter_omaha.cc",
     "metrics_utils.cc",
     "omaha_request_action.cc",
@@ -335,7 +340,7 @@
     "payload_generator/annotated_operation.cc",
     "payload_generator/blob_file_writer.cc",
     "payload_generator/block_mapping.cc",
-    "payload_generator/boot_img_filesystem.cc",
+    "payload_generator/boot_img_filesystem_stub.cc",
     "payload_generator/bzip.cc",
     "payload_generator/deflate_utils.cc",
     "payload_generator/delta_diff_generator.cc",
@@ -345,6 +350,7 @@
     "payload_generator/extent_utils.cc",
     "payload_generator/full_update_generator.cc",
     "payload_generator/mapfile_filesystem.cc",
+    "payload_generator/merge_sequence_generator.cc",
     "payload_generator/payload_file.cc",
     "payload_generator/payload_generation_config.cc",
     "payload_generator/payload_generation_config_chromeos.cc",
@@ -414,10 +420,20 @@
     openssl_pem_out_dir = "include/update_engine"
     sources = [
       "unittest_key.pem",
+      "unittest_key_RSA4096.pem",
       "unittest_key2.pem",
     ]
   }
 
+  genopenssl_key("update_engine-testkeys-ec") {
+    openssl_pem_in_dir = "."
+    openssl_pem_out_dir = "include/update_engine"
+    openssl_pem_algorithm = "ec"
+    sources = [
+      "unittest_key_EC.pem",
+    ]
+  }
+
   # Unpacks sample images used for testing.
   tar_bunzip2("update_engine-test_images") {
     image_out_dir = "."
@@ -496,7 +512,6 @@
       "payload_generator/ab_generator_unittest.cc",
       "payload_generator/blob_file_writer_unittest.cc",
       "payload_generator/block_mapping_unittest.cc",
-      "payload_generator/boot_img_filesystem_unittest.cc",
       "payload_generator/deflate_utils_unittest.cc",
       "payload_generator/delta_diff_utils_unittest.cc",
       "payload_generator/ext2_filesystem_unittest.cc",
@@ -504,6 +519,7 @@
       "payload_generator/extent_utils_unittest.cc",
       "payload_generator/full_update_generator_unittest.cc",
       "payload_generator/mapfile_filesystem_unittest.cc",
+      "payload_generator/merge_sequence_generator_unittest.cc",
       "payload_generator/payload_file_unittest.cc",
       "payload_generator/payload_generation_config_unittest.cc",
       "payload_generator/payload_properties_unittest.cc",