Add AFTL relevant options to OPTIONS in common.py.

Adds AFTL relevant options in preparation for avbtool changes. The
options are:
aftl_server: A string representing the URL of the transparency log.
aftl_key_path: The path to the public key associated with the
transparency log (in PEM format).
aftl_manufacturer_key_path: The path to the key associated with the
manufacturer for AFTL message signing.
aftl_signing_helper: The signing helper for use with AFTL message
signing.

Change-Id: I73d466f24b171c16dbdaa40c589779bed52be551
Test: Ran add_img_to_target_files with all AFTL options.
Bug: 138779249
This commit is contained in:
Dan Austin
2019-12-12 15:44:00 -08:00
parent 066fac7c8c
commit 5290364e9b

View File

@@ -76,6 +76,10 @@ class Options(object):
self.boot_signer_args = []
self.verity_signer_path = None
self.verity_signer_args = []
self.aftl_server = None
self.aftl_key_path = None
self.aftl_manufacturer_key_path = None
self.aftl_signer_helper = None
self.verbose = False
self.tempfiles = []
self.device_specific = None
@@ -959,6 +963,12 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions):
RunAndCheckOutput(cmd)
if OPTIONS.aftl_server is not None:
# Ensure the other AFTL parameters are set as well.
assert OPTIONS.aftl_key_path is not None, 'No AFTL key provided.'
assert OPTIONS.aftl_manufacturer_key_path is not None, 'No AFTL manufacturer key provided.'
assert OPTIONS.aftl_signer_helper is not None, 'No AFTL signer helper provided.'
# AFTL inclusion proof generation code will go here.
def _MakeRamdisk(sourcedir, fs_config_file=None):
ramdisk_img = tempfile.NamedTemporaryFile()
@@ -1810,7 +1820,8 @@ def ParseOptions(argv,
"java_path=", "java_args=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=",
"extra=", "logfile="] +
"extra=", "logfile=", "aftl_server=", "aftl_key_path=",
"aftl_manufacturer_key_path=", "aftl_signer_helper="] +
list(extra_long_opts))
except getopt.GetoptError as err:
Usage(docstring)
@@ -1847,6 +1858,14 @@ def ParseOptions(argv,
OPTIONS.verity_signer_path = a
elif o in ("--verity_signer_args",):
OPTIONS.verity_signer_args = shlex.split(a)
elif o in ("--aftl_server",):
OPTIONS.aftl_server = a
elif o in ("--aftl_key_path",):
OPTIONS.aftl_key_path = a
elif o in ("--aftl_manufacturer_key_path",):
OPTIONS.aftl_manufacturer_key_path = a
elif o in ("--aftl_signer_helper",):
OPTIONS.aftl_signer_helper = a
elif o in ("-s", "--device_specific"):
OPTIONS.device_specific = a
elif o in ("-x", "--extra"):