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

Difference between revisions of "Tutorial P1 Using a Custom Trigger"

From ChipWhisperer Wiki
Jump to: navigation, search
(The beginning of a pro specific tutorial)
 
Line 46: Line 46:
 
</li>
 
</li>
 
<li>
 
<li>
Modify this code by commenting out the <code>trigger_high();</code> and <code>trigger_low();</code> to remove the signal produced by the target to tell the ChipWhisperer it is starting the encryption process. Your c ocde should look like this:
+
Modify this code by commenting out the <code>trigger_high();</code> and <code>trigger_low();</code> to remove the signal produced by the target to tell the ChipWhisperer it is starting the encryption process. Your c code should look like this:
 
<syntaxhighlight lang="c">
 
<syntaxhighlight lang="c">
 
/**********************************
 
/**********************************

Revision as of 13:25, 23 May 2017

This page is in progress

This tutorial will explore the ChipWhisperer Pro's custom trigger and stream features.

Prerequisites

This tutorial can only be completed using the CW1200_ChipWhisperer-Pro. The ChipWhisperer software and its prerequisites should be installed. If not, this is the page for you: Installing ChipWhisperer. This tutorial is an extension of Tutorial B1 Building a SimpleSerial Project and Tutorial B5 Breaking AES (Straightforward), which should be completed first for better understanding.

Introduction

Unique to the CW1200_ChipWhisperer-Pro's more advanced FPGA, the stream feature allows continuous power measurement data streaming, removing the upper limit (due to a smaller FPGA) of total samples possible. This allows to you to continuously stream data for a time period in which you can manually send data to the target to record the power response. You can later find the subsection of sample points in the streamed power trace that correspond to the encryption of data. You can now use a subsection of 128 sample points to create a custom trigger using the sum of differences (TODO: link to subsequent section). This eliminates the need for the target to have a code that signals the ChipWhisperer when encryption begins. The subset of points for triggering is chosen by you, so anything is possible... We will explore one possibility in this tutorial.

Building the Target Code

We will begin by modifying the simpleserial-aes.c code with a editor of your choice.

  1. Navigate to the ChipWhisperer installation directory and find the simpleserial-aes folder, the folder is in the ...\chipwhisperer\hardware\victims\firmware directory. The beginning of the file path may be different depending on the installation directory.
  2. Copy the simpleserial-aes folder into the same directory and rename it as you see fit. For example: simpleserial-aes-stream.
  3. Now open the simpleserial-aes-stream folder and rename the simpleserial-aes.c file to match the directory name change. For example: simpleserial-aes-stream.c
  4. Open the simpleserial-aes-stream.c file in the text editor of your choice and find this section of the code near the top.
    /**********************************
     * Start user-specific code here. */
    uint8_t get_pt(uint8_t* pt)
    {
    	trigger_high();
    	aes_indep_enc(pt); /* encrypting the data block */
    	trigger_low();
    	simpleserial_put('r', 16, pt);
    	return 0x00;
    }
    /* End user-specific code here. *
     ********************************/
    
  5. Modify this code by commenting out the trigger_high(); and trigger_low(); to remove the signal produced by the target to tell the ChipWhisperer it is starting the encryption process. Your c code should look like this:
    /**********************************
     * Start user-specific code here. */
    uint8_t get_pt(uint8_t* pt)
    {
    	//trigger_high();
    	aes_indep_enc(pt); /* encrypting the data block */
    	//trigger_low();
    	simpleserial_put('r', 16, pt);
    	return 0x00;
    }
    /* End user-specific code here. *
     ********************************/