Skip to content

Commit

Permalink
Merge pull request #6166 from TakayukiMatsuo/tsip117
Browse files Browse the repository at this point in the history
  • Loading branch information
cconlon committed Mar 27, 2023
2 parents 85e8274 + 7d2a913 commit 496a150
Show file tree
Hide file tree
Showing 24 changed files with 529 additions and 502 deletions.
19 changes: 7 additions & 12 deletions IDE/Renesas/e2studio/RX65N/GR-ROSE/README_EN.md
Expand Up @@ -32,7 +32,7 @@ This sample program uses the following hardware and software libraries. If a new
|IDE| Renesas e2Studio Version:2022-01 |
|Emulator| E1, E2 Emulator Lite |
|Toolchain|CCRX v3.04.00|
|TSIP| TSIP v1.15|
|TSIP| TSIP v1.17|
<br>

The project of this sample program has a configuration file that uses the following FIT components.
Expand All @@ -47,7 +47,7 @@ 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.15.l|r_tsip_rx|
|TSIP(Trusted Secure IP) driver|1.17.l|r_tsip_rx|
<br>

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.
Expand Down Expand Up @@ -139,7 +139,7 @@ Now that the test application is ready to build.
### 8.1 TLS version supported by the test application

<br>
If you use TSIP v1.15 or later, you can use the TLS1.3 protocol in addition to the existing TLS1.2. The following macro is defined to {board-name-folder}/common/user_settings.h.
You can use the TLS1.3 protocol in addition to the existing TLS1.2. The following macro is defined to {board-name-folder}/common/user_settings.h.
<br><br>

```
Expand Down Expand Up @@ -307,8 +307,8 @@ will become necessary. Please refer to the manual provided by Renesas for how to
----

wolfSSL supports client authentication as follows:
- In TLS1.3, ECDSA certificates are handled by TSIP, RSA certificates are handled by software.
- In TLS1.2, both ECDSA and RSA certificates are handled by TSIP.
- Both ECDSA certificates and RSA certificates are handled by TSIP.


(1) Loading client certificate

Expand Down Expand Up @@ -338,16 +338,11 @@ Define “WOLF_PRIVATE_KEY_ID” in your user_settings.h.
## 11. Limitations
----
<br>
wolfSSL, which supports TSIPv1.15, has the following functional restrictions.
wolfSSL, which supports TSIPv1.17, has the following functional restrictions.
<br><br>

1. Handshake message packets exchanged with the server during the TLS handshake are stored in plaintext in memory. This is used to calculate the hash of handshake messages. The content will be deleted at the end of the session.


1. In TLS 1.3, the client authentication function using TSIP is supported only for ECDSA client certificates. In the case of RSA certificate, it will be processed by software.

1. In TLS1.3, among the server authentication functions, “CertificateVerify” message from the server is processed by software.

1. Session resumption and early data using TSIP are not supported.

The above limitations 1 through 4 are expected to be improved by TSIP from the next version onwards.
The above limitations are expected to be improved by TSIP or wolfSSL from the next version onwards.
20 changes: 8 additions & 12 deletions IDE/Renesas/e2studio/RX65N/GR-ROSE/README_JP.md
Expand Up @@ -33,7 +33,7 @@ Renesas社製MCU RX65Nを搭載した評価ボードGR-ROSEをターゲットと
|IDE| Renesas e2Studio Version:2022-01 |
|エミュレーター| E1, E2エミュレーターLite |
|Toolchain|CCRX v3.04.00|
|TSIP| TSIP v1.15|
|TSIP| TSIP v1.17|
<br>

本サンプルプログラムのプロジェクトには以下のFITコンポーネントを使用する設定ファイルが用意されています。
Expand All @@ -50,7 +50,7 @@ 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.15.l|r_tsip_rx|
|TSIP(Trusted Secure IP) driver|1.17.l|r_tsip_rx|

(注意)2022年4月現在、TIPSv1.15はFITコンポーネントとしてスマートコンフィギュレータパースペクティブのコンポーネントの追加操作では追加できないようです。後ほど説明する手動での追加方法を使って追加してください。<br>

Expand Down Expand Up @@ -145,7 +145,7 @@ testアプリケーションのビルドの準備が整ったので、ビルド

### 8.1 testアプリケーションのサポートするTLSバージョン
<br>
TSIPv1.15以降を使用する場合には、これまでのTLS1.2に加えてTLS1.3プロトコルが使用できます。{board-name-folder}/common/user_settings.hに既定で以下のマクロ定義が設定されています。
TLS1.2に加えてTLS1.3プロトコルが使用できます。{board-name-folder}/common/user_settings.hに既定で以下のマクロ定義が設定されています。
<br><br>

```
Expand Down Expand Up @@ -304,8 +304,8 @@ Received: I hear you fa shizzle!
-----

