Compare commits

...

2 Commits

Author SHA1 Message Date
Vadim Yanitskiy f6a806494c shadysim.py: fix: do not apply redundant 8 * '00' padding 2 years ago
Vadim Yanitskiy 8ac76661ce shadysim.py: use string multiplication to add padding 2 years ago
  1. 8
      shadysim/shadysim.py

@ -114,10 +114,10 @@ class AppLoaderCommands(object):
# Padding if Ciphering is used
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';
# 8 Byte blocksize for DES-CBC (TODO: different padding)
if len_cipher % 8 > 0:
pad_cnt = 8 - (len_cipher % 8)
data += '00' * pad_cnt
# CHL + SPI first octet
part_head = ('%02x' % (0x0D + len_sig)) + ('%02x' % (spi_1))

Loading…
Cancel
Save