diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-16 03:10:17 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2022-04-16 03:10:17 +0000 |
commit | c47e2cd93d815f153049b43ffc0e4742992a6a10 (patch) | |
tree | 956db483ee8a76837425a81c0d3cb4dc24e27ef4 | |
parent | 8c046134b1d5a297e9867c49ec4016a8734b218e (diff) | |
parent | bdc7bdab690adf1fecba86d03b12c3ca882d8e42 (diff) | |
download | extras-c47e2cd93d815f153049b43ffc0e4742992a6a10.tar.gz |
Snap for 8462561 from bdc7bdab690adf1fecba86d03b12c3ca882d8e42 to tm-release
Change-Id: I75bba85a4c578985a620e48b0d9808f639868b58
-rw-r--r-- | verity/build_verity_metadata.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/verity/build_verity_metadata.py b/verity/build_verity_metadata.py index 7fc7b60f..a428f270 100644 --- a/verity/build_verity_metadata.py +++ b/verity/build_verity_metadata.py @@ -43,12 +43,12 @@ def build_metadata_block(verity_table, signature, verity_disable=False): magic = MAGIC_DISABLE if verity_disable else MAGIC_NUMBER block = struct.pack("II256sI", magic, VERSION, signature, table_len) block += verity_table - block = block.ljust(METADATA_SIZE, '\x00') + block = block.ljust(METADATA_SIZE, b'\x00') return block def sign_verity_table(table, signer_path, key_path, signer_args=None): - with tempfile.NamedTemporaryFile(mode='w', suffix='.table') as table_file: - with tempfile.NamedTemporaryFile(mode='r', suffix='.sig') as signature_file: + with tempfile.NamedTemporaryFile(mode='wb', suffix='.table') as table_file: + with tempfile.NamedTemporaryFile(mode='rb', suffix='.sig') as signature_file: table_file.write(table) table_file.flush() if signer_args is None: @@ -70,7 +70,7 @@ def build_verity_table(block_device, data_blocks, root_hash, salt): data_blocks, root_hash, salt) - return table + return table.encode() def build_verity_metadata(data_blocks, metadata_image, root_hash, salt, block_device, signer_path, signing_key, signer_args=None, |