クライアント認証機能は以下のようにサポートしています。
- TLS1.3ではECDSA証明書はTSIPを使って処理し、RSA証明書はソフトウエアで処理します
- TLS1.2ではECDSA証明書とRSA証明書は共にTSIPを使って処理します。
- ECDSA証明書あるいはRSA証明書はTSIPを使って処理します


(1) クライアント証明書のロード
wolfSSL_CTX_use_certificate_buffer あるいはwolfSSL_CTX_use_certificate_chain_buffer_format を使ってクライアント証明書をロードしてください。
Expand Down Expand Up @@ -336,14 +336,10 @@ user_settings.hにWOLF_PRIVATE_KEY_IDの定義を行ってください。

## 11. 制限事項
-----
TSIPv1.15をサポートしたwolfSSLでは以下の機能制限があります
TSIPv1.17をサポートしたwolfSSLでは以下の機能制限があります

1. TLSハンドシェーク中にサーバーと交換したメッセージパケットが平文でメモリ上に蓄積されています。これはハンドシェークメッセージのハッシュ計算に使用されます。内容はセッション終了時に削除されます。

2. TLS1.3ではTSIPを使ったクライアント認証機能はECDSAクライアント証明書の場合にのみサポートされます。RSA証明書の場合はソフトウエアでの処理となります。

3. TLS1.3ではTSIPを使ったサーバー認証機能のうち、CertificateVerifyメッセージの検証はソフトウエアでの処理となります。

4. TSIPを使ってのセッション再開およびearly dataはサポートされません。
2. TSIPを使ってのセッション再開およびearly dataはサポートされません。

上記制限事項1~4は次版以降のTSIPによって改善が見込まれています
上記制限事項は次版以降のTSIPあるいはwolfSSLによって改善が見込まれています
2 changes: 1 addition & 1 deletion IDE/Renesas/e2studio/RX65N/GR-ROSE/common/user_settings.h
Expand Up @@ -40,7 +40,7 @@
* 115: TSIPv1.15
*----------------------------------------------------------------------------*/
#define WOLFSSL_RENESAS_TSIP
#define WOLFSSL_RENESAS_TSIP_VER 115
#define WOLFSSL_RENESAS_TSIP_VER 117


