이번 tutorial은 Firmware build setup에 대해서 소개하고 있다.
This tutorial will introduce you to the software side of ChipWhisperer, including the tutorials themselves. It will also show you how to perform different operations on data based on input from the ChipWhisperer software. This can be used for building your own system which you wish to 'break'. All the %%bash blocks can be run either in Jupyter or in your favourite command line environment (note that Jupyter resets your path between blocks).
If you haven't run through !!Introduction_to_Jupyter!!.ipynb do that now.
Assuming you've done that, we can get started on the tutorial.
이 튜토리얼은 tutorial을 포함한 ChipWhisperer의 Software 측면에 대한 소개를 한다. 또한 ChipWhisperer SW의 입력에 기초한 data에 대해 다른 operation을 수행할 수 있는 방법을 보여준다. 이것은 SW사용자가 'break' 하고 싶은 자신만의 system을 구축하는데 사용될 수 있다. 또한 모든 %%bash 블록은 Jupyter 또는 당신이 선호하는 command line 환경에서 수행 될 수 있다.
1.1 What is SimpleSerial
다음은 SimpleSerial에 대한 설명이다. 여기서 설명하는 SimpleSerial은 통신 프로토콜을 말하며, tutorial에 설명되어있는 내용을 해석하면 다음과 같다.
SimpleSerial is the communications protocol used for almost all of the ChipWhisperer demo project. It's a very basic serial protocol which can be easily implemented on most systems. This system communicates using a standard asyncronous serial protocol, 38400 baud, 8-N-1.
All messages are sent in ASCII-text, and are normally terminated with a line-feed ('\n'). This allows you to interact with the simpleserial system over a standard terminal emulator.
SimpleSerial이란, 거의 모든 ChipWhisperer demo project에 사용되는 통신 프로토콜이다. 이것은 대부분의 system에서 쉽게 구현할 수 있는 매우 기본적인 serial protocol이다. 이 system은 표준 비동기적 serial protocol, 38400 baud, 8-N-1을 사용하여 통신한다.
모든 message는 ASCII text로 전송되며 일반적으로 줄바꿈 '\n'으로 종료된다. 이를 통해 표준 termial emulator를 통해 단순 serial system과 상호작용 할 수 있다.
위 설명을 요약해보자.
'x'는 buffers를 재설정하며, system을 초기화하는데 사용되는 stream이다.
'k'는 system의 암호화 key를 load하는데 사용한다. 만약, k를 호출하지 않으면 system은 default key를 사용할 수 있다.
'p'는 'k'명렁으로 load된 key를 사용하여 data를 암호화한다.
'r'은 'p'로 암호화 된 data에 대하여 자동으로 응답하는 sequence이다. 예제를 통해 암호의 결과가 cbbd4a2b34f2571758ff6a797e09859d 임을 알 수 있다.
1.2 Building the Basic Example
다음은 Building에 대한 기초 예제를 설명하며 예시 코드를 참고 할 수 있다.
To bulid the basic example, you'll need an appropriate compiler for your target. For the ChipWhisperer Lite/Xmega platform, you'll need avr-gcc and avr-libc, while if you're using an ARM target (like the ChipWhisperer Lite/STM32 platform), your need the GNU Toolchain for ARM devices. If you're using a target with a different architecture, you'll need to install the relevant compiler. If you're unsure, you can run the block below. If you've got the right stuff installed, you should see some version and copyright info printed for the relevant compiler:
원문에서 알 수 있듯이, basic example를 설명하려면 target에 적합한 compiler가 필요하다. ChipWhisperer Lite와 Xmega platform의 경우는 'avr-gcc' 와 'avr-libc'이 필요하고, ARM target(ChipWhisperer Lite/STM32 platform)을 사용하는 경우 ARM 장치에 대한 GNU Toolchain이 필요하다. 상황에 맞게 필요한 compiler를 install 하자.
상황에 맞게 필요한 compiler를 install 하였으면, 아래 블록을 실행한다.
실행하면, 다음과 같이 compiler에 대한 정보와 copyright에 대한 정보가 print 된다. 올바르게 print 되었다면 다음 단계로 넘어가자.
Now that you have the relevant toolchain installed, you should be able to build firmware for your desired platform. We'll begin by creating a new project based on simpleserial-base by making a new firmware and copying the files from the project we want to work on:
올바른 toolchain을 설치하였다고 가정하자, 그렇다면 원하는 platform에 대한 펌웨어를 빌드 할 수 있다. 이때, 새로운 펌웨어를 만들고 작업하기를 희망하는 project에서 file들을 복사한다. 그리하여 simpleserial-base를 기반으로한 새로운 project를 만드는 것으로 시작한다. 아래의 코드는 이를 시행하는 코드이다.
Next we'll build the firmware. You'll need to specify the PLATFORM and CRYPTO_TARGET for your target. To save you from having to re-enter this info in every make block, you can edit the python below with your platform and crypto_target.
Common platforms are CWLITEXMEGA and CWLITEARM. To see a list of platforms leave PLATFORM as is.
This tutorial doesn't use any crypto, so we can leave CRYPTO_TARGET as NONE.
이제 펌웨어를 빌드하자. 아래 코드는 펌웨어를 빌드하는 코드이다. target에 대한 PLATFORM과 CRYPTO_TARGET을 명시해주자. 모든 make block의 정보를 다시 입력하지 않아도 되도록, platform과 crypto_target을 사용하여 아래 코드를 편집할 수 있다. 이때 이 tutorial은 암호화를 하지 않으므로 아래 코드와 같이 "NONE"한다.
이상으로 ChipWhisperer Firmware Build Setup을 마친다.
이 게시글은 NewAE technology사에서 제공하는 ChipWhisperer의 tutorial 오픈소스(Open Source) 기반으로 작성하였으며,
게시물에 해당하는 내용에 관한 정보는 다음과 같은 출처를 통해서 확인할 수 있습니다.
출처1 : https://chipwhisperer.readthedocs.io/en/latest/
출처2 : https://wiki.newae.com/Main_Page
출처3 : https://github.com/newaetech/chipwhisperer