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 <jukkax@ssrc.tii.ae>
This commit is contained in:
Jukka Laitinen 2021-05-28 16:13:51 +03:00 committed by Beat Küng
parent ab0e3b6001
commit caed8e4b05
1 changed files with 2 additions and 1 deletions

View File

@ -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 # Align to 4 bytes. Signature always starts at
# 4 byte aligned address, but the signee size # 4 byte aligned address, but the signee size
# might not be aligned # 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: try:
with open(key_file_path,mode='r') as f: with open(key_file_path,mode='r') as f: