diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-14 14:21:39 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-21 14:49:15 +0100 |
| commit | dc5efdfce750c02d4f3c4b35d5137342002fd78d (patch) | |
| tree | c3695c51283e0d0b62063a57824d4bd54fd05102 /python/lilliput_ae_2.py | |
| parent | 864e0bc2a83297bbea069f3fcc6cb333dbc2de19 (diff) | |
| download | lilliput-ae-implem-dc5efdfce750c02d4f3c4b35d5137342002fd78d.tar.xz | |
[implem-python] Retrait des variables globales de lilliput_tbc
On peut tout déduire de len(tweak) / len(key) ; la seule raison
d'utiliser autant de constantes en C est que les tableaux se dégradent
en pointeurs, donc c'est où les constantes, où une tétrachiée
d'arguments.
Diffstat (limited to 'python/lilliput_ae_2.py')
| -rw-r--r-- | python/lilliput_ae_2.py | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/python/lilliput_ae_2.py b/python/lilliput_ae_2.py index ed57cdf..aeebe27 100644 --- a/python/lilliput_ae_2.py +++ b/python/lilliput_ae_2.py @@ -221,19 +221,11 @@ def SCT2Enc(A, M, N, key) : A = ArrayToBlockbytesMatrix(A) M = ArrayToBlockbytesMatrix(M) + K = list(key) - ltbc.KEY_BITS = KEY_BITS - ltbc.TWEAK_BITS = TWEAK_BITS - ltbc.LANES = LANES - - ltbc.TWEAKEY_BITS = TWEAKEY_BITS - ltbc.KEY_BYTES = KEY_BYTES - ltbc.TWEAK_BYTES = TWEAK_BYTES - ltbc.TWEAKEY_BYTES = TWEAKEY_BYTES - - Auth = BuildAuth(A, key) - tag = MesssageAuthTag(M, N, Auth, key) - C = MessageEncryption(M, N, tag, key) + Auth = BuildAuth(A, K) + tag = MesssageAuthTag(M, N, Auth, K) + C = MessageEncryption(M, N, tag, K) return BlockbytesMatrixToBytes(C), bytes(tag) @@ -249,19 +241,11 @@ def SCT2Dec(A, C, N, tag, key) : A = ArrayToBlockbytesMatrix(A) C = ArrayToBlockbytesMatrix(C) + K = list(key) - ltbc.KEY_BITS = KEY_BITS - ltbc.TWEAK_BITS = TWEAK_BITS - ltbc.LANES = LANES - - ltbc.TWEAKEY_BITS = TWEAKEY_BITS - ltbc.KEY_BYTES = KEY_BYTES - ltbc.TWEAK_BYTES = TWEAK_BYTES - ltbc.TWEAKEY_BYTES = TWEAKEY_BYTES - - M = MessageEncryption(C, N, tag, key) - Auth = BuildAuth(A, key) - tag2 = MesssageAuthTag(M, N, Auth, key) + M = MessageEncryption(C, N, tag, K) + Auth = BuildAuth(A, K) + tag2 = MesssageAuthTag(M, N, Auth, K) if(tag == tag2) : return BlockbytesMatrixToBytes(M) |
