• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..10-Feb-2022-

common/H10-Feb-2022-31083

smc/H10-Feb-2022-1,0231,021

test/H10-Feb-2022-2,0761,748

wolfssl/H10-Feb-2022-733731

README_EN.mdH A D10-Feb-202210.7 KiB243171

README_JP.mdH A D10-Feb-202213.6 KiB250170

include.amH A D10-Feb-20221.5 KiB2625

README_EN.md

1wolfSSL sample application project for GR-ROSE evaluation board
2======
3
4<br>
5
6## 1. Overview
7-----
8
9We provide a sample program for evaluating wolfSSL targeting the GR-ROSE evaluation board, which has RX65N MCU on it. The sample program runs in a bare metal environment that does not use a real-time OS and uses e2 studio as an IDE. This document describes the procedure from build to execution of the sample program.
10
11The sample provided is a single application that can evaluate the following three functions:
12
13- CryptoTest: A program that automatically tests various cryptographic operation functions
14- Benchmark: A program that measures the execution speed of various cryptographic operations
15- TlsClient: A program that performs TLS communication with the opposite TLS server application
16<br><br>
17
18Since the H/W settings and S/W settings for operating the evaluation board have already been prepared, the minimum settings are required to operate the sample application. In addition, the RootCA certificate and server-side certificate required for TLS communication have already been set for sample use only.
19
20The following sections will walk you through the steps leading up to running the sample application.
21<br><br>
22
23## 2. Target H/W, components and libraries
24-----
25
26This sample program uses the following hardware and software libraries. If a new version of the software component is available at the time of use, please update it as appropriate.
27
28|item|name & version|
29|:--|:--|
30|Board|GR-ROSE|
31|Device|R5F565NEHxFP|
32|IDE| Renesas e2Studio Version:2021-10 |
33|Emulator| E1, E2 Emulator Lite |
34|Toolchain|CCRX v3.03.00|
35|TSIP| TSIP v1.14|
36<br>
37
38The project of this sample program has a configuration file that uses the following FIT components.
39However, the FIT components themselves are not included in the distribution of this sample application. You need to download it by operating in the IDE. Some FIT components (TSIPs) cannot be downloaded directly from within the IDE and may need to be downloaded separately from the Renesas download site.
40<br>
41
42|FIT component|version|name|
43|:--|:--|:--|
44|Board Support Packages|6.21|r_bsp|
45|CMT driver|4.90|r_cmt_rx|
46|Ethernet Driver|1.21|r_ether_rx|1.21|r_ether_rx|
47|Generic system timer for RX MCUs|1.01|r_sys_time_rx|
48|TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx|
49|TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx|
50|TSIP(Trusted Secure IP) driver|1.14|r_tsip_rx|
51<br>
52
53Note) As of December 2021, TIPS v1.14 does not seem to be able to be added as a FIT component by adding a component in the Smart Configurator Perspective. Add it manually along the method described later.
54<br><br>
55
56## 3. Importing sample application project into e2Studio
57----
58
59There is no need to create a new sample program. Since the project file is already prepared, please import the project from the IDE by following the steps below.
60
61+ e2studio "File" menu> "Open project from file system ..."> "Directory (R) ..." Click the import source button and select the folder from which the project will be imported. Select the folder (Renesas/e2studio/\<MCU>/\<borad-name-folder\>/)) where this README file exists.
62+ Four projects that can be imported are listed, but check only the three projects "smc", "test" and "wolfssl" and click the "Finish" button.
63
64You should see the **smc**, **test**, and **wolfssl** 3 projects you imported into the project explorer.
65<br><br>
66
67## 4. FIT module download and smart configurator file generation
68----
69
70You will need to get the required FIT modules yourself. Follow the steps below to get them.
71
721. Open the smc project in Project Explorer and double-click the **smc.scfg** file to open the Smart Configurator Perspective.
73
742. Select the "Components" tab on the software component settings pane. Then click the "Add Component" button at the top right of the pane. The software component selection dialog will pop up. Click "Download the latest version of FIT driver and middleware" at the bottom of the dialog to get the modules. You can check the dowmload destination folder by pressing "Basic settings...".
75
763. The latest version of the TSIP component may not be automatically obtained due to the delay in Renesas' support by the method in step 2 above. In that case, you can download it manually from the Renesas website. Unzip the downloaded component and store the files contained in the FIT Modules folder in the download destination folder of step 2.
77
784. Select the required FIT components shown from the list and press the "Finish" button. Repeat this operation until you have the required FIT components.
79
805. Select the Components tab on the Software Component Settings pane and select the r_t4_rx component. In the settings pane on the right, specify the IP address of this board as the value of the "# IP address for ch0, when DHCP disable." Property (e.g. 192.168.1.9).
81
826. Press the "Generate Code" button at the top right of the software component settings pane to have the smart configurator generate the source files. A src/smc_gen folder will be created under the smc project to store source files, libraries, etc.
83
84<br><br>
85
86## 5. Adding smc_gen files to the test project
87----
88
89The test project is a sample application project. When you open the test project in the project explorer, there is a src folder, which contains the source files of the sample application. Add the source files by copying and pasting the smc_gen folder generated in the step5, directly under this src folder.
90
91Make sure you have a folder hierarchy like this:
92
93```
94<board-name-folder>/test/src/smc_gen
95```
96<br>
97
98## 6. Select the behavior of the test application
99----
100
101The test project is a single sample application, but you can specify to perform one of the following by switching the settings:
102
103- CryptoTest: A program that automatically tests various encryption operation functions
104- Benchmark: A program that measures the execution speed of various cryptographic operations
105- TlsClient: A program that performs TLS communication with the opposite TLS server application
106
107Open the <board-name-folder\>/test/src/wolfssl_demo.h file and enable one of the following definitions:
108
109- #define CRYPT_TEST
110- #define BENCHMARK
111- #define TLS_CLIENT
112
113Then build the test application.
114<br><br>
115
116
117## 7. Build and run the test application
118-----
119
120Now that the test application is ready to build.
121
1221. Build the wolfssl project on the project explorer, then the test project.
123
1242. After a successful build, connect the target board to the emulator and supply external power.
125
1263. Select "Run" menu> "Debug" to open the debug perspective.
127
1284. The test application outputs the operating status to the standard output. Keep the "Renesas Debug Virtual Console" open for viewing this standard output.
129
1305. Press the run button to run the test application.
131
1326. CryptoTest, Benchmark or TLS_Client After displaying the execution result according to the selected behavior, it enters an infinite loop, so if you think that the output has stopped, stop debugging.
133<br><br>
134
135## 8. Running test application as TLS_Client
136-----
137<br>
138### 8.1 Generate a server application
139
140To operate as TLS_Client, an opposite application for TLS communication is required. A wolfSSL package provides a server sample application that you can use for this purpose. This program is generated by building wolfssl. You can build wolfSSL on Linux (including MacOS and WSL) with gcc installed or build using Visual Studio. The following introduces the build on WSL.
141<br><br>
142
143```
144$ cd <wolfssl-folder>
145$ ./autogen.sh
146$ ./configure CFLAGS="-DWOLFSSL_STATIC_RSA -DHAVEAES_CBC"
147$ make
148```
149
150<br>
151
152With the above build, <wolfssl-folder\>/examples/server/server
153Is generated. This executable acts as a TLS server application. If you execute it with the following options, it will be in the listening state for the connection from TLS_Client.
154<br><br>
155
156```
157$ examples/server/server -b -d -i
158```
159<br>
160
161For the test application, specify the IP address assigned to the server application.
162
163Open wolf_client.c to specify ip address of the server in "#define SIMPLE_TLSSEVER_IP" like as:
164<br>
165
166```
167-- <board-name-folder>/test/src/wolf_client.c --
168
169...
170#define SIMPLE_TLSSEVER_IP  192.168.53.9
171...
172```
173<br>
174Save the file and rebuild the test application. When you run the test application, it makes a TLS connection with the opposite application, then exchanges a simple string and displays the following on the standard output.
175<br><br>
176
177```
178cipher : ECDHE-RSA-AES128-GCM-SHA256
179Received: I hear you fa shizzle!
180
181cipher : ECDHE-RSA-AES128-SHA256
182Received: I hear you fa shizzle!
183
184cipher : AES128-SHA256
185Received: I hear you fa shizzle!
186
187cipher : AES256-SHA256
188Received: I hear you fa shizzle!
189
190cipher : ECDHE-RSA-AES128-SHA256
191Received: I hear you fa shizzle!
192
193cipher : ECDHE-RSA-AES128-GCM-SHA256
194Received: I hear you fa shizzle!
195```
196<br>
197
198### 8.2 Change server certificate (change authentication method)
199<br>
200The above is an execution example when the server certificate presented by the server application contains the RSA public key (RSA authentication). TSIP can also handle cases where the server certificate contains an ECC public key (ECDSA authentication).
201
202<br>
203If you want to use a cipher suite that includes ECDSA, you will need to change the settings of the test application and rebuild. Open common/ user_settings.h, enable the USE_ECC_CERT definition and rebuild.
204<br><br>
205
206```
207-- <board-name-folder>/common/user_settings.h --
208
209#define USE_ECC_CERT
210```
211<br>
212This definition causes the test application to use a RootCA certificate that can validate the server certificate containing the ECC public key presented by the server.
213
214<br>
215In addition, the opposite server application also needs to specify the server certificate and private key file containing the ECC public key as an option, and then execute it as shown below.
216<br><br>
217
218```
219$ ./examples/server/server -b -d -i -c ./certs/server-ecc.pem -k ./certs/ecc-key.pem
220```
221<br>
222The following is displayed as the execution result.
223<br> <br>
224
225```
226cipher : ECDHE-ECDSA-AES128-SHA256
227Received: I hear you fa shizzle!
228
229cipher : ECDHE-ECDSA-AES128-GCM-SHA256
230Received: I hear you fa shizzle!
231```
232<br>
233
234## 9. What you need to do to use the RootCA certificate prepared by the user
235----
236
237In this sample program, the RootCA certificate required to operate as TLS_Client and the server certificate used by the sample TLS server application are certificates that can be used only for evaluation.
238If you want to use it for purposes beyond functional evaluation, you need to prepare the RootCA certificate yourself. with this,
239  1. Provisioning key
240  2. RSA key pair required for RootCA certificate validation
241  3. The signature generated by the RootCA certificate with the private key in 2 above.
242
243will become necessary. Please refer to the manual provided by Renesas for how to generate them. 

