shadysim.py: use string multiplication to add padding

This commit is contained in:
Vadim Yanitskiy 2021-02-22 22:23:13 +01:00
parent caa2a1752e
commit 8ac76661ce
1 changed files with 1 additions and 3 deletions

View File

@ -115,9 +115,7 @@ class AppLoaderCommands(object):
if ((spi_1 & 0x04) != 0): # check ciphering bit
len_cipher = 6 + len_sig + (len(data) / 2)
pad_cnt = 8 - (len_cipher % 8) # 8 Byte blocksize for DES-CBC (TODO: different padding)
# TODO: there is probably a better way to add "pad_cnt" padding bytes
for i in range(0, pad_cnt):
data = data + '00';
data += '00' * pad_cnt
# CHL + SPI first octet
part_head = ('%02x' % (0x0D + len_sig)) + ('%02x' % (spi_1))