mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-29 18:27:29 +02:00
Merge pull request #5054 from miyazakh/tsipV1p15_grose
Update Renesas TSIP version to 1.15 on GR-ROSE
This commit is contained in:
@ -29,10 +29,10 @@ This sample program uses the following hardware and software libraries. If a new
|
||||
|:--|:--|
|
||||
|Board|GR-ROSE|
|
||||
|Device|R5F565NEHxFP|
|
||||
|IDE| Renesas e2Studio Version:2021-10 |
|
||||
|IDE| Renesas e2Studio Version:2022-01 |
|
||||
|Emulator| E1, E2 Emulator Lite |
|
||||
|Toolchain|CCRX v3.03.00|
|
||||
|TSIP| TSIP v1.14|
|
||||
|TSIP| TSIP v1.15|
|
||||
<br>
|
||||
|
||||
The project of this sample program has a configuration file that uses the following FIT components.
|
||||
@ -47,10 +47,10 @@ However, the FIT components themselves are not included in the distribution of t
|
||||
|Generic system timer for RX MCUs|1.01|r_sys_time_rx|
|
||||
|TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx|
|
||||
|TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx|
|
||||
|TSIP(Trusted Secure IP) driver|1.14|r_tsip_rx|
|
||||
|TSIP(Trusted Secure IP) driver|1.15.l|r_tsip_rx|
|
||||
<br>
|
||||
|
||||
Note) 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.
|
||||
Note) As of April 2022, TIPS v1.15 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.
|
||||
<br><br>
|
||||
|
||||
## 3. Importing sample application project into e2Studio
|
||||
|
@ -30,10 +30,10 @@ Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットと
|
||||
|:--|:--|
|
||||
|評価ボード|GR-ROSE|
|
||||
|Device|R5F565NEHxFP|
|
||||
|IDE| Renesas e2Studio Version:2021-10 |
|
||||
|IDE| Renesas e2Studio Version:2022-01 |
|
||||
|エミュレーター| E1, E2エミュレーターLite |
|
||||
|Toolchain|CCRX v3.03.00|
|
||||
|TSIP| TSIP v1.14|
|
||||
|TSIP| TSIP v1.15|
|
||||
<br>
|
||||
|
||||
本サンプルプログラムのプロジェクトには以下のFITコンポーネントを使用する設定ファイルが用意されています。
|
||||
@ -50,9 +50,9 @@ Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットと
|
||||
|Generic system timer for RX MCUs|1.01|r_sys_time_rx|
|
||||
|TCP/IP protocol stack[M3S-T4-Tiny] - RX Ethernet Driver Interface|1.09|r_t4_driver_rx|
|
||||
|TCP/IP protocol stack[M3S-T4-Tiny] for Renesas MCUs|2.10|r_t4_rx|
|
||||
|TSIP(Trusted Secure IP) driver|1.14|r_tsip_rx|
|
||||
|TSIP(Trusted Secure IP) driver|1.15.l|r_tsip_rx|
|
||||
|
||||
(注意)2021年12月現在、TIPSv1.14はFITコンポーネントとしてスマートコンフィギュレータパースペクティブのコンポーネントの追加操作では追加できないようです。後ほど説明する手動での追加方法を使って追加してください。<br>
|
||||
(注意)2022年4月現在、TIPSv1.15はFITコンポーネントとしてスマートコンフィギュレータパースペクティブのコンポーネントの追加操作では追加できないようです。後ほど説明する手動での追加方法を使って追加してください。<br>
|
||||
|
||||
|
||||
<br><br>
|
||||
|
@ -37,9 +37,10 @@
|
||||
* 109: TSIPv1.09
|
||||
* 113: TSIPv1.13
|
||||
* 114: TSIPv1.14
|
||||
* 115: TSIPv1.15
|
||||
*----------------------------------------------------------------------------*/
|
||||
#define WOLFSSL_RENESAS_TSIP
|
||||
#define WOLFSSL_RENESAS_TSIP_VER 114
|
||||
#define WOLFSSL_RENESAS_TSIP_VER 115
|
||||
|
||||
|
||||
/*-- TLS version definitions --------------------------------------------------
|
||||
|
@ -4,6 +4,7 @@
|
||||
<configuration active="true" id="com.renesas.smc.toolchain.rxc.configuration.release">
|
||||
<property id="com.renesas.smc.service.project.buildArtefactType" values="com.renesas.smc.service.project.buildArtefactType.exe"/>
|
||||
<toolchain id="com.renesas.smc.toolchain.rxc.toolchain.rxc">
|
||||
<option id="com.renesas.smc.toolchain.option.language" key="com.renesas.smc.toolchain.option.language.c"/>
|
||||
<option id="com.renesas.smc.toolchain.option.buildArtefactType" key="com.renesas.smc.toolchain.option.buildArtefactType.exe"/>
|
||||
<option id="com.renesas.smc.toolchain.option.rtos" key="com.renesas.smc.toolchain.option.rtos.none"/>
|
||||
</toolchain>
|
||||
@ -608,6 +609,7 @@
|
||||
</component>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_cmt_rx">
|
||||
<component description="依存モジュール: r_bsp バージョン 6.20 This module creates a timer tick using a CMT channel based on a frequency input by the user." detailDescription="CMT driver" display="r_cmt_rx" id="r_cmt_rx4.90" version="4.90">
|
||||
@ -822,11 +824,6 @@
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_tsip_rx">
|
||||
<component description="依存モジュール: r_bsp バージョン 6.11 Support functions: AES, GCM, CCM, CMAC, SHA, MD5, Triple-DES, ARC4, RSA, ECC, Random number generate, Key management, secure boot/secure firmware update. The ".l" in version number means library version." detailDescription="TSIP(Trusted Secure IP) driver." display="r_tsip_rx" id="r_tsip_rx1.14.l" version="1.14.l"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration id="60957c51-a5e9-46fc-b2c8-a6141e24332c" inuse="true" name="Config_TMR0">
|
||||
<allocatable id="TMR0">
|
||||
<isocket id="CountingClock" selection="Clock.tool_clock_pclkb" value="6.0E7"/>
|
||||
@ -963,6 +960,11 @@
|
||||
</allocator>
|
||||
<source description="コード生成に対応したコンポーネントは、設定に応じた周辺ドライバのコードを小さなコードサイズで出力します。" display="コード生成" id="com.renesas.smc.tools.swcomponent.codegenerator.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_tsip_rx">
|
||||
<component description="依存モジュール: r_bsp バージョン 7.00 Support functions: AES, GCM, CCM, CMAC, SHA, MD5, Triple-DES, ARC4, RSA, ECC, Random number generate, Key management, secure boot/secure firmware update. The ".l" in version number means library version." detailDescription="TSIP(Trusted Secure IP) driver." display="r_tsip_rx" id="r_tsip_rx1.15.l" version="1.15.l"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
</tool>
|
||||
<tool id="System">
|
||||
<section id="ocd">
|
||||
|
@ -145,28 +145,28 @@ const int sizeof_ca_cert_sig = sizeof(ca_cert_der_sig);
|
||||
/* ./client-cert.der.sign, */
|
||||
const unsigned char client_cert_der_sign[] =
|
||||
{
|
||||
0x5D, 0x1F, 0x89, 0x41, 0xEC, 0x47, 0xC8, 0x90, 0x61, 0x79, 0x8A, 0x16,
|
||||
0x1F, 0x31, 0x96, 0x67, 0xD9, 0x3C, 0xEC, 0x6B, 0x58, 0xC6, 0x5A, 0xED,
|
||||
0x99, 0xB3, 0xEF, 0x27, 0x6F, 0x04, 0x8C, 0xD9, 0x68,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 0x6c, 0x48,
|
||||
0xb6, 0x7f, 0x1a, 0x2a, 0xe6, 0x1b, 0xbd, 0x5b, 0x9e, 0xca, 0xd0, 0xf4,
|
||||
0xbb, 0xe4, 0x7f, 0x29, 0x66, 0xf6, 0x31, 0x6d, 0x70, 0x6f, 0xfd, 0x4d,
|
||||
0x7f, 0xc8, 0x7f, 0x9a, 0x5b, 0x1e, 0x37, 0xf7, 0x0c, 0x66, 0xb2, 0x62,
|
||||
0xd8, 0x3e, 0xca, 0x79, 0x6c, 0xec, 0x05, 0x01, 0xda, 0xd9, 0xe2, 0xc3,
|
||||
0xd5, 0x9b, 0xf9, 0x43, 0xa6, 0x14, 0x9a, 0x1f, 0x32, 0xd3, 0x68, 0x63,
|
||||
0x65, 0xb8, 0xb1, 0x63, 0xd5, 0xe2, 0xaa, 0x06, 0x27, 0x62, 0x4a, 0x95,
|
||||
0x48, 0x3f, 0xee, 0xde, 0x3b, 0x89, 0xd4, 0x61, 0x74, 0x39, 0xef, 0xe6,
|
||||
0x6e, 0x16, 0x2d, 0x8b, 0x54, 0x29, 0xe9, 0x71, 0xbc, 0xd4, 0x30, 0x42,
|
||||
0x35, 0x1e, 0x89, 0xfb, 0xf7, 0x4a, 0x47, 0x87, 0x41, 0x66, 0x49, 0xe5,
|
||||
0x8e, 0x16, 0x7f, 0x17, 0x07, 0xd6, 0xff, 0xe1, 0x2a, 0x4d, 0x7c, 0x70,
|
||||
0x0d, 0x72, 0x5d, 0x3d, 0x1f, 0xd8, 0x41, 0x1a, 0x43, 0x00, 0x31, 0x81,
|
||||
0x60, 0xa8, 0x6c, 0xef
|
||||
};
|
||||
const int sizeof_client_cert_der_sign = sizeof(client_cert_der_sign);
|
||||
|
||||
|
@ -181,40 +181,13 @@ void Close_tcp()
|
||||
|
||||
void main(void)
|
||||
{
|
||||
(void)timeTick;
|
||||
|
||||
#if defined(CRYPT_TEST) || defined(BENCHMARK)
|
||||
#if defined(CRYPT_TEST)
|
||||
int i = 0;
|
||||
int ret;
|
||||
func_args args = { 0 };
|
||||
|
||||
if ((ret = wolfCrypt_Init()) != 0) {
|
||||
printf("wolfCrypt_Init failed %d\n", ret);
|
||||
}
|
||||
|
||||
printf("Start wolfCrypt Test\n");
|
||||
wolfcrypt_test(args);
|
||||
printf("End wolfCrypt Test\n");
|
||||
|
||||
if ((ret = wolfCrypt_Cleanup()) != 0) {
|
||||
printf("wolfCrypt_Cleanup failed %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#if defined(BENCHMARK)
|
||||
#include "r_cmt_rx_if.h"
|
||||
|
||||
int doClientCheck = 0;
|
||||
uint32_t channel;
|
||||
R_CMT_CreatePeriodic(FREQ, &timeTick, &channel);
|
||||
|
||||
printf("Start wolfCrypt Benchmark\n");
|
||||
benchmark_test(NULL);
|
||||
printf("End wolfCrypt Benchmark\n");
|
||||
#endif
|
||||
#elif defined(TLS_CLIENT)
|
||||
#include "r_cmt_rx_if.h"
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS)
|
||||
|
||||
#if defined(WOLFSSL_RENESAS_TSIP_TLS) && \
|
||||
defined(TLS_CLIENT)
|
||||
#ifdef USE_ECC_CERT
|
||||
const char* cipherlist[] = {
|
||||
"ECDHE-ECDSA-AES128-GCM-SHA256",
|
||||
@ -234,13 +207,41 @@ void main(void)
|
||||
const int cipherlist_sz = 6;
|
||||
|
||||
#endif
|
||||
|
||||
#else
|
||||
const char* cipherlist[] = { NULL };
|
||||
const int cipherlist_sz = 0;
|
||||
|
||||
#endif
|
||||
int i = 0;
|
||||
|
||||
(void)timeTick;
|
||||
(void)i;
|
||||
(void)ret;
|
||||
(void)channel;
|
||||
(void)doClientCheck;
|
||||
|
||||
#if defined(CRYPT_TEST) || defined(BENCHMARK)
|
||||
#if defined(CRYPT_TEST)
|
||||
func_args args = { 0 };
|
||||
|
||||
if ((ret = wolfCrypt_Init()) != 0) {
|
||||
printf("wolfCrypt_Init failed %d\n", ret);
|
||||
}
|
||||
|
||||
printf("Start wolfCrypt Test\n");
|
||||
wolfcrypt_test(args);
|
||||
printf("End wolfCrypt Test\n");
|
||||
|
||||
if ((ret = wolfCrypt_Cleanup()) != 0) {
|
||||
printf("wolfCrypt_Cleanup failed %d\n", ret);
|
||||
}
|
||||
#endif
|
||||
#if defined(BENCHMARK)
|
||||
#include "r_cmt_rx_if.h"
|
||||
|
||||
R_CMT_CreatePeriodic(FREQ, &timeTick, &channel);
|
||||
|
||||
printf("Start wolfCrypt Benchmark\n");
|
||||
benchmark_test(NULL);
|
||||
printf("End wolfCrypt Benchmark\n");
|
||||
#endif
|
||||
#elif defined(TLS_CLIENT)
|
||||
#include "r_cmt_rx_if.h"
|
||||
|
||||
Open_tcp();
|
||||
|
||||
@ -266,7 +267,7 @@ void main(void)
|
||||
SetTsiptlsKey();
|
||||
#endif
|
||||
|
||||
wolfSSL_TLS_server_init();
|
||||
wolfSSL_TLS_server_init(doClientCheck);
|
||||
wolfSSL_TLS_server();
|
||||
|
||||
Close_tcp();
|
||||
|
@ -29,7 +29,7 @@
|
||||
#include "wolfssl_demo.h"
|
||||
|
||||
|
||||
#define SIMPLE_TLSSEVER_IP "192.168.1.14"
|
||||
#define SIMPLE_TLSSEVER_IP "192.168.11.32"
|
||||
#define SIMPLE_TLSSERVER_PORT "11111"
|
||||
|
||||
ER t4_tcp_callback(ID cepid, FN fncd , VP p_parblk);
|
||||
@ -155,7 +155,7 @@ void wolfSSL_TLS_client( )
|
||||
ER ercd;
|
||||
int ret;
|
||||
WOLFSSL_CTX *ctx = (WOLFSSL_CTX *)client_ctx;
|
||||
WOLFSSL *ssl;
|
||||
WOLFSSL *ssl = NULL;
|
||||
|
||||
#define BUFF_SIZE 256
|
||||
static const char sendBuff[]= "Hello Server\n" ;
|
||||
@ -168,21 +168,21 @@ void wolfSSL_TLS_client( )
|
||||
|
||||
if((dst_addr.ipaddr = getIPaddr(SIMPLE_TLSSEVER_IP)) == 0){
|
||||
printf("ERROR: IP address\n");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
if((dst_addr.portno = getPort(SIMPLE_TLSSERVER_PORT)) == 0){
|
||||
printf("ERROR: IP address\n");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if((ercd = tcp_con_cep(cepid, &my_addr, &dst_addr, TMO_FEVR)) != E_OK) {
|
||||
printf("ERROR TCP Connect: %d\n", ercd);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
printf("ERROR wolfSSL_new: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
||||
@ -196,25 +196,33 @@ void wolfSSL_TLS_client( )
|
||||
|
||||
if(wolfSSL_connect(ssl) != SSL_SUCCESS) {
|
||||
printf("ERROR SSL connect: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (wolfSSL_write(ssl, sendBuff, strlen(sendBuff)) != strlen(sendBuff)) {
|
||||
printf("ERROR SSL write: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((ret=wolfSSL_read(ssl, rcvBuff, BUFF_SIZE)) < 0) {
|
||||
printf("ERROR SSL read: %d\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rcvBuff[ret] = '\0' ;
|
||||
printf("Received: %s\n\n", rcvBuff);
|
||||
|
||||
out:
|
||||
|
||||
/* frees all data before client termination */
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
if(ssl) {
|
||||
wolfSSL_shutdown(ssl);
|
||||
wolfSSL_free(ssl);
|
||||
}
|
||||
if(ctx) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
}
|
||||
|
||||
wolfSSL_Cleanup();
|
||||
|
||||
tcp_sht_cep(cepid);
|
||||
|
@ -163,7 +163,7 @@ void wolfSSL_TLS_server( )
|
||||
ER ercd;
|
||||
WOLFSSL_CTX *ctx = (WOLFSSL_CTX *)server_ctx;
|
||||
|
||||
WOLFSSL *ssl;
|
||||
WOLFSSL *ssl = NULL;
|
||||
int len;
|
||||
#define BUFF_SIZE 256
|
||||
char buff[BUFF_SIZE];
|
||||
@ -171,12 +171,12 @@ void wolfSSL_TLS_server( )
|
||||
|
||||
if((ercd = tcp_acp_cep(cepid, repid, &dst_addr, TMO_FEVR)) != E_OK) {
|
||||
printf("ERROR TCP Accept: %d\n", ercd);
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if((ssl = wolfSSL_new(ctx)) == NULL) {
|
||||
printf("ERROR: failed wolfSSL_new\n");
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
wolfSSL_SetIOReadCtx(ssl, (void *)&cepid);
|
||||
@ -184,12 +184,12 @@ void wolfSSL_TLS_server( )
|
||||
|
||||
if (wolfSSL_accept(ssl) < 0) {
|
||||
printf("ERROR: SSL Accept(%d)\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if ((len = wolfSSL_read(ssl, buff, sizeof(buff) - 1)) < 0) {
|
||||
printf("ERROR: SSL Read(%d)\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
goto out;
|
||||
}
|
||||
|
||||
buff[len] = '\0';
|
||||
@ -197,11 +197,18 @@ void wolfSSL_TLS_server( )
|
||||
|
||||
if (wolfSSL_write(ssl, buff, len) != len) {
|
||||
printf("ERROR: SSL Write(%d)\n", wolfSSL_get_error(ssl, 0));
|
||||
return;
|
||||
}
|
||||
|
||||
wolfSSL_free(ssl);
|
||||
wolfSSL_CTX_free(ctx);
|
||||
out:
|
||||
if (ssl) {
|
||||
wolfSSL_shutdown(ssl);
|
||||
wolfSSL_free(ssl);
|
||||
}
|
||||
if (ctx) {
|
||||
wolfSSL_CTX_free(ctx);
|
||||
};
|
||||
|
||||
wolfSSL_Cleanup();
|
||||
tcp_sht_cep(cepid);
|
||||
tcp_cls_cep(cepid, TMO_FEVR);
|
||||
}
|
||||
|
Reference in New Issue
Block a user