/*-- TLS version definitions --------------------------------------------------
Expand Down
88 changes: 44 additions & 44 deletions IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/key_data.c
Expand Up @@ -186,56 +186,56 @@ const uint32_t encrypted_user_key_type =

const unsigned char ca_ecc_cert_der_sig[] =
{
0x6e, 0x7d, 0x2b, 0xd3, 0x6d, 0x6a, 0x70, 0x31, 0xbf, 0xcd, 0x6f, 0x32,
0x74, 0x8b, 0x4d, 0xdf, 0x7c, 0x72, 0xc6, 0x78, 0x61, 0x2b, 0x0f, 0xcc,
0xbc, 0xa3, 0x25, 0x54, 0x04, 0xfa, 0x9e, 0xf7, 0x1c, 0xa2, 0xe1, 0x33,
0x90, 0x08, 0xcd, 0x3c, 0xc1, 0x03, 0x66, 0xb6, 0x3f, 0xf1, 0xbf, 0xaf,
0x0d, 0xb0, 0xeb, 0xe4, 0xc7, 0x54, 0x60, 0x34, 0x3b, 0x62, 0xcf, 0x28,
0x95, 0xa2, 0x08, 0x79, 0xc5, 0x51, 0xf3, 0xe1, 0x88, 0x3b, 0xa0, 0x1d,
0x1d, 0x42, 0x5a, 0xba, 0x09, 0xe4, 0x64, 0xa1, 0x83, 0xf4, 0x60, 0x44,
0x89, 0xd3, 0xdd, 0x6c, 0x71, 0x7b, 0xd1, 0xb0, 0x28, 0x7b, 0x98, 0xe2,
0x4b, 0x99, 0x9a, 0x22, 0xd0, 0xeb, 0x1c, 0x5c, 0xbe, 0x49, 0x1a, 0xcf,
0xd7, 0x4b, 0x19, 0xe9, 0xdf, 0x82, 0x21, 0xe3, 0x87, 0x7a, 0x25, 0x58,
0x8f, 0x29, 0x0e, 0xce, 0xf4, 0x09, 0x0f, 0x2f, 0x04, 0xe9,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
0x04, 0x18, 0x33, 0x91, 0x94, 0xb7, 0xca, 0x98, 0xf7, 0xc2, 0xfe, 0x99,
0xc0, 0x73, 0x11, 0x1e
};
const int sizeof_ca_ecc_cert_sig = sizeof(ca_ecc_cert_der_sig);

/* ./ca-cert.der.sign, */
const unsigned char ca_cert_der_sig[] =
{
0x0a, 0xc8, 0xbb, 0x7e, 0x5a, 0x72, 0x6a, 0x5b, 0xf0, 0xc6, 0xbf, 0x36,
0x8e, 0xe1, 0xcd, 0xbc, 0x08, 0xfd, 0x22, 0x5a, 0x3b, 0x48, 0x33, 0xb9,
0x12, 0x55, 0x80, 0x6c, 0x36, 0x14, 0x05, 0x24, 0x63, 0x20, 0x8b, 0x26,
0x69, 0xa9, 0xe3, 0x15, 0xb9, 0x00, 0x8d, 0xea, 0x3a, 0xee, 0x2d, 0x41,
0xec, 0x43, 0x4a, 0x17, 0x48, 0x26, 0x4a, 0xd6, 0xe4, 0x1b, 0xa5, 0x97,
0x2e, 0xf6, 0x41, 0xa7, 0xa2, 0x2b, 0x83, 0x2c, 0xad, 0x6e, 0x4e, 0xfc,
0x57, 0xf1, 0x28, 0xf0, 0xa7, 0xf9, 0x5b, 0x48, 0xab, 0xed, 0x63, 0x22,
0xed, 0x1e, 0xf1, 0x9d, 0xab, 0xbf, 0x9c, 0x78, 0x04, 0x49, 0xad, 0xf1,
0x43, 0x2f, 0x21, 0x9c, 0x90, 0xb8, 0x35, 0x14, 0x68, 0x12, 0x89, 0x00,
0x20, 0x5b, 0x83, 0x52, 0xb7, 0xec, 0x26, 0x01, 0x26, 0xe1, 0x0f, 0xf6,
0x98, 0xd1, 0xb6, 0x28, 0x84, 0xc8, 0xa5, 0x3e, 0xe9, 0xfb, 0x19, 0x2e,
0x8f, 0xd7, 0x66, 0x98, 0xc0, 0x5e, 0x7b, 0xbc, 0x1a, 0xd9, 0x27, 0xb9,
0x76, 0xcc, 0x58, 0x48, 0x0c, 0x0c, 0x22, 0x23, 0x19, 0xfd, 0x22, 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7,
0x42, 0xef, 0xaf, 0x14, 0x17, 0x44, 0xed, 0x6e, 0x2b, 0xd9, 0x70, 0xed,
0x3e, 0x40, 0xf0, 0xef, 0x75, 0x4c, 0x05, 0x1f, 0xc3, 0x37, 0xec, 0xc2,
0xcd, 0xcc, 0xce, 0x39, 0x61, 0xa0, 0xea, 0x16, 0x84, 0x6d, 0xde, 0xe7,
0xf4, 0x0d, 0x8c, 0xf7, 0x69, 0x81, 0x64, 0x09, 0x16, 0xa7, 0x5b, 0x34,
0x83, 0xe5, 0x73, 0xcf, 0x02, 0xf4, 0x37, 0x96, 0x93, 0x27, 0x72, 0x47,
0x71, 0xca, 0x56, 0xcd, 0xd2, 0x85, 0x48, 0xe5, 0x9e, 0x1f, 0x39, 0x52,
0xc1, 0xc3, 0x9c, 0x6b, 0x98, 0x41, 0xc2, 0x0a, 0x77, 0x94, 0xe5, 0x84,
0x44, 0xe7, 0x94, 0xee, 0x5f, 0x05, 0x62, 0xad, 0xe5, 0xe5, 0xc9, 0x7e,
0x02, 0x31, 0x85, 0xca, 0x28, 0x2d, 0x0d, 0x7f, 0x30, 0x5d, 0xb5, 0xaa,
0x12, 0x81, 0x25, 0x37, 0x4a, 0xf2, 0x95, 0x81, 0xda, 0x76, 0xb4, 0x89,
0x76, 0x8a, 0x0c, 0x8d, 0xdf, 0xed, 0xd5, 0x48, 0xa8, 0xc8, 0x6d, 0xf4,
0xbf, 0x98, 0xa3, 0xc5, 0x42, 0x7d, 0xd2, 0x21, 0x2c, 0x8d, 0x57, 0xd0,
0x91, 0x16, 0xee, 0x83, 0xd0, 0xa1, 0x8f, 0x05, 0x50, 0x2b, 0x6e, 0xe8,
0x52, 0xf7, 0xbe, 0x96, 0x89, 0x40, 0xca, 0x9c, 0x19, 0x5a, 0xfc, 0xae,
0x1d, 0xdb, 0x57, 0xb8
};
const int sizeof_ca_cert_sig = sizeof(ca_cert_der_sig);
/* ./client-cert.der.sign, */
Expand Down
9 changes: 3 additions & 6 deletions IDE/Renesas/e2studio/RX65N/GR-ROSE/test/src/wolf_client.c
Expand Up @@ -193,7 +193,7 @@ void wolfSSL_TLS_client_init(const char* cipherlist)
return;
}

#if defined(WOLFSSL_TLS13) && (WOLFSSL_RENESAS_TSIP_VER >= 115)
#if defined(WOLFSSL_TLS13)
if (wolfSSL_CTX_UseSupportedCurve(client_ctx, WOLFSSL_ECC_SECP256R1)
!= WOLFSSL_SUCCESS) {
wolfSSL_CTX_free(client_ctx); client_ctx = NULL;
Expand Down Expand Up @@ -309,12 +309,9 @@ void wolfSSL_TLS_client( )

#else

#if defined(WOLFSSL_RENESAS_TSIP_TLS) && !defined(WOLFSSL_TLS13)
#if defined(WOLFSSL_RENESAS_TSIP_TLS)

/* Note 1: TSIP asks client key pair for client authentication.
* Note 2: as of TSIP v1.15, client authentication is not supported by TSIP
* for RSA certificate on TLS1.3.
*/
/* Note: TSIP asks client key pair for client authentication. */

/* TSIP specific RSA private key */
if (tsip_use_PrivateKey_buffer(ssl,
Expand Down
Binary file not shown.
Binary file not shown.

0 comments on commit 496a150

Please sign in to comment.