diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-25 09:45:24 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-25 09:45:24 +0100 |
| commit | d6164fddbb09f0dc5248b341e97610957f80f8f8 (patch) | |
| tree | b568af188bb759bb02e721a9cd0e3e1511e06491 /src/add_python/lilliput/ae_mode_2.py | |
| parent | b6186739572125788c9ae0c528458eaaa7361ce9 (diff) | |
| download | lilliput-ae-implem-d6164fddbb09f0dc5248b341e97610957f80f8f8.tar.xz | |
[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 (limited to 'src/add_python/lilliput/ae_mode_2.py')
| -rw-r--r-- | src/add_python/lilliput/ae_mode_2.py | 9 |
1 files 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 index a486bc9..2349757 100644 --- 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 |
