diff --git a/partition-the-flash.py b/partition-the-flash.py index e8e05de..3f982af 100644 --- a/partition-the-flash.py +++ b/partition-the-flash.py @@ -325,6 +325,9 @@ def encrypt_key(): d = unhexlify('%064x' % client_private)[::-1] m = x+y+d + l = 16 - (len(m) % 16) + m = m + bytes([l])*l + iv = get_random_bytes(AES.block_size) aes = AES.new(psk_encryption_key, AES.MODE_CBC, iv) c = iv + aes.encrypt(m) diff --git a/tls97.py b/tls97.py index 112012a..1ecfe2f 100644 --- a/tls97.py +++ b/tls97.py @@ -478,6 +478,7 @@ class Tls(): iv, c = c[:AES.block_size], c[AES.block_size:] aes=AES.new(psk_encryption_key, AES.MODE_CBC, iv) m=aes.decrypt(c) + m=m[:-m[-1]] # unpad (standard this time) x, m = m[:0x20], m[0x20:] y, m = m[:0x20], m[0x20:]