Merge "Removing AFTL integration from release tools."

This commit is contained in:
Treehugger Robot 2021-06-29 14:31:49 +00:00 committed by Gerrit Code Review
commit 389f5afb83
5 changed files with 1 additions and 212 deletions

View file

@ -4234,7 +4234,6 @@ ifeq ($(build_otatools_package),true)
INTERNAL_OTATOOLS_MODULES := \
aapt2 \
add_img_to_target_files \
aftltool \
apksigner \
append2simg \
avbtool \

View file

@ -80,11 +80,6 @@ class Options(object):
self.boot_signer_args = []
self.verity_signer_path = None
self.verity_signer_args = []
self.aftl_tool_path = None
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
@ -1383,46 +1378,6 @@ def GetAvbChainedPartitionArg(partition, info_dict, key=None):
return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path)
def ConstructAftlMakeImageCommands(output_image):
"""Constructs the command to append the aftl image to vbmeta."""
# Ensure the other AFTL parameters are set as well.
assert OPTIONS.aftl_tool_path is not None, 'No aftl tool provided.'
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.'
vbmeta_image = MakeTempFile()
os.rename(output_image, vbmeta_image)
build_info = BuildInfo(OPTIONS.info_dict, use_legacy_id=True)
version_incremental = build_info.GetBuildProp("ro.build.version.incremental")
aftltool = OPTIONS.aftl_tool_path
server_argument_list = [OPTIONS.aftl_server, OPTIONS.aftl_key_path]
aftl_cmd = [aftltool, "make_icp_from_vbmeta",
"--vbmeta_image_path", vbmeta_image,
"--output", output_image,
"--version_incremental", version_incremental,
"--transparency_log_servers", ','.join(server_argument_list),
"--manufacturer_key", OPTIONS.aftl_manufacturer_key_path,
"--algorithm", "SHA256_RSA4096",
"--padding", "4096"]
if OPTIONS.aftl_signer_helper:
aftl_cmd.extend(shlex.split(OPTIONS.aftl_signer_helper))
return aftl_cmd
def AddAftlInclusionProof(output_image):
"""Appends the aftl inclusion proof to the vbmeta image."""
aftl_cmd = ConstructAftlMakeImageCommands(output_image)
RunAndCheckOutput(aftl_cmd)
verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path',
output_image, '--transparency_log_pub_keys',
OPTIONS.aftl_key_path]
RunAndCheckOutput(verify_cmd)
def AppendGkiSigningArgs(cmd):
"""Append GKI signing arguments for mkbootimg."""
# e.g., --gki_signing_key path/to/signing_key
@ -1516,10 +1471,6 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions):
RunAndCheckOutput(cmd)
# Generate the AFTL inclusion proof.
if OPTIONS.aftl_server is not None:
AddAftlInclusionProof(image_path)
def _MakeRamdisk(sourcedir, fs_config_file=None,
ramdisk_format=RamdiskFormat.GZ):
@ -2477,9 +2428,7 @@ def ParseOptions(argv,
"java_path=", "java_args=", "android_jar_path=", "public_key_suffix=",
"private_key_suffix=", "boot_signer_path=", "boot_signer_args=",
"verity_signer_path=", "verity_signer_args=", "device_specific=",
"extra=", "logfile=", "aftl_tool_path=", "aftl_server=",
"aftl_key_path=", "aftl_manufacturer_key_path=",
"aftl_signer_helper="] + list(extra_long_opts))
"extra=", "logfile="] + list(extra_long_opts))
except getopt.GetoptError as err:
Usage(docstring)
print("**", str(err), "**")
@ -2517,16 +2466,6 @@ 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_tool_path",):
OPTIONS.aftl_tool_path = 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"):

View file

