summaryrefslogtreecommitdiff
path: root/verity
diff options
context:
space:
mode:
authorCole Faust <colefaust@google.com>2022-04-14 11:49:32 -0700
committerCole Faust <colefaust@google.com>2022-04-14 11:53:38 -0700
commitec1f0db4fa81afec435ac3cd2adea3e3b6a5146b (patch)
treec15250b1d93261cec8eb7855a50f009b45a95e77 /verity
parentc17997c5a349875d93a6d3c0f4a7aa96bb78c351 (diff)
downloadextras-ec1f0db4fa81afec435ac3cd2adea3e3b6a5146b.tar.gz
Fix more issues with python3 conversion of build_verity_metadata.py
Bug: 203436762 Test: lunch hikey-userdebug; m droidcore Change-Id: I11ee92d7a3d9aa4e190c338e8438848c3ba47762
Diffstat (limited to 'verity')
-rw-r--r--verity/build_verity_metadata.py8
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,