From 1a82b407a41f9d2e59e9cc408fe3be80e1f4b9fa Mon Sep 17 00:00:00 2001 From: Michael Scire Date: Sun, 24 Mar 2019 08:26:14 -0700 Subject: [PATCH] sept-sign: remove += for compatibility --- sept/sept-secondary/sept_sign.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sept/sept-secondary/sept_sign.py b/sept/sept-secondary/sept_sign.py index a4dd83a87..ba108c1fc 100644 --- a/sept/sept-secondary/sept_sign.py +++ b/sept/sept-secondary/sept_sign.py @@ -32,8 +32,8 @@ def get_last_block_for_desired_mac(key, data, desired_mac): k1 = shift_left_xor_rb(AES.new(key, AES.MODE_ECB).encrypt(bytearray(0x10))) if len(data) & 0xF: k1 = shift_left_xor_rb(k1) - data += b'\x80' - data += bytearray((0x10 - (len(data) & 0xF)) & 0xF) + data = data + b'\x80' + data = data + bytearray((0x10 - (len(data) & 0xF)) & 0xF) num_blocks = (len(data) + 0xF) >> 4 last_block = sxor(bytearray(AES.new(key, AES.MODE_ECB).decrypt(desired_mac)), bytearray(k1)) if len(data) > 0x0: @@ -43,20 +43,20 @@ def get_last_block_for_desired_mac(key, data, desired_mac): def sign_encrypt_code(code, sig_key, enc_key, iv, desired_mac): # Pad with 0x20 of zeroes. - code += bytearray(0x20) + code = code + bytearray(0x20) code_len = len(code) code_len += 0xFFF code_len &= ~0xFFF - code += bytearray(code_len - len(code)) + code = code + bytearray(code_len - len(code)) # Add empty trustzone, warmboot segments. - code += bytearray(0x1FE0 - 0x10) + code = code + bytearray(0x1FE0 - 0x10) pk11_hdr = b'PK11' + pk('