|
|
(26 intermediate revisions by 4 users not shown) |
Line 1: |
Line 1: |
− | <span class="expandall">
| + | == Page Moved == |
| | | |
− | The ChipWhisperer-Lite Bare Board consists of two main parts: a multi-purpose power analysis capture instrument, and a target board. The target board is a standard microcontroller which you can implement algorithms onto. For example if you wish to evaluate an AES library, you can program that library into the target board and perform the power analysis.
| + | See [https://rtfm.newae.com/Capture/ChipWhisperer-Lite/ NewAE RTFM Page]. The previous content on this wiki has been moved to the above link. See wiki history if you would like to view exact older versions of this page. |
− | | + | |
− | [[File:cwlite_basic.png|image]]
| + | |
− | | + | |
− | = Quick-Start Guide =
| + | |
− | | + | |
− | You can see a [http://www.youtube.com/watch?v=MJmkYqA-LeM&hd=1 Video] of the quickstart guide, which will take you through all the setup items discussed here:
| + | |
− | | + | |
− | [[File:cwlite_demo_video.png|YouTubeCW1173Demo]]_
| + | |
− | | + | |
− | == Connection Quick-Start ==
| + | |
− | | + | |
− | <ol style="list-style-type: decimal;">
| + | |
− | <li>Install Python and Dependancies
| + | |
− | <dl>
| + | |
− | <dt>Windows:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li>Install Python distribution (such as WinPython), see [[Installing_WinPython]]</li>
| + | |
− | <li><p>Using the Python Command Prompt, use pip to install the following:</p>
| + | |
− | <pre>pip install pyside
| + | |
− | pip install configobj
| + | |
− | pip install pyusb
| + | |
− | pip install pyqtgraph </pre></li></ul>
| + | |
− | | + | |
− | <blockquote><p>What is included in releases varies. If you get a message saying it is already installed you can simply continue with this tutorial.</p></blockquote></dd>
| + | |
− | <dt>Linux:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li><p>Python should come pre-installed. If so you'll also need to install the following from your package manager:</p>
| + | |
− | <blockquote><ul>
| + | |
− | <li>pyside</li>
| + | |
− | <li>configobj</li>
| + | |
− | <li>scipy</li>
| + | |
− | <li>numpy</li></ul>
| + | |
− | | + | |
− | <p>For example the following shows the install command for Ubuntu:</p>
| + | |
− | <pre>sudo apt-get install python2.7 python2.7-dev python2.7-libs python-numpy python-scipy python-pyside python-configobj python-setuptools python-pip</pre></blockquote></li>
| + | |
− | <li><p>Some packages may require installation via 'pip', as they are not always in your package manager repo:</p>
| + | |
− | <pre>$pip install pyusb
| + | |
− | $pip install pyqtgraph </pre></li></ul>
| + | |
− | </dd>
| + | |
− | <dt>Mac OS-X:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li>Install homebrew, pyside, libusb, along with required Python modules.</li>
| + | |
− | <li>See [[MacOSX_Installation]] for full details.</li></ul>
| + | |
− | </dd></dl>
| + | |
− | </li>
| + | |
− | <li><p>Download and install ChipWhisperer</p>
| + | |
− | <ul>
| + | |
− | <li>Download the latest release linked from ChipWhisperer.com</li>
| + | |
− | <li>Unzip the file somewhere. Generally 'somewhere' will become your ChipWhisperer working directory. These examples assume you've chosen <code>C:\chipwhisperer</code> as your working directory.</li>
| + | |
− | <li><p>Open a Python terminal (again if using WinPython be sure to run the specific Python command prompt), and run the following, adjusting paths as needed to refelct your working directory:</p>
| + | |
− | <pre>cd c:\chipwhisperer\openadc\controlsw\python
| + | |
− | python setup.py develop
| + | |
− | cd c:\chipwhisperer\software
| + | |
− | python setup.py develop</pre></li></ul>
| + | |
− | | + | |
− | <blockquote><p>If you wish to confirm the installation worked, you can run ChipWhispererAnalyzer in the same terminal:</p>
| + | |
− | <pre>cd c:\chipwhisperer\software\chipwhisperer
| + | |
− | python CWAnalyzer.pyw</pre></blockquote></li>
| + | |
− | <li>Connect ChipWhisperer-Lite, install USB Drivers:
| + | |
− | <dl>
| + | |
− | <dt>Windows:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li>Plug micro-USB cable into ChipWhisperer-Lite</li>
| + | |
− | <li>If the "New Hardware Found" wizard doesn't prompt you for drivers, go to the control panel and find the "ChipWhisperer-Lite" device, and select "Update Drivers".</li>
| + | |
− | <li>You can find drivers in <code>c:\chipwhisperer\hardware\capture\chipwhisperer-lite\</code>. You will likely need to extract them from the <code>cwlite_usb_driver.zip</code> file. If so simply extract them somewhere (i.e. your desktop), and then point the new hardware found wizard to that location.</li></ul>
| + | |
− | </dd>
| + | |
− | <dt>Linux:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li><p>Driver installation is not required, but if you do not update the 'udev' system, you will be unable to run ChipWhisperer-Capture as a regular user. To update the udev system, first make sure the ChipWhisperer-Lite is Make a file called <code>/etc/udev/rules.d/99-cwlite.rules</code> . The contents of this file should be:</p>
| + | |
− | <pre># allow users to claim the device
| + | |
− | SUBSYSTEM=="usb", ATTRS{idVendor}=="2b3e", ATTRS{idProduct}=="ace2", MODE="0664", GROUP="plugdev"</pre></li>
| + | |
− | <li><p>Add your username to the plugdev group:</p>
| + | |
− | <pre>$ sudo usermod -a -G plugdev YOUR-USERNAME</pre></li>
| + | |
− | <li><p>And reset the udev system:</p>
| + | |
− | <pre>$ sudo udevadm control --reload-rules</pre></li>
| + | |
− | <li>Finally log out & in again for the group change to take effect.</li>
| + | |
− | <li>Connect the micro-USB cable</li></ul>
| + | |
− | </dd>
| + | |
− | <dt>MAC:</dt>
| + | |
− | <dd><ul>
| + | |
− | <li>No special installation required - must ensure you have installed libusb via homebrew (see instructions at [[MacOSX_Installation]]).</li></ul>
| + | |
− | </dd></dl>
| + | |
− | </li>
| + | |
− | <li><p>Run ChipWhisperer-Capture. This can be done from one of three ways:</p>
| + | |
− | <blockquote><ul>
| + | |
− | <li>Double-click on <code>CWCapture.pyw</code> in the <code>chipwhisperer\software</code> folder. You must have installed Python into your path for this to work.</li>
| + | |
− | <li>run <code>python CWCapture.pyw</code> from the <code>chipwhisperer\software</code> folder using a command prompt with Python in the path.</li>
| + | |
− | <li>run <code>python CWCaptureGUI.py</code> from the <code>chipwhisperer\software\chipwhisperer\capture\ui</code> directory.</li></ul>
| + | |
− | | + | |
− | <p>The last option is the most reliable, in that it should always work on all platforms. If it doesn't start look for possible missing modules or other useful errors.</p>
| + | |
− | <blockquote><p>'''hint'''</p>
| + | |
− | <p>The first time you run ChipWhisperer-Capture or -Analyzer, the default setup of the screen is somewhat insane. You can drag windows around or close them to make it look more like the demos here. See the Video quickstart guide as well for details of that.</p></blockquote></blockquote></li>
| + | |
− | <li><p>From the "Scripts" directory, run the <code>ChipWhisperer-Lite: AES SimpleSerial on XMEGA</code> script:</p>
| + | |
− | <p>[[File:cwlite_simpleserial.png|image]]</p>
| + | |
− | <p>This should connect to the ChipWhisperer-Lite, program the FPGA, and run a few captures. Your screen should look something like this now:</p>
| + | |
− | <p>[[File:cwdemo_normal.png|image]]</p></li>
| + | |
− | <li><p>If the previous step fails, you may need to set the path for the "firmware". This is done by going to the "Tools" menu and selecting the "Config CW Firmware" option. Note on MAC OS X a special command is required instead sometimes, see [[MacOSX_Installation]].</p>
| + | |
− | <p>From there, hit the "FIND" button beside the "FPGA .zip (Release)" option. Point it to the file located at <code>chipwhisperer/hardware/capture/chipwhisperer-lite/cwlite_firmware.zip</code> on your filesystem.</p></li>
| + | |
− | <li>Your ChipWhisperer-Lite is now connected. See the next section for details of the demo attack.</li></ol>
| + | |
− | | + | |
− | == Capture and Attack Quickstart ==
| + | |
− | | + | |
− | # See [[Tutorial_B5_Breaking_AES_(Straightforward)]]for details. Note the hardware setup is slightly different -- but you can skip to step 5.5.3, and should be able to pick up from there. Be sure to use the <code>ChipWhisperer-Lite: AES SimpleSerial on XMEGA</code> script instead of the one referenced in step 5.5.3.
| + | |
− | | + | |
− | == Important Bugs/Caveats ==
| + | |
− | | + | |
− | The following includes various things that might trip you up:
| + | |
− | | + | |
− | # If you save the project ''before'' running the capture, you can specify any directory. Traces will be copied to the appropriate location during capture.
| + | |
− | # If you save the project ''after'' running the capture, you must save the project to the same directory that "default-data-dir" exists in. This is normally the folder from where you invoked the Python GUI.
| + | |
− | # There are a few warnings/exceptions that come up (i.e. divide-by-zero). Generally just keep going and see if things are still working. A number of those are on the ''TODO'' list to fix but I didn't get around to it yet.
| + | |
− | # The "Total Ops" window which checks for proper AES operation requires PyCrypto to be installed.
| + | |
− | # By default the XMEGA device was programmed with a partial AES implementation only. This is done to avoid any crypto export issues. This does not affect your side-channel analysis, but be aware the returned value might not appear to be correct (since only the first couple rounds of AES occurred).
| + | |
− | | + | |
− | = Basic Usage Instructions =
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == AVR Programmer ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/AVR Programmer}}
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == XMEGA Programmer ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/XMEGA Programmer}}
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == Using Glitch Port ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/Glitch Port}}
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == Using Measure Port ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/Measure Port}}
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == 20-Pin Connector ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/20-Pin Connector}}
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == 8-Pin SmartCard Connector ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/8-Pin SmartCard Connector}}
| + | |
− | | + | |
− | == Upgrading SAM3U Firmware ==
| + | |
− | | + | |
− | When talking about the ChipWhisperer-Lite's firmware, there is really two parts to this:
| + | |
− | | + | |
− | # The FPGA Bitstream file.
| + | |
− | # The SAM3U USB interface chip firmware.
| + | |
− | | + | |
− | The FPGA bitstream alone is what is normally configured by the ChipWhisperer-Capture software. This bitstream is always the most up-to-date, since it's automatically reloaded by the computer every time you power cycle the ChipWhisperer-Capture. The SAM3U firmware however is not automatically updated, but it tends to change less frequently.
| + | |
− | | + | |
− | === Checking Firmware Version ===
| + | |
− | | + | |
− | The firmware version is printed at start-up. You will see a line that looks like this indicating the version of the SAM3U Firmware:
| + | |
− | | + | |
− | <pre>Found CW-Lite, Serial Number = 442031204630xxxxxxxxxxx
| + | |
− | SAM3U Firmware version = 0.11 b0
| + | |
− | Programmed FPGA</pre>
| + | |
− | If your firmware version is outdated, a warning will be printed. You can also see the firmware version in the ''Config CW Firmware'' dialog:
| + | |
− | | + | |
− | <blockquote>[[File:sam3fwver.png|image]]
| + | |
− | </blockquote>
| + | |
− | Note the main version is 0.11 in this example. The "b0" indicates a "build" number. Typically this will be "build 0", but special versions will use a different build number to indicate a variant of a regular version.
| + | |
− | | + | |
− | === Upgrading Firmware ===
| + | |
− | | + | |
− | Before updating, you must put your ChipWhisperer-Lite into bootloader mode. Once put into this mode you will need to load a new firmware file. There is two ways of doing it: the ''automatic'' method, and the ''manual'' method. The automatic method is done through the GUI, and works if you have valid firmware image loaded. The ''manual'' method is always guaranteed to work.
| + | |
− | | + | |
− | The automatic method is:
| + | |
− | | + | |
− | Using ChipWhisperer-Capture GUI
| + | |
− | | + | |
− | # Connect to the ChipWhisperer-Lite.
| + | |
− | # From the ''Tools'' menu select ''Config CW Firmware''
| + | |
− | # Select the ''Open SAM3U Update Widget'' button.
| + | |
− | # Press the ''Enable Bootloader Mode'' button.
| + | |
− | # You will get an error, and the ChipWhisperer-Lite will disconnect. This is normal, and indicates the USB mode changed suddenly.
| + | |
− | # The blue LED will stop flashing, and the device will reconnect in programmer mode (see below).
| + | |
− | | + | |
− | Once you are in bootloader mode, both the blue and red LED will be very dimmly lit:
| + | |
− | | + | |
− | [[File:lights_prog.jpg|400px]]
| + | |
− | | + | |
− | This indicates it is in bootloader mode. The device will now attach as a serial port. If you are using Windows this may take a few minutes to happen.
| + | |
− | | + | |
− | If using Linux, you can use ''dmesg'' to verify the serial port was connected OK.
| + | |
− | | + | |
− | If this doesn't work, see the page [[Manual SAM3U Firmware Update]] for details on how to manually enter bootloader mode. You can return to this page for the actual programming - you don't need to install/use the BOSSA utility if you follow those manual directions. You simply need to force the system into bootloader mode using those directions.
| + | |
− | | + | |
− | To actually program the file, we use the second part of the dialog box you already had open:
| + | |
− | | + | |
− | [[File:sam3uupdate.png|400px]]
| + | |
− | | + | |
− | Once we are in bootloader mode, you can follow these steps:
| + | |
− | | + | |
− | # Hit "Update List", and select the serial port the SAM3U attached as.
| + | |
− | # To use the default firmware file, leave the "Built-in" radio-box selected. If you want a custom firmware you can select the "External" mode.
| + | |
− | # Hit the "Run Program" button
| + | |
− | # Once completed, unplug/replug your device and it should come to life.
| + | |
− | # Close the update widgets, and reconnect to your ChipWhisperer-Lite.
| + | |
− | | + | |
− | === Manual Update ===
| + | |
− | | + | |
− | If the above instructions fail, there is no big problem. The SAM3U chip contains a hardware-resident bootloader. You may need to follow instructions on the [[Manual SAM3U Firmware Update]] page (including using BOSSA) if you are unable to use the automatic system that is part of ChipWhisperer-Capture.
| + | |
− | | + | |
− | {{CollapsibleSection
| + | |
− | |intro = == Breaking Target Section Apart ==
| + | |
− | |content= CW1173_ChipWhisperer-Lite/Breaking Target Section Apart
| + | |
− | }}
| + | |
− | | + | |
− | = Advanced Usage =
| + | |
− | | + | |
− | == Mounting Jumpers ==
| + | |
− | | + | |
− | Note the ChipWhisperer-Lite main board and target section contain a number of jumper options. By default these are not mounted, and solder jumper bridges on the PCB have been bridged to select the appropriate options when required. Some options are only solder jumpers, which to move the jumper requires a soldering iron to bridge or clear the appropriate connections.
| + | |
− | | + | |
− | The following lists jumpers on the ChipWhisperer-Lite / Target Section:
| + | |
− | | + | |
− | ; Capture Section Jumpers
| + | |
− | * JP4 is the "RESET" net for the SAM3U processor.
| + | |
− | * JP2 causes the SAM3U processor flash memory to be erased. When the chip is erased a rom-resident bootloader takes over. See section XXXXX for bootloader details.
| + | |
− | * JP5 selects the IO voltage for the FPGA bank which connects to the 20-pin target. By default SJ6 selects this to be 3.3V. It is not recommended to change this, as it is easy to damage the FPGA by feeding an out-of-range voltage in.
| + | |
− | * SJ1 selects if the power supply comes from the Micro-USB connector (default) or an external 5V supply at the +5VIN pin.
| + | |
− | ; Target Section Jumpers:
| + | |
− | * JP7 connects the "MEASURE" SMA to the XMEGA VCC Rail. Shorted by default with SJ4.
| + | |
− | * JP6 connects the "GLITCH" SMA to the XMEGA VCC Rail. Shorted by default with SJ5.
| + | |
− | * JP12 can be used to feed an external voltage into the XMEGA VCC Rail. By default SJ3 connects this to 3.3V.
| + | |
− | * SJ2 selects if the 3.3V rail comes from the 20-pin IDC connector (i.e. ChipWhisperer-Lite board), or via an optional LDO and USB connector.
| + | |
− | | + | |
− | </span>
| + | |
− | | + | |
− | {{Template:Hardware}}
| + | |