|
| 1 | +wolfSSL simple application projects for SK-S7G2 board |
| 2 | +====== |
| 3 | + |
| 4 | +## 1. Overview |
| 5 | +----- |
| 6 | + |
| 7 | +This repository provides simple sample applications for evaluating wolfSSL on the SK-S7G2 evaluation board (R7FS7G27H3A01CFC, S7G2 MCU). The samples run on Express Logic ThreadX (a real-time operating system) and use NetX/NetX Driver for networking and the SSP-provided drivers for the SK-S7G2 board. |
| 8 | + |
| 9 | +The sample package includes applications that demonstrate the following functions: |
| 10 | + |
| 11 | +- Crypto Test: Automatically runs tests for various cryptographic operations. |
| 12 | +- Benchmark: Measures execution speed for various cryptographic operations. The benchmark also includes TCP and TLS client tests against a peer server. |
| 13 | + |
| 14 | +Because the required hardware and software configurations for the evaluation board are already prepared, only minimal setup is needed to run the samples. |
| 15 | + |
| 16 | +The following sections will walk you through the steps leading up to running the sample application. |
| 17 | + |
| 18 | +## 2. Target H/W, components and libraries |
| 19 | +----- |
| 20 | + |
| 21 | +This sample program uses the following hardware and software libraries. If a new version of any component is available, update it as appropriate. |
| 22 | + |
| 23 | +| item | name & version | |
| 24 | +|:--|:--| |
| 25 | +| Board | SK-S7G2 Starter Kit | |
| 26 | +| Device | R7FS7G27H3A01CFC | |
| 27 | +| IDE | Renesas e2Studio — Version: 2025-01 (25.1.0) | |
| 28 | +| Toolchain | GNU Arm Embedded Toolchain (arm-none-eabi-gcc), e.g. Arm GNU Toolchain 13.3.Rel1 (build arm-13.24) | |
| 29 | +| SSP | 2.7.0 | |
| 30 | + |
| 31 | +The project includes a configuration file that references the following software components. These components are not bundled with this sample; you must download or install them via the e2studio Smart Configurator. |
| 32 | + |
| 33 | +| Component | version | |
| 34 | +|:--|:--| |
| 35 | +| Board support package for R7FS7G27H3A01CFC | 2.7.0 | |
| 36 | +| Board Support Packages | 2.7.0 | |
| 37 | +| SSP Common Code | 2.7.0 | |
| 38 | +| Clock Generation Circuit: Provides=[CGC] | 2.7.0 | |
| 39 | +| Event Link Controller: Provides=[ELC] | 2.7.0 | |
| 40 | +| Factory MCU Information Module: Provides=[FMI] | 2.7.0 | |
| 41 | +| I/O Port: Provides=[IO Port] | 2.7.0 | |
| 42 | +| S7G2_SK Board Support Files | 2.7.0 | |
| 43 | +| Express Logic ThreadX: Provides=[ThreadX] | 2.7.0 | |
| 44 | +| Secure Cryptography Engine: Provides=[TRNG, AES, HASH, RSA, DSA, TDES, ARC4, ECC, KEY_INSTALLATION] | 2.7.0 | |
| 45 | +| Express Logic NetX Synergy Port: Provides=[NetX Driver], Requires=[NetX] | 2.7.0 | |
| 46 | +| General Purpose Timer: Provides=[Timer, GPT] | 2.7.0 | |
| 47 | +| Real Time Clock: Provides=[RTC] | 2.7.0 | |
| 48 | +| Express Logic NetX: Provides=[NetX], Requires=[ThreadX, NetX Driver] | 2.7.0 | |
| 49 | + |
| 50 | +> Note: Hardware-accelerated algorithms supported on this board (via the Secure Cryptography Engine / SSP): |
| 51 | +> |
| 52 | +> - True Random Number Generator (TRNG) |
| 53 | +> - SHA-256 |
| 54 | +> - AES in ECB mode: AES-128, AES-192, AES-256 |
| 55 | +> |
| 56 | +> To use the hardware accelerators, enable the "Secure Cryptography Engine" component in the e2studio Smart Configurator and click "Generate Code". On the wolfSSL side, hardware SCE support is enabled with the `WOLFSSL_SCE` compile-time option. In this sample, `WOLFSSL_SCE` is defined in the `user_settings.h` file included in the `wolfSSL_SKS7G2` project (for example: `#define WOLFSSL_SCE`), so the sample will use the Secure Cryptography Engine for the primitives listed above. To force software fallbacks for testing, remove the `WOLFSSL_SCE` define from `user_settings.h` or disable the Secure Cryptography Engine component. |
| 57 | +
|
| 58 | +## 3. Importing sample application project into e2Studio |
| 59 | +---- |
| 60 | +There is no need to create a new project. Since the project file is already prepared, import the project from the IDE by following the steps below. |
| 61 | + |
| 62 | +- In e2studio: File > Open Project from File System... > Directory (R) ... Click the import source button and select the folder containing the project to import. |
| 63 | +- Four projects are listed for import. Select only the three projects: `wolfbenchmark_test`, `wolfcrypt_test`, and `wolfssl_SKS7G2`, then click Finish. |
| 64 | + |
| 65 | +You should see the `wolfbenchmark_test`, `wolfcrypt_test`, and `wolfssl_SKS7G2` projects in Project Explorer. |
| 66 | + |
| 67 | +## 4. Smart configurator file generation |
| 68 | +---- |
| 69 | +Follow the steps below: |
| 70 | + |
| 71 | +1. Open the `wolfssl_SKS7G2` project in Project Explorer and double-click the `configuration.xml` file to open the Smart Configurator perspective. |
| 72 | +2. Click the "Generate Code" button in the Smart Configurator (top-right of the component settings pane) to generate the required source files. This creates a `src/synergy_gen` folder under the project. |
| 73 | + |
| 74 | +## 5. Build and run wolfcrypt_test application |
| 75 | +----- |
| 76 | +1. Build the `wolfssl_SKS7G2` project in Project Explorer, then build the `wolfcrypt_test` project. |
| 77 | +2. After a successful build, connect the target board to your PC via USB. |
| 78 | +3. Select Run > Debug to open the Debug perspective. |
| 79 | +4. The application outputs operating status to standard output. Keep the "Renesas Debug Virtual Console" open to view this output. |
| 80 | +5. Press the Run button to start the application. |
| 81 | +6. After displaying the crypto test result, the application enters an infinite loop. If output stops, stop debugging. |
| 82 | + |
| 83 | +## 7. Running benchmark application |
| 84 | +----- |
| 85 | + |
| 86 | +### 7.1 Prepare TCP server as a peer |
| 87 | +The benchmark application includes a TCP client. You can use [this TCP server application](https://github.com/wolfSSL/wolfssl-examples/blob/master/tls/server-tcp.c) as the peer server. |
| 88 | + |
| 89 | +``` |
| 90 | +$ gcc server-tcp.c -o server-tcp |
| 91 | +$ ./server-tcp |
| 92 | +``` |
| 93 | + |
| 94 | +You can modify the server IP address and port. Those are defined in `app_entry.c` based on your environment: |
| 95 | + |
| 96 | +``` |
| 97 | +#define SERVER_IP IP_ADDRESS(192,168,3,10) |
| 98 | +#define TLS_PORT 11112 |
| 99 | +#define TCP_PORT 11111 |
| 100 | +``` |
| 101 | + |
| 102 | +### 7.2 Prepare TLS server as a peer |
| 103 | +The benchmark application also includes a TLS client. You can use the wolfSSL example TLS server as the peer server: |
| 104 | + |
| 105 | +``` |
| 106 | +$ git clone https://github.com/wolfSSL/wolfssl.git |
| 107 | +$ cd wolfssl |
| 108 | +$ ./autogen.sh |
| 109 | +$ ./configure |
| 110 | +$ make |
| 111 | +$ ./examples/server/server -bdi -p 11112 -v d |
| 112 | +``` |
| 113 | + |
| 114 | +The `-b` option binds the server to all network interfaces (instead of localhost only). |
| 115 | +The `-d` option disables client authentication. |
| 116 | +The `-i` option makes the server loop indefinitely (allow repeated connections). |
| 117 | +The `-p` option sets the port number. |
| 118 | +The `-v` option sets the TLS version. The `d` value allows a downgrade to TLS 1.2 if a TLS 1.3 connection cannot be established. |
| 119 | + |
| 120 | +### 7.3 Run benchmark application on the board |
| 121 | +After building and running the benchmark on the board, the client connects to the server over TCP, exchanges a simple string, and prints output to the Renesas Debug Virtual Console similar to: |
| 122 | + |
| 123 | +``` |
| 124 | +Pinging server to see if up .. got response from server |
| 125 | +Benchmarking client TCP connection |
| 126 | +Trying to connect to 0xC0A8030A on port 11111 |
| 127 | +100 TCP connections took 0.XXXXXX seconds |
| 128 | +``` |
| 129 | + |
| 130 | +You will also see messages on the server console: |
| 131 | + |
| 132 | +``` |
| 133 | +$ ./server-tcp |
| 134 | +Waiting for a connection... |
| 135 | +Client connected successfully |
| 136 | +Client: Hello Server |
| 137 | +
|
| 138 | +Waiting for a connection... |
| 139 | +``` |
| 140 | + |
| 141 | +For TLS benchmark, you will see messages like: |
| 142 | + |
| 143 | +``` |
| 144 | +Benchmarking client TLSv1.2 connection using ECDHE-RSA-AES128-GCM-SHA256 |
| 145 | +Trying to connect to 0xC0A8030A on port 11112 |
| 146 | +100 TLS connections took YYY.XXXXXX seconds (and ZZZ.XXXXXX tx_time ticks) |
| 147 | +
|
| 148 | +Benchmarking client TLSv1.3 WOLFSSL_ECC_X25519 connection using TLS13_AES128_GCM_SHA256 |
| 149 | +Trying to connect to 0xC0A8030A on port 11112 |
| 150 | +100 TLS connections took YYY.XXXXXX seconds (and ZZZ.XXXXXX tx_time ticks) |
| 151 | +
|
| 152 | +Benchmarking client TLSv1.3 WOLFSSL_ECC_SECP256R1 connection using TLS13_AES128_GCM_SHA256 |
| 153 | +Trying to connect to 0xC0A8030A on port 11112 |
| 154 | +100 TLS connections took YYY.XXXXXX seconds (and ZZZ.XXXXXX tx_time ticks) |
| 155 | +
|
| 156 | +Benchmarking client TLSv1.3 WOLFSSL_FFDHE_2048 connection using TLS13_AES128_GCM_SHA256 |
| 157 | +Trying to connect to 0xC0A8030A on port 11112 |
| 158 | +100 TLS connections took YYY.XXXXXX seconds (and ZZZ.XXXXXX tx_time ticks) |
| 159 | +``` |
| 160 | + |
| 161 | +On the server console you may see: |
| 162 | + |
| 163 | +``` |
| 164 | +$ ./examples/server/server -bdi -p 11112 -v d |
| 165 | +listening on port 11112 |
| 166 | +SSL version is TLSv1.2 |
| 167 | +SSL cipher suite is TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 |
| 168 | +SSL curve name is SECP256R1 |
| 169 | +... |
| 170 | +SSL version is TLSv1.3 |
| 171 | +SSL cipher suite is TLS_AES_128_GCM_SHA256 |
| 172 | +SSL curve name is X25519 |
| 173 | +... |
| 174 | +SSL version is TLSv1.3 |
| 175 | +SSL cipher suite is TLS_AES_128_GCM_SHA256 |
| 176 | +SSL curve name is SECP256R1 |
| 177 | +... |
| 178 | +SSL version is TLSv1.3 |
| 179 | +SSL cipher suite is TLS_AES_128_GCM_SHA256 |
| 180 | +SSL curve name is FFDHE_2048 |
| 181 | +``` |
| 182 | + |
| 183 | +Finally, the application runs cryptographic benchmarks. You will see output like: |
| 184 | + |
| 185 | +``` |
| 186 | +wolfCrypt Benchmark (block bytes 1024, min 1.0 sec each) |
| 187 | +... |
| 188 | +Benchmark complete |
| 189 | +``` |
| 190 | + |
| 191 | +# 8. Support |
| 192 | +---- |
| 193 | +For support inquiries, email [email protected]. For Japanese support, contact [email protected]. |
0 commit comments