From caed8e4b05d855e41903efc555c05d966c8c130a Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Fri, 28 May 2021 16:13:51 +0300 Subject: [PATCH] Fix cryptotools.py signature alignment If the signature start address is already aligned, the tool erroneously adds 4 filling bytes Signed-off-by: Jukka Laitinen --- Tools/cryptotools.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Tools/cryptotools.py b/Tools/cryptotools.py index be6a90cec0..f058b92a9e 100755 --- a/Tools/cryptotools.py +++ b/Tools/cryptotools.py @@ -81,7 +81,8 @@ def sign(bin_file_path, key_file_path=None, generated_key_file=None): # Align to 4 bytes. Signature always starts at # 4 byte aligned address, but the signee size # might not be aligned - signee_bin += bytearray(b'\xff')*(4-len(signee_bin)%4) + if len(signee_bin)%4 != 0: + signee_bin += bytearray(b'\xff')*(4-len(signee_bin)%4) try: with open(key_file_path,mode='r') as f: