From abcd16f1856ab8f0b9076f451eede1f7c9e6b50f Mon Sep 17 00:00:00 2001 From: Vladimir Rozic Date: Fri, 8 Sep 2023 15:29:29 +0100 Subject: [PATCH] [tvla] Set HAMMING_WEIGHT as the default leakage model AES leakage can be computed using either HAMMING_WEIGHT or HAMMING_DISTANCE. HAMMING_DISTANCE was useful in the early stages of the project for analysing unprotected implemtation and debugging the setup. However, now we use only HAMMING_WEIGHT model for TVLA so it makes sense to make it the default. Signed-off-by: Vladimir Rozic --- cw/tvla.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cw/tvla.py b/cw/tvla.py index a3f5ce51..916ff0e6 100755 --- a/cw/tvla.py +++ b/cw/tvla.py @@ -169,7 +169,7 @@ def compute_histograms_aes(trace_resolution, rnd_list, byte_list, traces, leakag return histograms -def compute_leakage_aes(keys, plaintexts, leakage_model): +def compute_leakage_aes(keys, plaintexts, leakage_model = 'HAMMING_WEIGHT'): """ Sensitive variable is always byte-sized. @@ -567,8 +567,7 @@ def run_tvla(ctx: typer.Context): log.info("Computing Leakage") leakage = Parallel(n_jobs=num_jobs)( delayed(compute_leakage_aes)(keys[i:i + trace_step_leakage], - plaintexts[i:i + trace_step_leakage], - 'HAMMING_WEIGHT') + plaintexts[i:i + trace_step_leakage]) for i in range(0, num_traces, trace_step_leakage)) leakage = np.concatenate((leakage[:]), axis=2) if save_to_disk_leakage: