diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-14 13:47:25 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-21 14:49:15 +0100 |
| commit | 9f999131bc6798e320432e71f3bfbcfbf20dc295 (patch) | |
| tree | 293d744cd33e952a7bacc2781d08f09592a1fa38 /python/lilliput_ae_1.py | |
| parent | a1d3889f48a3fffd38a855fc433a9a3d3f649434 (diff) | |
| download | lilliput-ae-implem-9f999131bc6798e320432e71f3bfbcfbf20dc295.tar.xz | |
[implem-python] Confinement de la gestion des tours au module TBC
Retrait de quelques variables globales par la même occasion. Renommage
de "round" en "i" pour 1) coller à la spec 2) éviter le conflit avec
le builtin "round".
Diffstat (limited to 'python/lilliput_ae_1.py')
| -rw-r--r-- | python/lilliput_ae_1.py | 16 |
1 files changed, 1 insertions, 15 deletions
diff --git a/python/lilliput_ae_1.py b/python/lilliput_ae_1.py index 92cfa6e..9eb5460 100644 --- a/python/lilliput_ae_1.py +++ b/python/lilliput_ae_1.py @@ -3,7 +3,7 @@ """ import lilliput_tbc as ltbc -from constants import NONCE_BYTES, rounds +from constants import NONCE_BYTES from helpers import ArrayToBlockbytesMatrix, BlockbytesMatrixToBytes @@ -13,7 +13,6 @@ TWEAK_BITS = 192 TWEAKEY_BITS = KEY_BITS + TWEAK_BITS LANE_BITS = 64 LANES = int((TWEAKEY_BITS) / LANE_BITS) -ROUNDS = 32 BLOCK_BYTES = int(BLOCK_BITS / 8) KEY_BYTES = int(KEY_BITS / 8) @@ -30,12 +29,10 @@ def InitParameters(key_bits) : global TWEAKEY_BITS global TWEAKEY_BYTES global LANES - global ROUNDS KEY_BITS = key_bits TWEAKEY_BITS = KEY_BITS + TWEAK_BITS LANES = int((TWEAKEY_BITS) / LANE_BITS) - ROUNDS = rounds(key_bits) KEY_BYTES = int(KEY_BITS / 8) TWEAKEY_BYTES = int(TWEAKEY_BITS / 8) @@ -230,7 +227,6 @@ def OCB3Enc(A, M, N, key) : M = ArrayToBlockbytesMatrix(M) ltbc.KEY_BITS = KEY_BITS - ltbc.ROUNDS = ROUNDS ltbc.TWEAK_BITS = TWEAK_BITS ltbc.LANES = LANES @@ -239,11 +235,6 @@ def OCB3Enc(A, M, N, key) : ltbc.TWEAK_BYTES = TWEAK_BYTES ltbc.TWEAKEY_BYTES = TWEAKEY_BYTES - ltbc.TKs = [[0 for byte in range(0, TWEAKEY_BYTES)] for round in range(0, ROUNDS)] - ltbc.RTKs = [[0 for byte in range(0, 8)] for round in range(0, ROUNDS)] - ltbc.States = [[0 for byte in range(0, BLOCK_BYTES)] for round in range(0, ROUNDS)] - - Auth = BuildAuth(A, key) (Final, C) = TreatMessageEnc(M, N, key) tag = XorState(Auth, Final) @@ -264,7 +255,6 @@ def OCB3Dec(A, C, N, tag, key) : C = ArrayToBlockbytesMatrix(C) ltbc.KEY_BITS = KEY_BITS - ltbc.ROUNDS = ROUNDS ltbc.TWEAK_BITS = TWEAK_BITS ltbc.LANES = LANES @@ -273,10 +263,6 @@ def OCB3Dec(A, C, N, tag, key) : ltbc.TWEAK_BYTES = TWEAK_BYTES ltbc.TWEAKEY_BYTES = TWEAKEY_BYTES - ltbc.TKs = [[0 for byte in range(0, TWEAKEY_BYTES)] for round in range(0, ROUNDS)] - ltbc.RTKs = [[0 for byte in range(0, 8)] for round in range(0, ROUNDS)] - ltbc.States = [[0 for byte in range(0, BLOCK_BYTES)] for round in range(0, ROUNDS)] - Auth = BuildAuth(A, key) (Final, M) = TreatMessageDec(C, N, key) tag2 = XorState(Auth, Final) |
