Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit d02d02b7 authored by Ricardo Cerqueira's avatar Ricardo Cerqueira Committed by Michael Bestas
Browse files

Store the base64 release key in the OTA zips

This can be directly grepped in pre-existing package.xml tables
to make sure we're not trying to update to a differently signed
build

Change-Id: I7528a8e7c484ea9209cd665b9263328ae834586a
parent 66ce73d1
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -1921,6 +1921,11 @@ endif
ifdef BOARD_PREBUILT_VENDORIMAGE
	$(hide) mkdir -p $(zip_root)/IMAGES
	$(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
endif
ifdef PRODUCT_DEFAULT_DEV_CERTIFICATE
	$(hide) vendor/cm/build/tools/getb64key.py $(PRODUCT_DEFAULT_DEV_CERTIFICATE).x509.pem > $(zip_root)/META/releasekey.txt
else
	$(hide) vendor/cm/build/tools/getb64key.py $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem > $(zip_root)/META/releasekey.txt
endif
	@# Zip everything up, preserving symlinks and placing META/ files first to
	@# help early validation of the .zip file while uploading it.
+2 −0
Original line number Diff line number Diff line
@@ -756,6 +756,8 @@ endif;
  metadata["ota-required-cache"] = str(script.required_cache)
  WriteMetadata(metadata, output_zip)

  common.ZipWriteStr(output_zip, "META-INF/org/cyanogenmod/releasekey",
                     ""+input_zip.read("META/releasekey.txt"))

def WritePolicyConfig(file_name, output_zip):
  common.ZipWrite(output_zip, file_name, os.path.basename(file_name))
+8 −0
Original line number Diff line number Diff line
@@ -488,6 +488,14 @@ def ReplaceOtaKeys(input_tf_zip, output_tf_zip, misc_info):
    recovery_keys_location = "RECOVERY/RAMDISK/res/keys"
  common.ZipWriteStr(output_tf_zip, recovery_keys_location, new_recovery_keys)

  # Save the base64 key representation in the update for key-change
  # validations
  p = common.Run(["python", "vendor/cm/build/tools/getb64key.py",
                 mapped_keys[0]], stdout=subprocess.PIPE)
  data, _ = p.communicate()
  if p.returncode == 0:
    common.ZipWriteStr(output_tf_zip, "META/releasekey.txt", data)

  # SystemUpdateActivity uses the x509.pem version of the keys, but
  # put into a zipfile system/etc/security/otacerts.zip.
  # We DO NOT include the extra_recovery_keys (if any) here.