Changes

Tutorial B3-1 Timing Analysis with Power for Password Bypass

1,034 bytes removed, 03:18, 18 September 2017
no edit summary
<li>Make a copy of an existing ChipWhisperer script. The example scripts are located at <code>chipwhisperer\software\chipwhisperer\capture\scripts</code>; for example, the default one for the XMEGA device is called <code>setup_cwlite_xmega.py</code>. Make a copy of this script in the same directory (or copy it somewhere else
</li>
<li><p>Rename the script something else - for example, <code>cwlite-passwordcrack.py</code> - and open it for editing. You'll notice that a large chunk of the code is used to set the parametersconfiguration information:</p><pre>#Example of using a list to set parametersscope. Slightly easier to copy/paste in this formatgain.gain = 45lstexample scope.adc.samples = [['CW Extra', 'CW Extra Settings', 'Trigger Pins', 'Target IO4 (Trigger Line)', True],25000 ['CW Extra', 'CW Extra Settings', 'Target IOn Pins', 'Target IO1', 'Serial RXD'], ['CW Extra', 'CW Extra Settings', 'Target IOn Pins', 'Target IO2', 'Serial TXD'], ['OpenADC', 'Clock Setup', 'CLKGEN Settings', 'Desired Frequency', 7370000scope.adc.offset = 0], ['CW Extra', 'CW Extra Settings', 'Target HS IO-Out', 'CLKGEN'],scope.adc.basic_mode = "rising_edge" ['OpenADC', 'Clock Setup', 'ADC Clock', 'Source', 'CLKGEN x4 via DCM'],scope.clock.clkgen_freq = 7370000 ['OpenADC', 'Trigger Setup', 'Total Samples', 3000],scope.clock.adc_src = "clkgen_x4" ['OpenADC', 'Trigger Setup', 'Offset', 1500],scope.trigger.triggers = "tio4" ['OpenADC', 'Gain Setting', 'Setting', 45], ['OpenADC', 'Trigger Setup', 'Mode', 'rising edge'], #Final step: make DCMs relock in case they are lost ['OpenADC', 'Clock Setup', 'ADC Clock', 'Reset ADC DCM', None], ]</pre><p>Those parameters come from the ''Scripting Parameters'' tabscope. Switch over to it and notice this tab logs all of the parameter changes, showing you how to change the parameters through the API:</p>io.tio1 = "serial_rx"<blockquote><p>[[File:Scriptcommandsscope.png|image]]</p></blockquote>io.tio2 = "serial_tx"<p>Note that commands run via the script are also printed, so you can see where the values being set are coming from tooscope. </p>io.hs2 = "clkgen"</lipre>
<li><p>At this point, close Those parameters come from the ''ChipWhisperer-Capture'' window so we API. You can confirm print for example the script still worksscope parameters by running "self. Run the new script (which doesn't have any changes yet) from the command line. You may have scope" to open a console with Python in the pathsee various elements:</p><blockquotep><ol style="list-style-type: lower-roman;"pre><li>If you installed WinPython, run the ''WinPython Console'' from your WinPython installation directory.</li><li>If using the VMWare image of a Linux machine, this should just be a regular console</li></ol>self.scope</blockquote></li></ol>cwlite Device<blockquote>Run the script with <code>python cwlite-passwordcrackgain = mode = low gain = 45 db = 22.py</code>50390625adc = state = False basic_mode = rising_edge timeout = 2 offset = 0 presamples = 0 samples = 25000 decimate = 1 trig_count = 3084728877clock = adc_src = clkgen_x4 adc_phase = 0 adc_freq = 29538459 adc_rate = 29538459 adc_locked = True freq_ctr = 0 freq_ctr_src = extclk clkgen_src = system extclk_freq = 10000000 clkgen_mul = 2 clkgen_div = 26 clkgen_freq = 7384615 clkgen_locked = Truetrigger = triggers = tio4 module = basicio = tio1 = serial_rx tio2 = serial_tx tio3 = high_z tio4 = high_z pdid = high_z pdic = high_z nrst = high_z glitch_hp = 0 glitch_lp = 0 extclk_src = hs1 hs2 = clkgen target_pwr = Trueglitch = clk_src = target width = 10. If the script errors out, it might be that the location of the FPGA bitstream is stored in relative terms. To fix this perform the following:15625<blockquote><ol style width_fine ="list-style-type: lower-roman;">0<li>Open ChipWhisperer-Capture regularly offset = 10.</li>15625 offset_fine = 0 trigger_src = manual arm_timing = after_scope ext_offset = 0 repeat = 1 output = clock_xor<li>Run the ChipWhisperer script that you used previously.</lipre><li>Select ''Tools--&gt;Config CW Firmware''</li><li>Under the &quot;FPGA .zip (Release)&quot;, hit the &quot;Find&quot; button. Point the system to the file <code>chipwhisperer/hardware/capture/chipwhisperer-lite/cwlite_firmware.zip</code> on your filesystem. Note by default there is a relative path.</li></ol></blockquote></blockquote>
<ol start="4" style="list-style-type: decimal;">
Approved_users, bureaucrat, administrator
1,956
edits