summaryrefslogtreecommitdiff
path: root/python/lilliput_ae_2.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-14 13:47:25 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-21 14:49:15 +0100
commit9f999131bc6798e320432e71f3bfbcfbf20dc295 (patch)
tree293d744cd33e952a7bacc2781d08f09592a1fa38 /python/lilliput_ae_2.py
parenta1d3889f48a3fffd38a855fc433a9a3d3f649434 (diff)
downloadlilliput-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_2.py')
-rw-r--r--python/lilliput_ae_2.py16
1 files changed, 0 insertions, 16 deletions
diff --git a/python/lilliput_ae_2.py b/python/lilliput_ae_2.py
index d072935..ed57cdf 100644
--- a/python/lilliput_ae_2.py
+++ b/python/lilliput_ae_2.py
@@ -3,7 +3,6 @@
"""
import lilliput_tbc as ltbc
-from constants import rounds
from helpers import ArrayToBlockbytesMatrix, BlockbytesMatrixToBytes
@@ -13,7 +12,6 @@ TWEAK_BITS = 128
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)
@@ -32,12 +30,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)
@@ -227,7 +223,6 @@ def SCT2Enc(A, M, N, key) :
M = ArrayToBlockbytesMatrix(M)
ltbc.KEY_BITS = KEY_BITS
- ltbc.ROUNDS = ROUNDS
ltbc.TWEAK_BITS = TWEAK_BITS
ltbc.LANES = LANES
@@ -236,11 +231,6 @@ def SCT2Enc(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)
tag = MesssageAuthTag(M, N, Auth, key)
C = MessageEncryption(M, N, tag, key)
@@ -261,7 +251,6 @@ def SCT2Dec(A, C, N, tag, key) :
C = ArrayToBlockbytesMatrix(C)
ltbc.KEY_BITS = KEY_BITS
- ltbc.ROUNDS = ROUNDS
ltbc.TWEAK_BITS = TWEAK_BITS
ltbc.LANES = LANES
@@ -270,11 +259,6 @@ def SCT2Dec(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)]
-
-
M = MessageEncryption(C, N, tag, key)
Auth = BuildAuth(A, key)
tag2 = MesssageAuthTag(M, N, Auth, key)