@ -1631,88 +1631,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
self.assertEqual('3', chained_partition_args[1])
self.assertTrue(os.path.exists(chained_partition_args[2]))
def test_BuildVBMeta_appendAftlCommandSyntax(self):
testdata_dir = test_utils.get_testdata_dir()
common.OPTIONS.info_dict = {
'ab_update': 'true',
'avb_avbtool': 'avbtool',
'build.prop': common.PartitionBuildProps.FromDictionary(
'system', {
'ro.build.version.incremental': '6285659',
'ro.product.device': 'coral',
'ro.build.fingerprint':
'google/coral/coral:R/RP1A.200311.002/'
'6285659:userdebug/dev-keys'}
),
}
common.OPTIONS.aftl_tool_path = 'aftltool'
common.OPTIONS.aftl_server = 'log.endpoints.aftl-dev.cloud.goog:9000'
common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
'test_transparency_key.pub')
common.OPTIONS.aftl_manufacturer_key_path = os.path.join(
testdata_dir, 'test_aftl_rsa4096.pem')
vbmeta_image = tempfile.NamedTemporaryFile(delete=False)
cmd = common.ConstructAftlMakeImageCommands(vbmeta_image.name)
expected_cmd = [
'aftltool', 'make_icp_from_vbmeta',
'--vbmeta_image_path', 'place_holder',
'--output', vbmeta_image.name,
'--version_incremental', '6285659',
'--transparency_log_servers',
'log.endpoints.aftl-dev.cloud.goog:9000,{}'.format(
common.OPTIONS.aftl_key_path),
'--manufacturer_key', common.OPTIONS.aftl_manufacturer_key_path,
'--algorithm', 'SHA256_RSA4096',
'--padding', '4096']
# ignore the place holder, i.e. path to a temp file
self.assertEqual(cmd[:3], expected_cmd[:3])
self.assertEqual(cmd[4:], expected_cmd[4:])
@unittest.skip("enable after we have a server for public")
def test_BuildVBMeta_appendAftlContactServer(self):
testdata_dir = test_utils.get_testdata_dir()
common.OPTIONS.info_dict = {
'ab_update': 'true',
'avb_avbtool': 'avbtool',
'build.prop': common.PartitionBuildProps.FromDictionary(
'system', {
'ro.build.version.incremental': '6285659',
'ro.product.device': 'coral',
'ro.build.fingerprint':
'google/coral/coral:R/RP1A.200311.002/'
'6285659:userdebug/dev-keys'}
)
}
common.OPTIONS.aftl_tool_path = "aftltool"
common.OPTIONS.aftl_server = "log.endpoints.aftl-dev.cloud.goog:9000"
common.OPTIONS.aftl_key_path = os.path.join(testdata_dir,
'test_transparency_key.pub')
common.OPTIONS.aftl_manufacturer_key_path = os.path.join(
testdata_dir, 'test_aftl_rsa4096.pem')
input_dir = common.MakeTempDir()
system_image = common.MakeTempFile()
build_image_cmd = ['mkuserimg_mke2fs', input_dir, system_image, 'ext4',
'/system', str(4096 * 100), '-j', '0', '-s']
common.RunAndCheckOutput(build_image_cmd)
add_footer_cmd = ['avbtool', 'add_hashtree_footer',
'--partition_size', str(4096 * 150),
'--partition_name', 'system',
'--image', system_image]
common.RunAndCheckOutput(add_footer_cmd)
vbmeta_image = common.MakeTempFile()
common.BuildVBMeta(vbmeta_image, {'system': system_image}, 'vbmeta',
['system'])
verify_cmd = ['aftltool', 'verify_image_icp', '--vbmeta_image_path',
vbmeta_image, '--transparency_log_pub_keys',
common.OPTIONS.aftl_key_path]
common.RunAndCheckOutput(verify_cmd)
@test_utils.SkipIfExternalToolsUnavailable()
def test_AppendGkiSigningArgs_NoSigningKeyPath(self):
# A non-GKI boot.img has no gki_signing_key_path.

View file

@ -1,52 +0,0 @@
-----BEGIN PRIVATE KEY-----
MIIJQgIBADANBgkqhkiG9w0BAQEFAASCCSwwggkoAgEAAoICAQDDlhUPUgtWL6LB
Wybp6wsEJeioV1aRLPGSA2/xIpTiJUK46cb/MD5eBTWjKENoIgX23eL/ePy2I68e
+WvcZ5ITGOTRQqNVZIdc5qvr03wkV0BsJQMHSMAHacePpB/4xM5MzN/6Ku1wA8Dw
uK+v/Cw4hqq8H/gP0oPVQ1bwcIePzRPX4YkkyXusoyzTIm5DJ9reVtyFucKqANCN
aFmGxcaEc2nADtARQWJpO95joFsMvr68+JBxpCt8aWbxuSz/rLJ9Y8Z46V/++XG+
E4QEob/WVY5pUD/RyogLrfhIf+zO7R3wJklXElSFacIX9+RzR9dgkQVbqxLfBKIP
XWLCsF4I4EnvqUtaVjIMl8UpZpoq8pDLRqZ71Os5xZYq06x9E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