Skip to content

Commit

Permalink
Change description of compute_leakage_aes()
Browse files Browse the repository at this point in the history
Signed-off-by: Vladimir Rozic <[email protected]>
  • Loading branch information
vrozic committed Sep 20, 2023
1 parent 8a23701 commit c6c79c4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions cw/tvla.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,12 +171,14 @@ def compute_histograms_aes(trace_resolution, rnd_list, byte_list, traces, leakag

def compute_leakage_aes(keys, plaintexts, leakage_model = 'HAMMING_WEIGHT'):
"""
Sensitive variable is always byte-sized.
Computes AES leakage for a given list of plaintexts and keys.
The output "leakage" contains leakage of all state-register bytes after each round.
leakage[X][Y][Z] - Leakage (e.g. hamming weight) of AES round X, byte Y for trace Z
Leakage is computed based on the specified leakage_model.
Two leakage models are available:
HAMMING_WEIGHT - based on the hamming weight of the state register byte.
HAMMING_DISTANCE - based on the hamming distance between the curent and previous state
for a specified byte.
HAMMING_WEIGHT - based on the hamming weight of the state register byte.
HAMMING_DISTANCE - based on the hamming distance between the curent and previous state.
"""
num_traces = len(keys)
leakage = np.zeros((11, 16, num_traces), dtype=np.uint8)
Expand Down

0 comments on commit c6c79c4

Please sign in to comment.