diff --git a/IDE/Renesas/e2studio/Projects/common/user_settings.h b/IDE/Renesas/e2studio/Projects/common/user_settings.h
index a1e14be9e..fe79a3a08 100644
--- a/IDE/Renesas/e2studio/Projects/common/user_settings.h
+++ b/IDE/Renesas/e2studio/Projects/common/user_settings.h
@@ -73,14 +73,13 @@
#define OPENSSL_EXTRA
#define WOLFSSL_GENSEED_FORTEST /* Wardning: define your own seed gen */
#else
- #define NO_DES3
#if defined(WOLFSSL_RENESAS_RX65N)
/* In the case of Static RSA and AES-CBC use */
#define HAVE_AES_CBC
#define WOLFSSL_STATIC_RSA
- /* for disabling TSIP CRYPT */
- /* #define NO_RENESAS_TSIP_CRYPT */
- /* for disabling TSIP TLS COMMON CRYPT */
+ /* for disabling TSIP CRYPT and TSIP TLS */
+ /* #define NO_RENESAS_TSIP_CRYPT */
+ /* for disabling only TSIP TLS-linked Common key encryption method */
/* #define NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION */
#endif
#endif
diff --git a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c
index 53e5c9de9..06bd446f0 100644
--- a/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c
+++ b/IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c
@@ -21,7 +21,7 @@
typedef unsigned long time_t;
-#define YEAR 2018
+#define YEAR 2019
#define MON 5
static int tick = 0;
@@ -36,6 +36,6 @@ int strncasecmp(const char *s1, const char * s2, unsigned int sz)
{
for( ; sz>0; sz--)
if(toupper(s1++) != toupper(s2++))
- return 1;
+ return 1;
return 0;
}
diff --git a/IDE/Renesas/e2studio/Projects/include.am b/IDE/Renesas/e2studio/Projects/include.am
index 6a5e4cb58..15fccd7b5 100644
--- a/IDE/Renesas/e2studio/Projects/include.am
+++ b/IDE/Renesas/e2studio/Projects/include.am
@@ -8,6 +8,11 @@ EXTRA_DIST+= IDE/Renesas/e2studio/Projects/wolfssl/.project
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/.cproject
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/.project
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/test_main.c
+EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/key_data.c
+EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/key_data.h
+EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/wolf_client.c
+EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/wolf_server.c
+EXTRA_DIST+= IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/common/wolfssl_dummy.c
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/common/strings.h
EXTRA_DIST+= IDE/Renesas/e2studio/Projects/common/unistd.h
diff --git a/IDE/Renesas/e2studio/Projects/test/.project b/IDE/Renesas/e2studio/Projects/test/.project
index 56fb1785e..0a6806653 100644
--- a/IDE/Renesas/e2studio/Projects/test/.project
+++ b/IDE/Renesas/e2studio/Projects/test/.project
@@ -32,17 +32,22 @@
src/benchmark.c1
- copy_PARENT1/wolfcrypt/benchmark/benchmark.c
+ $%7BPARENT-5-PROJECT_LOC%7D/wolfcrypt/benchmark/benchmark.csrc/benchmark.h1
- copy_PARENT1/wolfcrypt/benchmark/benchmark.h
+ $%7BPARENT-5-PROJECT_LOC%7D/wolfcrypt/benchmark/benchmark.hsrc/test.c1
- copy_PARENT1/wolfcrypt/test/test.c
+ PARENT-5-PROJECT_LOC/wolfcrypt/test/test.c
+
+
+ src/wolfssl_dummy.c
+ 1
+ $%7BPARENT-1-PROJECT_LOC%7D/common/wolfssl_dummy.c
@@ -50,9 +55,5 @@
copy_PARENT$%7BPARENT-3-ECLIPSE_HOME%7D/workspace/wolfssl
-
- copy_PARENT1
- $%7BPARENT-1-copy_PARENT%7D/wolfssl_tsip
-
diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.c b/IDE/Renesas/e2studio/Projects/test/src/key_data.c
index 37c70b078..03b7bf028 100644
--- a/IDE/Renesas/e2studio/Projects/test/src/key_data.c
+++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.c
@@ -1,3 +1,23 @@
+/* key_data.c
+ *
+ * Copyright (C) 2006-2019 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
#include "key_data.h"
#ifdef WOLFSSL_RENESAS_TSIP
diff --git a/IDE/Renesas/e2studio/Projects/test/src/key_data.h b/IDE/Renesas/e2studio/Projects/test/src/key_data.h
index 7e96b02da..f114c0542 100644
--- a/IDE/Renesas/e2studio/Projects/test/src/key_data.h
+++ b/IDE/Renesas/e2studio/Projects/test/src/key_data.h
@@ -1,4 +1,23 @@
-
+/* key_data.h
+ *
+ * Copyright (C) 2006-2019 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
+ */
#ifndef KEY_DATA_H_
#define KEY_DATA_H_
#include
diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c b/IDE/Renesas/e2studio/Projects/test/src/wolf_server.c
old mode 100755
new mode 100644
diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h
index 7a4bd8447..b49cd4f2e 100644
--- a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h
+++ b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_demo.h
@@ -1,8 +1,22 @@
-/*
- * wolfssl_demo.h
+/* wolfssl_demo.h
*
- * Created on: 2019/07/28
- * Author: darkb
+ * Copyright (C) 2006-2019 wolfSSL Inc.
+ *
+ * This file is part of wolfSSL.
+ *
+ * wolfSSL is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * wolfSSL is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
*/
#ifndef WOLFSSL_DEMO_H_
@@ -10,11 +24,21 @@
#define FREQ 10000 /* Hz */
-//#define CRYPT_TEST
-//#define BENCHMARK
-//#define TLS_CLIENT
-#define USE_TSIP_TLS
-#define TLS_SERVER
+/* Enable wolfcrypt test */
+/* can be enabled with benchmark test */
+/* #define CRYPT_TEST */
+
+/* Enable benchmark */
+/* can be enabled with cyrpt test */
+/* #define BENCHMARK */
+
+/* Enable TLS client */
+/* cannot enable with other definition */
+/* #define TLS_CLIENT */
+
+/* Enable TLS server */
+/* cannot enable with other definition */
+/* #define TLS_SERVER */
void wolfSSL_TLS_client_init();
void wolfSSL_TLS_client();
diff --git a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_dummy.c b/IDE/Renesas/e2studio/Projects/test/src/wolfssl_dummy.c
deleted file mode 100644
index 06bd446f0..000000000
--- a/IDE/Renesas/e2studio/Projects/test/src/wolfssl_dummy.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* wolfssl_dummy.c
- *
- * Copyright (C) 2006-2019 wolfSSL Inc.
- *
- * This file is part of wolfSSL.
- *
- * wolfSSL is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * wolfSSL is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335, USA
- */
-
-typedef unsigned long time_t;
-
-#define YEAR 2019
-#define MON 5
-
-static int tick = 0;
-
-time_t time(time_t *t)
-{
- return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++;
-}
-
-#include
-int strncasecmp(const char *s1, const char * s2, unsigned int sz)
-{
- for( ; sz>0; sz--)
- if(toupper(s1++) != toupper(s2++))
- return 1;
- return 0;
-}
diff --git a/wolfcrypt/src/include.am b/wolfcrypt/src/include.am
index 5fa0b019d..06bf677fe 100644
--- a/wolfcrypt/src/include.am
+++ b/wolfcrypt/src/include.am
@@ -79,7 +79,11 @@ EXTRA_DIST += wolfcrypt/src/port/ti/ti-aes.c \
wolfcrypt/src/port/Espressif/esp32_mp.c \
wolfcrypt/src/port/Espressif/README.md \
wolfcrypt/src/port/arm/cryptoCell.c \
- wolfcrypt/src/port/arm/cryptoCellHash.c
+ wolfcrypt/src/port/arm/cryptoCellHash.c \
+ wolfcrypt/src/port/Renesas/renesas_tsip_aes.c \
+ wolfcrypt/src/port/Renesas/renesas_tsip_sha.c \
+ wolfcrypt/src/port/Renesas/renesas_tsip_util.c \
+ wolfcrypt/src/port/Renesas/README_TSIP.md
if BUILD_CRYPTOCB
diff --git a/IDE/Renesas/e2studio/Projects/README_TSIP.md b/wolfcrypt/src/port/Renesas/README_TSIP.md
similarity index 70%
rename from IDE/Renesas/e2studio/Projects/README_TSIP.md
rename to wolfcrypt/src/port/Renesas/README_TSIP.md
index d5e5ce3d6..3bf8ae017 100644
--- a/IDE/Renesas/e2studio/Projects/README_TSIP.md
+++ b/wolfcrypt/src/port/Renesas/README_TSIP.md
@@ -14,7 +14,7 @@ Including the following examples:
## Requirements
### 1. [Renesas TSIP FIT module](https://www.renesas.com/us/en/products/software-tools/software-os-middleware-driver/security-crypto/trusted-secure-ip-driver.html)
-- [FIT module](https://www.renesas.com/us/en/products/software-tools/software-os-middleware-driver/software-package/fit.html)
+[FIT module](https://www.renesas.com/us/en/products/software-tools/software-os-middleware-driver/software-package/fit.html)
Note : The included example program is tested with TSIP FIT version **1.06**.
### 2. [e2studio](https://www.renesas.com/us/en/products/software-tools/tools/ide/e2studio.html)
@@ -36,9 +36,48 @@ To disable portions of the hardware acceleration you can optionally define:
#define NO_WOLFSSL_RENESAS_TSIP_TLS_SESSION
```
### Benchmarks
-Software only implementation:
+**Software only implementation:**
+*block cipher*
+```
+RNG 200 KB took 1.099 seconds, 182.000 KB/s
+SHA 1 MB took 1.005 seconds, 1.166 MB/s
+SHA-256 425 KB took 1.038 seconds, 409.520 KB/s
+```
+
+*TLS establishment time*
+```
+TLS_RSA_WITH_AES_128_CBC_SHA : 0.651 (s)
+TLS_RSA_WITH_AES_128_CBC_SHA256 : 0.651 (s)
+TLS_RSA_WITH_AES_256_CBC_SHA : 0.642 (s)
+TLS_RSA_WITH_AES_256_CBAC_SHA256 : 0.662 (s)
+TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 : 2.050 (s)
+```
+**Hardware acceleration:**
+*block cipher*
+```
+RNG 1 MB took 1.011 seconds, 1.038 MB/s
+SHA 12 MB took 1.001 seconds, 11.515 MB/s
+SHA-256 13 MB took 1.001 seconds, 12.900 MB/s
+```
+*TLS establishment time with TLS-linked capability*
+*Performe full TlS-linked capability*
+```
+TLS_RSA_WITH_AES_128_CBC_SHA : 0.141 (s)
+TLS_RSA_WITH_AES_128_CBC_SHA256 : 0.141 (s)
+TLS_RSA_WITH_AES_256_CBC_SHA : 0.141 (s)
+TLS_RSA_WITH_AES_256_CBAC_SHA256 : 0.144 (s)
+```
+*Performe certificate verification by TSIP TLS-linked API*
+```
+TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 : 1.721 (s)
+```
+Condition:
+Renesas : e2Studio v7.4.0
+ToolChain : Renesas CCRX version 3.00.00
+TSIP FIT : version 1.0.6
+Board : [GR-ROSE](http://gadget.renesas.com/en/product/rose.html)
+wolfSSL : 4.1.0
-Hardware Acceleration:
## Setup and Build an example program
An example program expects the following FIT modules:
@@ -71,10 +110,21 @@ Now, it is able to copy these FIT modules into an example project.
`#define BENCHMARK // enable benchmark application`
`#define TLS_CLIENT // enable simple tls client application`
`#define TLS_SERVER // enable simple tls server application`
- `#define USE_TSIP_TLS // inform user key and flash keying`
+ `#define USE_TSIP_TLS // to inform user key and flash keying, when using TSIP`
Note: CRYPT_TEST and BENCHMARK can be enabled at the same time. TLS_CLIENT and TLS_SERVER cannot be enabled together other definitions.
7. Setup debug configuration based on your debug hardware
+## Run client/server program on the device
+When testing the embedded client or server on the device, it is recommended to test against one of the standard wolfSSL example application running on a desktop machine.
+
+
+For the embedded client, an example server commands for running on a desktop machine, IP address 192.168.1.45, is as follows:
+`$./example/server/server -b -d -i`
+
+
+For the embedded server, an example client commands for running on a desktop machine is as follows:
+`$./example/client/client -h 192.168.1.33 -p 11111`
+
## Modify an example program
To use own TSIP keys for TSIP TLS-linked API use, it needs own flash keyring, PSS signed signature and RSA key.
@@ -97,7 +147,7 @@ To use own TSIP keys for TSIP TLS-linked API use, it needs own flash keyring, PS
Generated byte array of signed signature by genhexbuf.pl can be replaced signature data in key_data.c of an example program.
- Encrypted RSA key and generated byte array of signed signature need to be informed wolfSSL library before loading CA certification. Please refer SetTsipTlskey() function an example program.
+ Encrypted RSA key and generated byte array of signed signature need to be informed wolfSSL library before loading CA certification. Please see SetTsipTlskey() function an example program about how to inform them.
### Coding
@@ -106,7 +156,4 @@ In your application you must include before any o
## Support
For question please email [support@wolfssl.com]
-* Renesas : e2Studio v7.4.0
-* ToolChain : Renesas CCRX version 3.00.00
-* Board : [GR-ROSE](http://gadget.renesas.com/en/product/rose.html)
-* wolfSSL : 4.1.0
+
diff --git a/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c b/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c
index 4c4ab413d..33a45215d 100644
--- a/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c
+++ b/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c
@@ -1,4 +1,4 @@
-/* esp32_aes.c
+/* renesas_tsip_aes.c
*
* Copyright (C) 2006-2019 wolfSSL Inc.
*
diff --git a/wolfssl/wolfcrypt/include.am b/wolfssl/wolfcrypt/include.am
index 98a1487d6..67be99639 100644
--- a/wolfssl/wolfcrypt/include.am
+++ b/wolfssl/wolfcrypt/include.am
@@ -77,7 +77,8 @@ noinst_HEADERS+= \
wolfssl/wolfcrypt/port/st/stm32.h \
wolfssl/wolfcrypt/port/st/stsafe.h \
wolfssl/wolfcrypt/port/Espressif/esp32-crypt.h \
- wolfssl/wolfcrypt/port/arm/cryptoCell.h
+ wolfssl/wolfcrypt/port/arm/cryptoCell.h \
+ wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h
if BUILD_CRYPTOAUTHLIB
nobase_include_HEADERS+= wolfssl/wolfcrypt/port/atmel/atmel.h