ChipWhisperer Scope Interface

Researchers at WPI and across the country use ChipWhisperer devices to conduct side-channel analysis research. ChipWhisperer has an existing library developed to interface with their devices. However, this library was improved upon by providing higher-level API calls

class CWScope
__init__(self, firmware_path: str, gain: int = 25, num_samples: int = 5000, offset: int = 0, target_type: any = cw.targets.SimpleSerial, target_programmer: any = cw.programmers.STM32FProgrammer) None:

Initializes a CW scope object

Parameters:
  • firmware_path (str) – The name of the compiled firmware that will be loaded on the CW target board

  • gain (int) – The gain of the CW scope

  • num_samples (int) – The number of samples to collect for each trace on the CW scope

  • offset (int) – The tine offset for CW scope trace collection

  • target_type (any) – The target type of the CW scope. This depends on the specific ChipWhisperer device that you are using.

  • target_programmer (any) – The target programmer of the CW scope. This depends on the specific ChipWhisperer device that you are using.

Returns:

None

Authors:

Samuel Karkache (swkarkache@wpi.edu)

disconnect(self)

Disconnect CW Scope and Target

standard_capture_traces(self, num_traces: int, experiment_keys: np.ndarray = None, experiment_texts: np.ndarray = None, fixed_key: bool = True, fixed_pt: bool = False) (np.ndarray, np.ndarray, np.ndarray, np.ndarray):

Capture procedure for ChipWhisperer devices. Will return a specified number of traces and the data associated with the collection.

Parameters:
  • num_traces (int) – The number of traces to capture

  • experiment_keys (list) – A collection of keys to use for the capture of each trace. If not specified, the procedure will use the cw basic key generation key = cw.ktp.Basic()[0]

  • experiment_texts (list) – A collection of texts to use for the capture of each trace. If not specified, the procedure will use the cw basic plaintext generation text = cw.ktp.Basic()[1]

  • fixed_key (bool) – Whether to use a fixed key for cw.ktp key generation. Ignored if a collection of keys are supplied.

  • fixed_pt (bool) – Whether to use a fixed plaintext for cw.ktp text generation. Ignored if a collection of texts are supplied.

Returns:

a tuple containing the power traces, keys, plaintexts, and ciphertexts for the experiment

Return type:

tuple(np.ndarray, np.ndarray, np.ndarray, np.ndarray)

Raises:

TypeError – if the length of the specified experiment keys and experiment texts are not equal to each other or the number of traces to be collected.

Authors:

Samuel Karkache (swkarkache@wpi.edu)

capture_traces_tvla(self, num_traces: int, group_a_keys: np.ndarray = None, group_a_texts: np.ndarray = None, group_b_keys: np.ndarray = None, group_b_texts: np.ndarray = None, ktp: any = cwtvla.ktp.FixedVRandomText()) (np.ndarray, np.ndarray):

Captures fixed and random trace set needed for TVLA. Group A is the fixed set and group B is the random set.

Parameters:
  • num_traces (int) – The number of traces to capture for each set

  • group_a_keys (list) – An array of keys for group A

  • group_a_texts (list) – An array of texts for group A

  • group_b_keys (list) – An array of keys for group B

  • group_b_texts (list) – An array of texts for group B

  • ktp – the key text pair algorithm, defaults to cwtvla.ktp.FixedVRandomText(). This is ignored if keys or texts for group A and group B are provided.

Return type:

(np.ndarray, np.ndarray)

Authors:

Samuel Karkache (swkarkache@wpi.edu)

cw_to_file_framework(self, num_traces: int, file_parent: FileParent, experiment_name: str, keys: np.ndarray = None, texts: np.ndarray = None, fixed_key: bool = True, fixed_pt: bool = False) None:

Captures traces on a ChipWhisperer device and saves them directly to the custom file framework. The collected traces, keys, plaintexts, and ciphertexts are saved as dataset to the specified experiment. If the experiment specified does not exist in the file, then a new one is created.

Parameters:
  • num_traces (int) – The number of traces to capture

  • file_parent (FileParent) – The FileParent object to save the file to

  • experiment_name (str) – The name of the experiment

  • keys (np.ndarray) – The keys for the experiment

  • texts – The plaintexts for the experiment

  • texts – np.ndarray

  • fixed_key (bool) – Whether the key should be fixed (assuming the keys and texts parameters are None)

  • fixed_pt (bool) – Whether the plaintext should be fixed (assuming the keys and texts parameters are None)

Returns:

None

Authors:

Samuel Karkache (swkarkache@wpi.edu)