README_JP.md

1評価ボードGR-ROSE 用 wolfSSLサンプルプロジェクト
2======
3
4<br>
5
6## 1. 概要
7-----
8
9Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットとしてwolfSSLを評価するためのサンプルプログラムを提供します。サンプルプログラムはリアルタイムOSを使わないベアメタル環境で動作し、IDEとしてe2 studioを使用するものです。本ドキュメントではサンプルプログラムのビルドから実行までの手順を説明します。
10
11提供するサンプルプログラムは次の3機能を評価できる単一のアプリケーションです:
12
13- CryptoTest: 各種暗号化オペレーション機能を自動テストするプログラム
14- Benchmark: 各種暗号化オペレーションの実行速度を測定するプログラム
15- TlsClient: 対向するTLSサーバーアプリケーションとTLS通信を行うプログラム
16
17評価ボードを動作させる為のH/W設定、S/W設定は既に用意していますから、サンプルプロジェクトの動作までは最少の設定で済むようになっています。また、TLS通信において必要となる、RootCA証明書、サーバー側証明書もサンプル使用に限定したものが既に設定済みです。
18
19以降のセクションはサンプルアプリケーションの実行までのステップを順に説明していきます。
20<br><br>
21
22
23## 2. ターゲットとしているH/W、コンポーネント、ライブラリ
24-----
25
26このサンプルプログラムでは以下のハードウエアやソソフトウエアライブラリを使用しています。皆さんがご利用時にバージョンの新しいソフトウエアコンポーネントが利用可能であれば適宜更新の上ご利用ください。
27<br><br>
28
29|要素|名称/バージョン|
30|:--|:--|
31|評価ボード|GR-ROSE|
32|Device|R5F565NEHxFP|
33|IDE| Renesas e2Studio Version:2021-10 |
34|エミュレーター| E1, E2エミュレーターLite |
35|Toolchain|CCRX v3.03.00|
36|TSIP| TSIP v1.14|
37<br>
38
39本サンプルプログラムのプロジェクトには以下のFITコンポーネントを使用する設定ファイルが用意されています。
40しかし、FITコンポーネント群そのものは本サンプルアプリケーションの配布物としては含まれていません。皆さん自身でIDE内の操作によってダウンロードしていただく必要があります。一部のFITコンポーネント(TSIP)はIDE内から直接ダウンロードできず、Renesas社のダウンロードサイトから別途ダウンロードが必要なものがあります。
41<br><br>
42
43
44
45|FITコンポーネント|バージョン|略称|
46|:--|:--|:--|
47|Board Support Packages|6.21|r_bsp|
48|CMT driver|4.90|r_cmt_rx|
49|Ethernet Driver|1.21|r_ether_rx|1.21|r_ether_rx|
50|Generic system timer for RX MCUs|1.01|r_sys_time_rx|
51|TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx|
52|TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx|
53|TSIP(Trusted Secure IP) driver|1.14|r_tsip_rx|
54
55(注意)2021年12月現在、TIPSv1.14はFITコンポーネントとしてスマートコンフィギュレータパースペクティブのコンポーネントの追加操作では追加できないようです。後ほど説明する手動での追加方法を使って追加してください。<br>
56
57
58<br><br>
59
60## 3. サンプルプログラムプロジェクトのe2Studioへのインポート
61----
62
63サンプルプログラムは新規作成する必要はありません。すでにプロジェクトファイルが用意されていますからIDEから以下の手順でプロジェクトをインポートしてください。
64
65
66+ 1.e2studioの"ファイル"メニュー > "ファイル・システムからプロジェクトを開く..." > "ディレクトリ(R)..."インポート元ボタンを押して、プロジェクトのインポート元となるフォルダーを選択します。本READMEファイルが存在するフォルダ(Renesas/e2studio/\<MCU>/\<borad-name-folder\>/))を選択してください。
67
68+ インポートできるプロジェクトが4つリストアップされますが、"smc", "test" と"wolfssl"の3プロジェクトにのみチェックを入れて”終了”ボタンを押してください。
69
70プロジェクト・エクスプローラーにインポートしたsmc,test,wolfsslの3プロジェクトが表示されるはずです。
71<br><br>
72
73## 4. FITモジュールの取得とスマートコンフィギュレータによるファイル生成
74----
75
76FITモジュールは皆さん自身で取得していただく必要があります。以下の手順で取得してください。
77<br><br>
78
79
801. プロジェクト・エクスプローラー上でsmcプロジェクトを開き**smc.scfg**ファイルをダブルクリックして、スマートコンフィギュレータパースペクティブを開きます。
81
822. ソフトウエアコンポーネント設定画面の"コンポーネント"タブを選択 > 画面右上の"コンポーネントの追加" ボタンを押して下さい。ソフトウエアコンポーネントの選択ダイアログが表示されます。ここで、画面下部の"最新版のFITドライバとミドルウエアをダウンロードする"を押して、モジュール群を取得しておいてください。ダウンロード先のフォルダは"基本設定..."を押して確認することができます。
83
843. TSIPコンポーネントは上記ステップ2の方法ではRenesas社の対応が遅れていて最新版が自動的には取得できないことがあります。その場合にはRenesas社のサイトから手動でダウンロードできます。ダウンロードしたコンポーネントのを解凍し、FITModulesフォルダに含まれているファイル群をステップ2のダウンロード先フォルダに格納してください。
85
864.  先に示したFITコンポーネントを一覧から選択して"終了"ボタンを押します。この操作を必要なFITコンポーネントを得るまで繰り返し行います。
87
885.  ソフトウエアコンポーネント設定画面のコンポーネントタブを選択し、r_t4_rxコンポーネントを選択します。右の設定ペインに"# IP address for ch0, when DHCP disable."プロパティの値として、このボードのIPアドレスを皆さんの環境に合わせてて指定します(例:
89192.168.1.9)。
90
916. ソフトウエアコンポーネント設定画面の右上の”コードの生成"ボタンを押して、スマートコンフィギュレータにソースファイルを生成させます。smcプロジェクトの下にsrc/smc_genフォルダが生成され、ソースファイル、ライブラリ等が格納されされます。
92<br><br>
93
94## 5. testプロジェクトへのsmc_genファイル群の追加
95----
96
97testプロジェクトはサンプルアプリケーションのプロジェクトです。プロジェクト・エクスプローラー上でtestプロジェクトを開くとsrcフォルダが存在し、そこにサンプルアプリケーションのソースファイルが格納されています。このsrcフォルダ直下に4-5で生成したsmc_genフォルダごとコピー&ペーストしてソースファイルを追加します。
98
99test/src/smc_gen
100
101のようなフォルダ階層になることを確認してください。
102<br><br>
103
104## 6. testアプリケーションの動作を選択する
105----
106testプロジェクトが唯一のサンプルアプリケーションですが、その動作を設定で切り替えることによって、
107
108- CryptoTest: 各種暗号化オペレーション機能を自動テストするプログラム
109- Benchmark: 各種暗号化オペレーションの実行速度を測定するプログラム
110- TlsClient: 対向するTLSサーバーアプリケーションとTLS通信を行うプログラム
111
112のいずれかの動作を行うよう指定できます。
113
114設定はtest/src/wolfssl_demo.h ファイル内の、
115
116- #define CRYPT_TEST
117- #define BENCHMARK
118- #define TLS_CLIENT
119
120のいずれか一つを有効にしてアプリケーションをビルドすることで行います。
121<br><br>
122
123
124## 7. testアプリケーションのビルドと実行
125-----
126
127testアプリケーションのビルドの準備が整ったので、ビルドを行います。
128
1291.プロジェクト・エクスプローラー上のwolfsslプロジェクトをビルドし、次にtestプロジェクトをビルドします。
130
1312.ビルドが成功したら、ターゲットボードとエミュレーターを接続し、外部電源を入力します。
132
1333."実行"メニュー > "デバッグ"を選択し、デバッグパースペクティブを開きます。
134
1354. testアプリケーションは標準出力に動作状況を出力します。この標準出力の表示用に、"Renesas Debug Virtual Console"を開いておきます。
136
1375.実行ボタンを押してtestアプリケーションを動作させます。
138
1396.CryptoTest、BenchmarkあるいはTLS_Client選択していた動作に応じた実行結果を表示したあと無限ループに入るので出力が停止したと思われたらデバッグを停止させます。
140<br><br>
141
142## 8. TLS_Clientとしてのtestアプリケーションの実行
143-----
144<br>
145
146### 8.1 TLS対向アプリケーションの生成と実行
147<br>
148
149testアプリケーションをTLS_Clientとしての動作を行わせる場合には、TLS通信の相手方となる対向アプリケーションが必要となります。wolfSSLパッケージにはこの用途に使用できるTLSserverサンプルアプリケーションが用意されています。このプログラムはwolfsslをビルドすることで生成されます。wolfSSLのビルドにはgccがインストールされているLinux(MacOS, WSLも含む)でのビルドとVisualStudioを使ってのビルドが可能です。以下ではWSL上でのビルドを紹介します。
150<br><br>
151
152```
153$ cd <wolfssl-folder>
154$ ./autogen.sh
155$ ./configure CFLAGS="-DWOLFSSL_STATIC_RSA -DHAVEAES_CBC"
156$ make
157```
158
159<br>
160上記のビルドによって、<wolfssl-folder\>/examples/server/server
161が生成されます。この実行プログラムがサーバーアプリケーションとして機能します。以下のオプションを与えて実行させるとTLS_Clientからの接続を待ち受け状態になります。
162<br><br>
163
164```
165$ examples/server/server -b -d -i
166```
167<br>
168testアプリケーションには、サーバーアプリケーションに割り当てられたIPアドレスを指定します。
169
170wolf_client.cを開き、#define SIMPLE_TLSSEVER_IPにアドレスを指定します。
171
172```
173-- wolf_client.c --
174
175...
176#define SIMPLE_TLSSEVER_IP  192.168.53.9
177...
178```
179<br>
180ファイルをセーブしてtestアプリケーションを再ビルドしてください。testアプリケーションを実行すると、対向アプリケーションとの間でTLS接続が行われ、その後簡単な文字列を交換して標準出力に以下のような表示を行います。
181<br><br>
182
183```
184cipher : ECDHE-RSA-AES128-GCM-SHA256
185Received: I hear you fa shizzle!
186
187cipher : ECDHE-RSA-AES128-SHA256
188Received: I hear you fa shizzle!
189
190cipher : AES128-SHA256
191Received: I hear you fa shizzle!
192
193cipher : AES256-SHA256
194Received: I hear you fa shizzle!
195
196cipher : ECDHE-RSA-AES128-SHA256
197Received: I hear you fa shizzle!
198
199cipher : ECDHE-RSA-AES128-GCM-SHA256
200Received: I hear you fa shizzle!
201```
202<br>
203
204### 8.2 サーバー証明書の変更(認証方式の変更)
205
206<br>
207上記はサーバーアプリケーションが提示すサーバー証明書にRSA公開鍵が含まれている(RSA認証)場合の実行例です。TSIPにはこのほかにサーバー証明書にECC公開鍵を含む場合(ECDSA認証)も扱えます。
208
209<br>
210ECDSAを含む暗号化スイートを使用したい場合には、testアプリケーションの設定を変更して再ビルドが必要となります。\<board-name-folder\>/common/user_settings.h を開き、USE_ECC_CERT定義を有効化して再ビルドしてください。
211<br><br>
212
213```
214#define USE_ECC_CERT
215```
216
217<br>
218この定義により、testアプリケーションはサーバーの提示するECC公開鍵を含んだサーバー証明書を検証できるRootCA証明書を使うようになります。
219<br><br>
220
221さらに対向するサーバーアプリケーションの方でも以下のようにECC公開鍵を含んだサーバー証明書と秘密鍵ファイルをオプションで指定して実行する必要があります。
222<br><br>
223
224```
225$ ./examples/server/server -b -d -i -c ./certs/server-ecc.pem -k ./certs/ecc-key.pem
226```
227<br>
228実行結果として以下が表示されます。
229<br><br>
230
231```
232cipher : ECDHE-ECDSA-AES128-SHA256
233Received: I hear you fa shizzle!
234
235cipher : ECDHE-ECDSA-AES128-GCM-SHA256
236Received: I hear you fa shizzle!
237```
238<br>
239
240## 9. ユーザーが用意したRootCA証明書を利用する際に必要なこと
241-----
242
243本サンプルプログラムでは、TLS_Clientとして動作する際に必要なRootCA証明書とサンプルTLSサーバーアプリケーションが使用するサーバー証明書などは評価用でのみ利用可能な証明書です。
244機能評価を超えた目的で利用する場合にはRootCA証明書をユーザー自身で用意する必要があります。それに伴い、
245 1. Provisioning key
246 2. RootCA証明書の検証の為に必要なRSA鍵ペア
247 3. RootCA証明書を上記2の秘密鍵で生成した署名
248
249が必要になります。それらの生成方法はRenesas社提供のマニュアルを参照してください。
250