2021-10-16 14:05:45 -04:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2021-03-29 17:09:12 -04:00
|
|
|
From: Tad <tad@spotco.us>
|
2021-04-06 05:06:15 -04:00
|
|
|
Date: Tue, 6 Apr 2021 05:04:32 -0400
|
2021-04-05 22:57:59 -04:00
|
|
|
Subject: [PATCH] Allow setting OTA public keys from environment variable
|
2021-03-29 17:09:12 -04:00
|
|
|
|
2021-04-06 05:06:15 -04:00
|
|
|
Change-Id: Ib2a00de63b0c7a8790640462d13a84daf2076fa7
|
2021-03-29 17:09:12 -04:00
|
|
|
---
|
2021-04-06 05:06:15 -04:00
|
|
|
core/product_config.mk | 5 +++++
|
2022-05-12 10:12:31 -04:00
|
|
|
target/product/security/Android.mk | 22 ++++++++++++++++++----
|
|
|
|
2 files changed, 23 insertions(+), 4 deletions(-)
|
2021-03-29 17:09:12 -04:00
|
|
|
|
|
|
|
diff --git a/core/product_config.mk b/core/product_config.mk
|
2021-10-16 14:05:45 -04:00
|
|
|
index a16af05cf4..4849d50093 100644
|
2021-03-29 17:09:12 -04:00
|
|
|
--- a/core/product_config.mk
|
|
|
|
+++ b/core/product_config.mk
|
2021-04-05 22:57:59 -04:00
|
|
|
@@ -283,6 +283,11 @@ ENFORCE_SYSTEM_CERTIFICATE_ALLOW_LIST := $(PRODUCT_ARTIFACT_SYSTEM_CERTIFICATE_R
|
|
|
|
PRODUCT_OTA_PUBLIC_KEYS := $(sort $(PRODUCT_OTA_PUBLIC_KEYS))
|
|
|
|
PRODUCT_EXTRA_RECOVERY_KEYS := $(sort $(PRODUCT_EXTRA_RECOVERY_KEYS))
|
2021-03-29 17:09:12 -04:00
|
|
|
|
|
|
|
+ifneq ($(OTA_KEY_OVERRIDE_DIR),)
|
2021-04-05 22:57:59 -04:00
|
|
|
+ PRODUCT_OTA_PUBLIC_KEYS := $(OTA_KEY_OVERRIDE_DIR)/releasekey.x509.pem
|
2021-03-29 17:09:12 -04:00
|
|
|
+ PRODUCT_EXTRA_RECOVERY_KEYS := $(OTA_KEY_OVERRIDE_DIR)/extra
|
|
|
|
+endif
|
|
|
|
+
|
2021-04-05 22:57:59 -04:00
|
|
|
# Resolve and setup per-module dex-preopt configs.
|
|
|
|
DEXPREOPT_DISABLED_MODULES :=
|
|
|
|
# If a module has multiple setups, the first takes precedence.
|
2021-04-06 05:06:15 -04:00
|
|
|
diff --git a/target/product/security/Android.mk b/target/product/security/Android.mk
|
2022-05-12 10:12:31 -04:00
|
|
|
index d6a8b5378d..0018105865 100644
|
2021-04-06 05:06:15 -04:00
|
|
|
--- a/target/product/security/Android.mk
|
|
|
|
+++ b/target/product/security/Android.mk
|
|
|
|
@@ -55,8 +55,15 @@ LOCAL_MODULE_CLASS := ETC
|
|
|
|
LOCAL_MODULE_STEM := otacerts.zip
|
|
|
|
LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/security
|
|
|
|
include $(BUILD_SYSTEM)/base_rules.mk
|
|
|
|
-$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
|
|
|
|
-$(LOCAL_BUILT_MODULE): $(SOONG_ZIP) $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
|
|
|
|
+
|
|
|
|
+OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
|
|
|
|
+
|
|
|
|
+ifneq ($(OTA_KEY_OVERRIDE_DIR),)
|
|
|
|
+ OTA_PUBLIC_KEYS := $(OTA_KEY_OVERRIDE_DIR)/releasekey.x509.pem
|
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(OTA_PUBLIC_KEYS)
|
|
|
|
+$(LOCAL_BUILT_MODULE): $(SOONG_ZIP) $(OTA_PUBLIC_KEYS)
|
|
|
|
$(SOONG_ZIP) -o $@ -j -f $(PRIVATE_CERT)
|
|
|
|
|
|
|
|
|
2022-05-12 10:12:31 -04:00
|
|
|
@@ -72,11 +79,18 @@ include $(BUILD_SYSTEM)/base_rules.mk
|
2021-04-06 05:06:15 -04:00
|
|
|
|
|
|
|
extra_recovery_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS))
|
|
|
|
|
|
|
|
-$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
|
|
|
|
+OTA_PUBLIC_KEYS := $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem
|
|
|
|
+
|
|
|
|
+ifneq ($(OTA_KEY_OVERRIDE_DIR),)
|
|
|
|
+ OTA_PUBLIC_KEYS := $(OTA_KEY_OVERRIDE_DIR)/releasekey.x509.pem
|
2022-05-12 10:12:31 -04:00
|
|
|
+ extra_recovery_keys := $(OTA_KEY_OVERRIDE_DIR)/extra.x509.pem
|
2021-04-06 05:06:15 -04:00
|
|
|
+endif
|
|
|
|
+
|
|
|
|
+$(LOCAL_BUILT_MODULE): PRIVATE_CERT := $(OTA_PUBLIC_KEYS)
|
|
|
|
$(LOCAL_BUILT_MODULE): PRIVATE_EXTRA_RECOVERY_KEYS := $(extra_recovery_keys)
|
|
|
|
$(LOCAL_BUILT_MODULE): \
|
|
|
|
$(SOONG_ZIP) \
|
|
|
|
- $(DEFAULT_SYSTEM_DEV_CERTIFICATE).x509.pem \
|
|
|
|
+ $(OTA_PUBLIC_KEYS) \
|
|
|
|
$(extra_recovery_keys)
|
|
|
|
$(SOONG_ZIP) -o $@ -j \
|
|
|
|
$(foreach key_file, $(PRIVATE_CERT) $(PRIVATE_EXTRA_RECOVERY_KEYS), -f $(key_file))
|