commit d6164fddbb09f0dc5248b341e97610957f80f8f8
parent b6186739572125788c9ae0c528458eaaa7361ce9
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date: Mon, 25 Mar 2019 09:45:24 +0100
[implem-python] Suppression de variables intermédiaires
Le code résultant ressemble plus à ce qui est décrit dans les
algorithmes 3 et 4.
Diffstat:
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/src/add_python/lilliput/ae_mode_2.py b/src/add_python/lilliput/ae_mode_2.py
@@ -69,8 +69,7 @@ def _message_auth_tag(M, N, Auth, key):
if need_padding:
tweak = _tweak_tag(l, True)
- m_padded = pad10(M[l])
- encryption = tbc.encrypt(tweak, key, m_padded)
+ encryption = tbc.encrypt(tweak, key, pad10(M[l]))
tag = xor(tag, encryption)
tweak = N + [0b00010000]
@@ -89,14 +88,12 @@ def _message_encryption(M, N, tag, key):
for j in range(0, l):
tweak = _add_tag_j(tag, j)
- padded_nonce = N + [0b00000000]
- encryption = tbc.encrypt(tweak, key, padded_nonce)
+ encryption = tbc.encrypt(tweak, key, N+[0b00000000])
C.append(xor(M[j], encryption))
if need_padding:
tweak = _add_tag_j(tag, l)
- padded_nonce = N + [0b00000000]
- encryption = tbc.encrypt(tweak, key, padded_nonce)
+ encryption = tbc.encrypt(tweak, key, N+[0b00000000])
C.append(xor(M[l], encryption))
return C