From bed7225b802681052429de0a668867b131d931f8 Mon Sep 17 00:00:00 2001 From: Michael Tempelmeier Date: Wed, 25 Jan 2023 11:56:18 +0100 Subject: [PATCH] [otbn, sca] optimized some parameters to speed things up Signed-off-by: Michael Tempelmeier --- cw/capture.py | 8 ++++---- cw/capture_ecdsa_skgen_cw310.yaml | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/cw/capture.py b/cw/capture.py index 445d5055..3a697a28 100755 --- a/cw/capture.py +++ b/cw/capture.py @@ -1008,7 +1008,7 @@ def capture_ecdsa_secret_keygen(ot, ktp, fw_bin, pll_frequency, capture_cfg): """ # Currently, we need to reprogram the firmware before every sign operation # TODO: Investigate if this is needed. - reset_firmware = True + reset_firmware = False # OTBN operations are long. CW-Husky can store only 131070 samples # in the non-stream mode. In case we want to collect more samples, @@ -1069,7 +1069,7 @@ def capture_ecdsa_secret_keygen(ot, ktp, fw_bin, pll_frequency, capture_cfg): # Generate a new random mask for each trace. mask = ktp.next_text() - print(f'mask = {mask.hex()}') + tqdm.write(f'mask = {mask.hex()}') # Loop to collect each section of the power trace for ii in range(num_sections): @@ -1097,13 +1097,13 @@ def capture_ecdsa_secret_keygen(ot, ktp, fw_bin, pll_frequency, capture_cfg): ret = ot.scope.capture(poll_done=True) # If getting inconsistent results (e.g. variable number of cycles), # adding a sufficient sleep below here appears to fix things - time.sleep(1) + #time.sleep(1) # we cannot afford 1 second per run. if ret: raise RuntimeError('Timeout during capture') # Check the number of cycles where the trigger signal was high. cycles = ot.scope.adc.trig_count - print("Observed number of cycles: %d" % cycles) + tqdm.write("Observed number of cycles: %d" % cycles) # Append the section into the waves array waves = np.append(waves, ot.scope.get_last_trace(as_int=True)) diff --git a/cw/capture_ecdsa_skgen_cw310.yaml b/cw/capture_ecdsa_skgen_cw310.yaml index 9835b97a..2a9d61cc 100644 --- a/cw/capture_ecdsa_skgen_cw310.yaml +++ b/cw/capture_ecdsa_skgen_cw310.yaml @@ -15,12 +15,14 @@ capture: # Output length (most likely unused). output_len_bytes: 40 # Samples per trace - num_samples: 262140 + # num_samples: 262140 + # Fifo Size is 131070 + num_samples: 131070 # max num samples to avoid multiple runs per trace # Offset in samples offset: 0 # scope gain in db - 13 for non-stream mode, 32.5 for stream mode scope_gain: 32.5 - num_traces: 1 + num_traces: 100 project_name: projects/opentitan_ecdsa_keygen waverunner_ip: 192.168.1.228 # As OTBN operations are long, we may need to overwrite the following