-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' of https://github.com/vernamlab/SCLA_API_MQP
- Loading branch information
Showing
9 changed files
with
183 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import cupy as np | ||
import numpy as slow | ||
import time | ||
|
||
randomValues = np.random.random_sample((1000,1000)) | ||
start = time.time() | ||
mean = np.mean(randomValues) | ||
end = time.time() | ||
print(start - end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,22 @@ | ||
Differential Power Analysis (DPA) | ||
================================ | ||
================================ | ||
|
||
.. method:: calculate_dpa(traces, iv, order=1, key_guess=0, window_size_fma=5, num_of_traces=0): | ||
|
||
Unified differential power analysis method that has support for first and second order DPA. | ||
|
||
:param traces: The power traces to be processed | ||
:param iv: Intermediate algorithm values associated with the power traces | ||
:param key_guess: The DPA key guess | ||
:param window_size_fma: The window size of the moving average calculation | ||
:param num_of_traces: The number of traces being processed | ||
:returns: The result of the DPA calculation | ||
|
||
.. method:: calculate_second_order_dpa_mem_efficient(traces, IV, window_width): | ||
|
||
Efficient implementation of second order DPA | ||
|
||
:param traces: The power traces to be processed. | ||
:param IV: Intermediate algorithm values associated with the power traces | ||
:param window_width: The window size of the moving average calculation | ||
:returns: The result of the DPA calculation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,6 @@ Library Features | |
fileformat.rst | ||
cwscope.rst | ||
metrics.rst | ||
leakagemodels.rst | ||
leakagemodels.rst | ||
dpa.rst | ||
lecroy.rst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,119 @@ | ||
Lecroy Oscilloscope Interface | ||
============================= | ||
============================= | ||
|
||
.. class:: LecroyScope | ||
|
||
.. method:: __init__(self, scope_ip='TCPIP0::192.168.1.79::inst0::INSTR'): | ||
|
||
Create a LecroyScope object | ||
|
||
:param scope_ip: The IP of the scope that you want to connect to | ||
|
||
.. method:: __del__(self): | ||
|
||
Close the scope on object deletion. | ||
|
||
:return: None | ||
|
||
.. method:: open(self, scope_ip, scope_timeout=5000): | ||
|
||
Opens a Lecroy scope using the PyVisa library | ||
|
||
:param scope_ip: The ip of the Lecroy scope | ||
:param scope_timeout: The amount of time to wait for the Lecroy until timeout | ||
:return: None | ||
|
||
.. method:: close(self): | ||
|
||
Closes the Lecroy scope using the PyVisa library | ||
|
||
:return: None | ||
|
||
.. method:: setup(self, v_div, timebase, samplerate, duration, v_offset, channel): | ||
|
||
Sets up the Lecroy scope for trace capture | ||
|
||
:param v_div: voltage scale per division | ||
:param timebase: the timescale for the scope | ||
:param samplerate: the rate in which measurements are sampled | ||
:param duration: the duration of capture | ||
:param v_offset: the voltage offset for the measurement | ||
:param channel: the channel to capture the traces on | ||
:return: None | ||
|
||
.. method:: set_trigger(self, delay, level, channel='C1'): | ||
|
||
Set the trigger for the trace capture | ||
|
||
:param delay: the trigger delay | ||
:param level: the trigger level | ||
:param channel: the trigger channel | ||
:return: None | ||
|
||
|
||
.. method:: start_trigger(self) | ||
|
||
Tells the LecroyScope to start the trigger based on the parameters set in LecroyScope.set_trigger | ||
|
||
|
||
.. method:: get_trigger(self): | ||
|
||
Returns the trigger status | ||
|
||
:return: A string representing the trigger status | ||
|
||
.. method:: wait_for_trigger(self): | ||
|
||
Waits for the Lecroy trigger | ||
|
||
:return: True if successful, False if the trigger timeout | ||
|
||
.. method:: get_channel(self, samples, short, channel='C3'): | ||
|
||
Get the measurement data from the Lecroy from specified channel | ||
|
||
:param samples: The number of samples to record | ||
:param short: | ||
:param channel: The channel to collect data from | ||
:return: The data from the scope | ||
|
||
.. method:: reset(self): | ||
|
||
Resets the scope | ||
|
||
.. method:: scope_setup(channel='C3', trig_channel='C1', num_of_samples=200, sample_rate=500E6, short=False, v_div=2.5E-3, trg_delay="0", trg_level="1.65V", v_offset='0'): | ||
|
||
Higher level setup function. Sets up a Lecroy Scope object for power trace collection. | ||
|
||
:param channel: the channel that records power trace measurements | ||
:param trig_channel: the trigger channel | ||
:param num_of_samples: the number of samples to capture | ||
:param sample_rate: the rate in which samples are captured | ||
:param short: | ||
:param v_div: the voltage scale per division | ||
:param trg_delay: the trigger delay | ||
:param trg_level: the trigger level | ||
:param v_offset: the voltage offset | ||
:return: the fully configured scope object | ||
|
||
.. method:: dut_setup(board="CW305", fpga_id='100t', bitfile=None) | ||
|
||
Sets up a target board for trace capture | ||
:param board: The DUT type (CW305 or pico) | ||
:param fpga_id: the FPGA id for CW305 target | ||
:param bitfile: the bitfile for CW305 target | ||
:return: The configured target | ||
|
||
|
||
.. method:: capture_cw305(scope, target, num_of_samples=600, short=False, channel='C3', plaintext=None, key=None): | ||
|
||
Captures traces on the CW305 target board | ||
|
||
:param scope: The configured LecroyScope object | ||
:param target: The configured CW305 target board | ||
:param num_of_samples: The number of samples to capture | ||
:param short: | ||
:param channel: The channel to collect traces on | ||
:param plaintext: The plaintext for the encryption algorithm | ||
:param key: The key for the encryption algorithm | ||
:return: the recorded trace and algorithm output |