Moving system_other key into product.img
Currently system_other AVB public key is placed in system.img. However, this makes it's harder to have a *generic* system.img across different product configs. Moving the key to /product partition to allow more product-specific AVB keys. Device board config can add /product/etc/fstab.postinstall, to mount system_other with this key in /product. It can specify different mount options, file systems, verity settings, etc., in this product-specific fstab as well. Bug: 123611926 Test: `make productimage` checks the following is generated. $OUT/product/etc/security/avb/system_other.avbpubkey Also checks it's included in $OUT/installed-files-product.{json, txt} Test: run the following command and checks that PRODUCT/etc/security/avb/system_other.avbpubkey is updated: ./build/tools/releasetools/sign_target_files_apks \ --avb_system_other_algorithm SHA256_RSA2048 \ --avb_system_other_key external/avb/test/data/testkey_rsa2048.pem \ out/dist/*-target_files-*.zip signed-target_files.zip Change-Id: I6804f29941bec54375d80bd68a5aedb5c23b842e
This commit is contained in:
@@ -91,12 +91,12 @@ Usage: sign_target_files_apks [flags] input_target_files output_target_files
|
||||
Replace the veritykeyid in BOOT/cmdline of input_target_file_zip
|
||||
with keyid of the cert pointed by <path_to_X509_PEM_cert_file>.
|
||||
|
||||
--avb_{boot,system,vendor,dtbo,vbmeta}_algorithm <algorithm>
|
||||
--avb_{boot,system,vendor,dtbo,vbmeta}_key <key>
|
||||
--avb_{boot,system,system_other,vendor,dtbo,vbmeta}_algorithm <algorithm>
|
||||
--avb_{boot,system,system_other,vendor,dtbo,vbmeta}_key <key>
|
||||
Use the specified algorithm (e.g. SHA256_RSA4096) and the key to AVB-sign
|
||||
the specified image. Otherwise it uses the existing values in info dict.
|
||||
|
||||
--avb_{apex,boot,system,vendor,dtbo,vbmeta}_extra_args <args>
|
||||
--avb_{apex,boot,system,system_other,vendor,dtbo,vbmeta}_extra_args <args>
|
||||
Specify any additional args that are needed to AVB-sign the image
|
||||
(e.g. "--signing_helper /path/to/helper"). The args will be appended to
|
||||
the existing ones in info dict.
|
||||
@@ -584,6 +584,18 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
|
||||
elif filename == "META/care_map.pb" or filename == "META/care_map.txt":
|
||||
pass
|
||||
|
||||
# Updates system_other.avbpubkey in /product/etc/.
|
||||
elif filename in (
|
||||
"PRODUCT/etc/security/avb/system_other.avbpubkey",
|
||||
"SYSTEM/product/etc/security/avb/system_other.avbpubkey"):
|
||||
# Only update system_other's public key, if the corresponding signing
|
||||
# key is specified via --avb_system_other_key.
|
||||
signing_key = OPTIONS.avb_keys.get("system_other")
|
||||
if signing_key:
|
||||
public_key = common.ExtractAvbPublicKey(signing_key)
|
||||
print(" Rewriting AVB public key of system_other in /product")
|
||||
common.ZipWrite(output_tf_zip, public_key, filename)
|
||||
|
||||
# A non-APK file; copy it verbatim.
|
||||
else:
|
||||
common.ZipWriteStr(output_tf_zip, out_info, data)
|
||||
@@ -934,6 +946,7 @@ def ReplaceAvbSigningKeys(misc_info):
|
||||
'dtbo' : 'avb_dtbo_add_hash_footer_args',
|
||||
'recovery' : 'avb_recovery_add_hash_footer_args',
|
||||
'system' : 'avb_system_add_hashtree_footer_args',
|
||||
'system_other' : 'avb_system_other_add_hashtree_footer_args',
|
||||
'vendor' : 'avb_vendor_add_hashtree_footer_args',
|
||||
'vbmeta' : 'avb_vbmeta_args',
|
||||
}
|
||||
@@ -1153,6 +1166,12 @@ def main(argv):
|
||||
OPTIONS.avb_algorithms['system'] = a
|
||||
elif o == "--avb_system_extra_args":
|
||||
OPTIONS.avb_extra_args['system'] = a
|
||||
elif o == "--avb_system_other_key":
|
||||
OPTIONS.avb_keys['system_other'] = a
|
||||
elif o == "--avb_system_other_algorithm":
|
||||
OPTIONS.avb_algorithms['system_other'] = a
|
||||
elif o == "--avb_system_other_extra_args":
|
||||
OPTIONS.avb_extra_args['system_other'] = a
|
||||
elif o == "--avb_vendor_key":
|
||||
OPTIONS.avb_keys['vendor'] = a
|
||||
elif o == "--avb_vendor_algorithm":
|
||||
@@ -1192,6 +1211,9 @@ def main(argv):
|
||||
"avb_system_algorithm=",
|
||||
"avb_system_key=",
|
||||
"avb_system_extra_args=",
|
||||
"avb_system_other_algorithm=",
|
||||
"avb_system_other_key=",
|
||||
"avb_system_other_extra_args=",
|
||||
"avb_vendor_algorithm=",
|
||||
"avb_vendor_key=",
|
||||
"avb_vendor_extra_args=",
|
||||
|
Reference in New Issue
Block a user