As of August 2020 the site you are on (wiki.newae.com) is deprecated, and content is now at rtfm.newae.com.

Changes

Jump to: navigation, search

Tutorial B2 Viewing Instruction Power Differences

2,380 bytes removed, 22:19, 17 September 2017
Capturing Power Traces
{{Warningbox|This tutorial has been updated for ChipWhisperer 4.0.0 release. If you are using 3.x.x see the "V3" link in the sidebar.}}
 
{{Infobox tutorial
|name = B2: Viewing Instruction Power Differences
|image =
|caption =
|software versions =
|capture hardware = CW-Lite, CW-Lite 2-Part, CW-Pro
|Target Device =
|Target Architecture = XMEGA
|Hardware Crypto = No
|Purchase Hardware =
}}
 
This tutorial will introduce you to measuring the power consumption of a device under attack. It will demonstrate how you can view the difference between a 'add' instruction and a 'mul' instruction.
/* End user-specific code here. *
********************************/</source></li>
<li><p>Change the terminal to the directory with your source, and run <code>makePLATFORM=CW303</code> to build the system. Remember you can press the up arrow on the keyboard to get recently typed commands in most OSes:</p><pre>makePLATFORM=CW303</pre>
<p>Which should have the following output, you will '''want to check the build platform is what you expect''':</p>
<pre>...Bunch of lines removed...
<ol style="list-style-type: decimal;">
<li>Start ChipWhisperer-Capture</li>
<li>Under the ''Generic SettingsPython Console'' tab, as find the ''Scope Moduleconnect_cwlite_simpleserial.py'', select the ''ChipWhisperer/OpenADC'' optionscript and double-click.</li><li>Under ''Generic Settings'' tab, as Check there are no errors on the ''Target Module'', select the ''Simple Serial'' optionconnection.</li><li>Switch to Under the ''Target SettingsPython Console'' tab, and as find the ''connection'', select the ''ChipWhisperer'' (for CW1002) or ''NewAE USB (CWLite/CW1200)'' (for ChipWhisperer Lite/Pro)setup_cwlite_xmega.</li><li>Switch to the py''Scope Settings'' tab, script and ensure the ''connection'' is set to either ''ChipWhisperer'' (for CW1002) or ''NewAE USB (CWLite/CW1200)'' (for ChipWhisperer Lite/Pro)double-click.</li><li>Run the master connect (click the button labeled ''Master: DIS''). Both the Target &amp; Scope should switch to ''CON'' and be green circles.</li><li><p>For the CW1173/CW1180/Cw1200 (ChipWhisperer-Lite/Pro based systems), perform the following:</p><blockquote><ol style="list-style-type: lower-alpha;"><li>Set the ''CLKGEN'' frequency to ''7.37 MHz''</li><li>Set the ''Target HS-IO Out'' as ''CLKGEN''</li></ol></blockquote></li><li>If targetting an XMEGA board (either the ChipWhisperer-Lite XMEGA default target, or the XMEGA on the multi-target board), perform the following:<ol style="list-style-type: lower-alpha;"><li>Set ''Target IO1'' as ''Serial RXD''</li><li>Set ''Target IO2'' as ''Serial TXD''</li></ol></li><li>Open the status monitor (<i>Tools > Encryption Status Monitor</i>).</li></olli; 10. Hit the ''Run 1'' [[File:Capture One Button.PNG|image]] button. You may have to hit it a few times, as the very first serial data is often lost. You should see data populate in the ''Text Out'' field of the monitor window. The ''Text In'' and ''Text Out'' aren't actually used in this example, so you can close the ''Monitor'' dialog.</li>
At this point you've completed the same amount of information as the previous tutorial. The following section describes how to setup the analog capture hardware, which is new (to you). The following is entirely done in the ''Scope Settings'' tab:
 
[[File:01_trigger_setupxcf.PNG|image]]
 
<ol start="11" style="list-style-type: decimal;">
<li>Under ''Trigger Setup'' set the ''Mode'' to ''rising edge''. This means the system will trigger on a rising edge logic level:</li></ol>
 
[[File:02_CW_Extra.PNG|image]]
 
{{Warningbox|Beginning of a hardware specific section for CW1002}}
 
<blockquote><ol start="12" style="list-style-type: decimal"><li>For the CW1002 (ChipWhisperer Capture Rev 2) hardware only, perform the following:</li>
<ol style="list-style-type: lower-alpha;">
<li>Under the ''Trigger Pins'' unselect the ''Front Panel A'' as an option, and select ''Target IO4 (Trigger Line)''. This will mean only the trigger pin coming from the AVR target is used to trigger the capture.</li>
<li><p>In the same area, select the ''Clock Source'' as being from ''Target IO-IN''</p>
<p>[[File:03_ADC_Clock.png|image]]</p></li>
<li>You can monitor the ''Freq Counter'' option, which measures the frequency being used on the ''EXTCLK'' input. This should be 7.37 MHz, which is the oscillator on the multi-target board.</li>
<li>Change the ''ADC Clock'' ''source'' as being ''EXTCLK x4 via DCM''. This routes the external clock through a 4x multiplier, and routes it to the ADC.</li></ol></ol>
</blockquote>
 
{{Warningbox|End of CW1002 (ChipWhisperer Capture Rev 2) specific section}}
<br>
 
<ol start="12" style="list-style-type: decimal;">
 
<li>For the CW1173/CW1180/Cw1200 (ChipWhisperer-Lite/Pro based hardware), perform the following:</li></ol>
 
<blockquote><ol start="4" style="list-style-type: lower-alpha;">
<li>Change the ''ADC Clock'' ''source'' as being ''CLKGEN x4 via DCM''. This routes the device clock through a 4x multiplier, and routes it to the ADC.</li></ol>
</blockquote>
<ol start="13" style="list-style-type: decimal;">
<li>Hit the '''Reset ADC DCM''' button.</li>
[[File:04_ADC_Clock_2_1.png|image]]</ol>
<ol start="148" style="list-style-type: decimal;">
<li>The ''ADC Freq'' should show 29.5 MHz (which is 4x 7.37 MHz), and the ''DCM Locked'' checkbox __MUST__ be checked. If the ''DCM Locked'' checkbox is NOT checked, try hitting the ''Reset ADC DCM'' button again.</li>
<li><p>At this point you can hit the ''Capture 1'' button, and see if the system works! You should end up with a window looking like this:</p>
<ol start="16" style="list-style-type: decimal;">
<li>Under ''Gain Setting'' set the ''Mode'' to ''high''. Increase the ''Gain Setting'' to about 25. You'll be able to adjust this further during experimentations, you may need to increase this depending on your hardware and target device. For the multi-target board with the CW1002 you will probably need to set this around 40.</li>
<li>Under ''Trigger Setup'' set the ''Total Samples'' to ''500''.</li>
<li>Try a few more ''Capture 1'' traces, and you should see a 'zoomed-in' waveform.</li></ol>
Approved_users, bureaucrat, administrator
1,956
edits

Navigation menu