Fix-up security assertion (b42b4bb for #453)

This commit is contained in:
Lonami Exo 2017-11-24 19:05:18 +01:00
parent b42b4bb326
commit 74ec6391d9

View File

@ -113,8 +113,10 @@ def _do_authentication(connection):
key, iv = utils.generate_key_data_from_nonce(
res_pq.server_nonce, new_nonce
)
if server_dh_params.encrypted_answer % 16 != 0:
raise SecurityError('AES block size missmatch')
if len(server_dh_params.encrypted_answer) % 16 != 0:
# See PR#453
raise SecurityError('AES block size mismatch')
plain_text_answer = AES.decrypt_ige(
server_dh_params.encrypted_answer, key, iv
)