summaryrefslogtreecommitdiff
path: root/python/lilliput_ae_1.py
diff options
context:
space:
mode:
authorKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-14 16:45:35 +0100
committerKévin Le Gouguec <kevin.legouguec@airbus.com>2019-03-21 14:49:15 +0100
commit12585a5a0f2faca9c6ab2490bb50b34450876538 (patch)
treecfc1b9156571b2fd2c8964334e62e7ef316508ae /python/lilliput_ae_1.py
parent57ccbe8a1589a275d44c0c1de1fe7122f70b105c (diff)
downloadlilliput-ae-implem-12585a5a0f2faca9c6ab2490bb50b34450876538.tar.xz
[implem-python] Retrait des constantes globales
Et des fonctions d'initialisation. Et d'une fonction non-utilisée dans le mode SCT-2.
Diffstat (limited to 'python/lilliput_ae_1.py')
-rw-r--r--python/lilliput_ae_1.py35
1 files changed, 1 insertions, 34 deletions
diff --git a/python/lilliput_ae_1.py b/python/lilliput_ae_1.py
index 8cf55bb..9de753c 100644
--- a/python/lilliput_ae_1.py
+++ b/python/lilliput_ae_1.py
@@ -15,32 +15,9 @@ from helpers import (
)
-KEY_BITS = 128
TWEAK_BITS = 192
-TWEAKEY_BITS = KEY_BITS + TWEAK_BITS
-LANE_BITS = 64
-LANES = int((TWEAKEY_BITS) / LANE_BITS)
+TWEAK_BYTES = TWEAK_BITS//8
-KEY_BYTES = int(KEY_BITS / 8)
-TWEAK_BYTES = int(TWEAK_BITS / 8)
-TWEAKEY_BYTES = int(TWEAKEY_BITS / 8)
-
-
-def InitParameters(key_bits) :
- global KEY_BITS
- global KEY_BYTES
- global TWEAKEY_BITS
- global TWEAKEY_BYTES
- global LANES
-
- KEY_BITS = key_bits
- TWEAKEY_BITS = KEY_BITS + TWEAK_BITS
- LANES = int((TWEAKEY_BITS) / LANE_BITS)
- KEY_BYTES = int(KEY_BITS / 8)
- TWEAKEY_BYTES = int(TWEAKEY_BITS / 8)
-
-
-###############################################################################
def LowPart(array, number_bits) :
shifted = 0
@@ -64,11 +41,6 @@ def LowPart(array, number_bits) :
return lower_part_byte
-###############################################################################
-
-
-
-################################################################################
class _MessageTweak(Enum):
BLOCK = 0b000
@@ -156,11 +128,8 @@ def TreatMessageDec(C, N, key) :
return (Final, M)
-
################################################################################
def OCB3Enc(A, M, N, key) :
- InitParameters(len(key)*8)
-
K = list(key)
Auth = BuildAuth(TWEAK_BITS, A, K)
@@ -171,8 +140,6 @@ def OCB3Enc(A, M, N, key) :
def OCB3Dec(A, C, N, tag, key) :
- InitParameters(len(key)*8)
-
K = list(key)
Auth = BuildAuth(TWEAK_BITS, A, K)