diff --git a/IDE/Renesas/e2studio/RA6M3G/README.md b/IDE/Renesas/e2studio/RA6M3G/README.md new file mode 100644 index 000000000..03170ffb9 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/README.md @@ -0,0 +1,175 @@ +wolfSSL for Renesas RA Evaluation Kit (EK-RA6M3G) +================================================= + +## Description + +This directory contains e2studio projects targeted at the Renesas RA 32-bit MCUs.\ +The example projects include a wolfSSL TLS 1.2 client and server.\ +They also include benchmark and cryptography tests for the wolfCrypt library. + +The wolfssl project contains both the wolfSSL and wolfCrypt libraries.\ +It is built as a `Renesas RA C Library Project` and contains the Renesas RA\ +configuration. + +The other projects (benchmark, client, server and test) are built as a\ +`Renesas RA C Project Using RA Library`, where the RA library is the wolfssl project.\ +The wolfssl Project Summary is listed below and is relevant for every project. + +#### Project Summary + +`Board: EK-RA6M3G`\ +`Device: R7FA6M3AH3CFC`\ +`Toolchain: GCC ARM Embedded`\ +`FSP Version: 0.8.0` + +##### Selected software components + +`Board Support Package Common Files v0.8.0`\ +`Arm CMSIS Version 5 - Core (M) v5.5.1`\ +`Amazon FreeRTOS v0.8.0`\ +`RA6M3G-EK Board Support Files v0.8.0`\ +`Board support package for R7FA6M3AH3CFC v0.8.0`\ +`Board support package for RA6M3 v0.8.0`\ +`Board support package for RA6M3 v0.8.0`\ +`Amazon FreeRTOS - Memory Management - Heap 4 v0.8.0`\ +`r_ether to FreeRTOS+TCP Wrapper v0.8.0`\ +`Ethernet v0.8.0`\ +`Ethernet PHY v0.8.0`\ +`FreeRTOS+TCP v0.8.0`\ +`Amazon FreeRTOS - Buffer Allocation 2 v0.8.0` + + +## Setup Steps + +The project directories are missing files necessary to build the project.\ +These files can be generated when creating a new Renesas RA Project.\ +The following steps explain how to generate the missing files and where to place them. + +1.) Create a 'dummy' Renesas RA C Library Project. + + Click File->New->`RA C/C++ Project` + + Click `Renesas RA C Library Project`. Click Next + + Enter `dummy_library` as the project name. Click Next. + + Under `Board: Custom User Board`, select `EK-RA6M3G`. + + Under `RTOS: No RTOS`, select `Amazon FreeRTOS`. + + Click Next. Select `Amazon FreeRTOS - Minimal - Static Allocation` + + Click Finish. + +2.) Create a 'dummy' Renesas RA C Project Using RA Library. + + Click File->New->`RA C/C++ Project` + + Click `Renesas RA C Project Using RA Library`. Click Next + + Enter `dummy_app` as the project name. Click Next. + + Under `RA library project`, select `dummy_library`. + + Click Finish. + +3.) Import all the wolfSSL Projects into e2studio workspace. + + Click File->`Open Projects from File System` + + Click `Directory...` to the right of Import source + + Select the RA6M3G folder location that contains the projects\ + example path: wolfssl/IDE/Renesas/e2studio/RA6M3G + + Deselect the Non-Eclipse project, RA6M3G, by clicking the checkbox\ + Only the folders with 'Eclipse project' under 'Import as' need to be selected. + + Click Finish. + +4.) Copy files from `dummy_library` into `wolfSSL_RA6M3G` + + Expand the dummy_library and wolfSSL_RA6M3G projects\ + (Click the drop-down arrow to the left of the project name.) + + Select and Copy the following folders/files inside dummy_library\ +` ra/`\ +` ra_gen/`\ +` ra_cfg/`\ +` script/`\ +` R7FA6M3AH3CFC.pincfg`\ +` RA6M3G-EK.pingcfg` + + Paste the copied folders/files into wolfSSL_RA6M3G + + The `dummy_library` project can now be deleted. + + Generate Project Content. + + Click `Open RA Configuration` in the top bar (Grey Settings Cog) + + Click `Generate Project Content` at top right (Green Icon) + + Build wolfSSL_RA6M3G. + +5.) Copy files from `dummy_app` into `./IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/`\ + **NOTE:** This may need to be done outside of the e2studio environment (e.g. File Explorer). + + Select and Copy the followng folder inside dummy_app\ +` src/`\ +` script/` + + Paste the copied folders into `./IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/`\ +` (The test, benchmark, client and server projects link to this folder.)` + + The `dummy_app` project can now be deleted. + +6.) Setup Network Environment + + The client and server projects have defines inside their wolfssl_thread_entry.h. + These defines (ucIPAddress ... ucDNSServerAddress) may need to be changed + based on your internal network environment. The g_ether0_mac_address is the default + mac address found inside the RA configuration inside the wolfssl project. + The client wolfssl_thread_entry.h has defines (SERVER_IP and DEFAULT_PORT) that + will need to be changed based on the server you're trying to connect to over + the ethernet connection. + +## Build and Run + +### Build Each Project +Right-Click each Project and select Build. + +### Run wolfCrypt Test and Benchmark +1.) Right-Click the Project name.\ +2.) Select `Debug As` -> `Renesas GDB Hardware Debugging`\ +3.) Select J-Link ARM. Click OK.\ +4.) Select R7Fa6M3AH. Click OK. + +### Run the wolfSSL TLS Server Example. +1.) Right-Click the Project name.\ +2.) Select `Debug As` -> `Renesas GDB Hardware Debugging`\ +3.) Select J-Link ARM. Click OK.\ +4.) Select R7Fa6M3AH. Click OK.\ +5.) Run the following wolfSSL example client command inside the base of the wolfssl directory. + +``` +./examples/client/client -h "ucIPAddress" -p 11111 -A ./certs/1024/ca-cert.pem +``` +**NOTE:** "ucIPAddress" is "192.168.1.241" by default. (See wolfssl_thread_entry.h) + +### Run the wolfSSL TLS Client Example. + 1.) Run the following wolfSSL example server command inside the base of the wolfssl directory. + +``` +./examples/server/server -b -d -p 11111 -c ./certs/1024/server-cert.pem -k ./certs/1024/server-key.pem +``` +**NOTE:** The port 11111 is the DEFAULT_PORT inside wolfssl_thread_entry.h.\ +If DEFAULT_PORT was changed then the above command will need to match it. + + 2.) Right-Click the Project name.\ + 3.) Select `Debug As` -> `Renesas GDB Hardware Debugging`\ + 4.) Select J-Link ARM. Click OK.\ + 5.) Select R7Fa6M3AH. Click OK. + + +## Troubleshooting + +* The commands for the example client/server assumes it is being run from the + base directory of wolfssl. + +* Enter "#define DEBUG_WOLFSSL" inside user_settings.h or wolfssl_thread_entry.c\ + to enable wolfssl debug messages to the Renesas Virtual Debug Console. + +* Some linking errors can be caused by the e2studio project files needing to be rebuilt and freshened. +Right-Click a project, select Index, click Rebuild and then click Freshen Files. Repeat for each project. + +[Support Forum](https://www.wolfssl.com/forums/) + +Support Email: support@wolfssl.com + + +## Resources + +[wolfSSL Website](https://www.wolfssl.com/) + +[wolfSSL Wiki](https://github.com/wolfSSL/wolfssl/wiki) + +[wolfSSL Manual](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-toc.html) + +[wolfSSL API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-17-wolfssl-api-reference.html) + +[wolfCrypt API Reference](https://wolfssl.com/wolfSSL/Docs-wolfssl-manual-18-wolfcrypt-api-reference.html) + +[TLS 1.3](https://www.wolfssl.com/docs/tls13/) diff --git a/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.cproject b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.cproject new file mode 100644 index 000000000..f8e135a28 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.cproject @@ -0,0 +1,309 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.project b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.project new file mode 100644 index 000000000..9b1353df6 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.project @@ -0,0 +1,59 @@ + + + benchmark_wolfCrypt_RA6M3G + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.renesas.cdt.ra.contentgen.raExecutableNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + common/src + 2 + virtual:/virtual + + + common/user_settings.h + 1 + PARENT-1-PROJECT_LOC/common/user_settings.h + + + common/util.h + 1 + PARENT-1-PROJECT_LOC/common/util.h + + + script/ra6m3.ld + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/script/ra6m3.ld + + + src/benchmark.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/benchmark/benchmark.c + + + common/src/freertos_tcp_port.c + 1 + PARENT-1-PROJECT_LOC/common/src/freertos_tcp_port.c + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/common/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/common/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/script/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/script/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/src/wolfssl_thread_entry.c new file mode 100644 index 000000000..67629b1c4 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/src/wolfssl_thread_entry.c @@ -0,0 +1,30 @@ +/* wolfssl_thread_entry.c + * + * Copyright (C) 2006-2020 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 +#include "wolfcrypt/benchmark/benchmark.h" +#include "common/util.h" + +void wolfssl_thread_entry(void *pvParameters) { + FSP_PARAMETER_NOT_USED(pvParameters); + initialise_monitor_handles(); + benchmark_test(0); + while (1); +} diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.cproject b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.cproject new file mode 100644 index 000000000..b4d519106 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.cproject @@ -0,0 +1,325 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.project b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.project new file mode 100644 index 000000000..0f84e0838 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.project @@ -0,0 +1,54 @@ + + + client_wolfSSL_RA6M3G + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.renesas.cdt.ra.contentgen.raExecutableNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + common/user_settings.h + 1 + PARENT-1-PROJECT_LOC/common/user_settings.h + + + common/util.h + 1 + PARENT-1-PROJECT_LOC/common/util.h + + + script/ra6m3.ld + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/script/ra6m3.ld + + + src/hal_entry.c + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/src/hal_entry.c + + + common/src/freertos_tcp_port.c + 1 + PARENT-1-PROJECT_LOC/common/src/freertos_tcp_port.c + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/common/src/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/common/src/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/script/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/script/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/src/wolfssl_thread_entry.c new file mode 100644 index 000000000..461cfab5b --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/src/wolfssl_thread_entry.c @@ -0,0 +1,150 @@ +/* wolfssl_thread_entry.c + * + * Copyright (C) 2006-2020 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 + */ + +/* wolfSSL */ +#include +#include +#include +#include "wolfssl_thread_entry.h" + +/* FreeRTOS */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* Project Specific */ +#include "common/util.h" +#include + +void wolfssl_thread_entry(void *pvParameters) { + FSP_PARAMETER_NOT_USED(pvParameters); + + /* FreeRTOS+TCP Objects */ + BaseType_t fr_status; + socklen_t xSize = sizeof(struct freertos_sockaddr); + xSocket_t xClientSocket = NULL; + struct freertos_sockaddr xRemoteAddress; + + /* Return status */ + int ret = WOLFSSL_FAILURE; + + /* Message to send and buffer for receive. */ + const char msg[] = "Hello from wolfSSL client."; + char buff[256]; + + /* wolfSSL objects */ + WOLFSSL_CTX *ctx = NULL; + WOLFSSL *ssl = NULL; + + /* Output to Renesas Debug Virtual Console */ + initialise_monitor_handles(); +#ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_ON(); +#endif + + /* FreeRTOS+TCP Ethernet and IP Setup */ + fr_status = FreeRTOS_IPInit(ucIPAddress, + ucNetMask, + ucGatewayAddress, + ucDNSServerAddress, + g_ether0_mac_address); + if (pdPASS != fr_status) { + printf("Error [%ld]: FreeRTOS_IPInit.\n",fr_status); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Client Socket Setup */ + xRemoteAddress.sin_port = FreeRTOS_htons(DEFAULT_PORT); + xRemoteAddress.sin_addr = FreeRTOS_inet_addr(SERVER_IP); + + /* Create a FreeRTOS TCP Socket and connect */ + xClientSocket = FreeRTOS_socket(FREERTOS_AF_INET, + FREERTOS_SOCK_STREAM, + FREERTOS_IPPROTO_TCP); + configASSERT(xClientSocket != FREERTOS_INVALID_SOCKET); + FreeRTOS_bind(xClientSocket, &xRemoteAddress, sizeof(xSize)); + + /* Client Socket Connect */ + ret = FreeRTOS_connect(xClientSocket, + &xRemoteAddress, + sizeof(xRemoteAddress)); + if (ret != FR_SOCKET_SUCCESS) { + printf("Error [%d]: FreeRTOS_connect.\n",ret); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* TLS Connection Setup */ + /* Initialize wolfSSL */ + wolfSSL_Init(); + + /* Create and initialize WOLFSSL_CTX */ + ctx = wolfSSL_CTX_new(wolfTLSv1_2_client_method()); + if (ctx == NULL) { + printf("Error: wolfSSL_CTX_new.\n"); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Load client certificates into WOLFSSL_CTX */ + ret = wolfSSL_CTX_load_verify_buffer(ctx, CERT, SIZEOF_CERT, + WOLFSSL_FILETYPE_ASN1); + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_CTX_load_verify_buffer.\n",ret); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Create a WOLFSSL object */ + ssl = wolfSSL_new(ctx); + if (ssl == NULL) { + printf("Error: wolfSSL_new.\n"); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Attach wolfSSL to the socket */ + ret = wolfSSL_set_fd(ssl, (int) xClientSocket); + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_set_fd.\n",ret); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Connect to wolfSSL on the server side */ + ret = wolfSSL_connect(ssl); + if (ret != WOLFSSL_SUCCESS) { + ret = wolfSSL_get_error(ssl, ret); + printf("Error [%d]: wolfSSL_connect.\n",ret); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Send the message to the server */ + ret = wolfSSL_write(ssl, msg, (int) XSTRLEN(msg)); + if (ret < 0) { + printf("Error: wolfSSL_write.\n"); + util_inf_loop(xClientSocket, ctx, ssl); + } + + /* Read the server data into buff array */ + XMEMSET(buff, 0, sizeof(buff)); + ret = wolfSSL_read(ssl, buff, sizeof(buff) - 1); + + /* Shutdown TLS connection */ + wolfSSL_shutdown(ssl); + + /* Cleanup */ + util_inf_loop(xClientSocket, ctx, ssl); +} diff --git a/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/wolfssl_thread_entry.h new file mode 100755 index 000000000..d63d66952 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/client-wolfssl/wolfssl_thread_entry.h @@ -0,0 +1,41 @@ +/* wolfssl_thread_entry.h + * + * Copyright (C) 2006-2020 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_THREAD_ENTRY_H_ +#define WOLFSSL_THREAD_ENTRY_H_ + +#include +#include + +static const byte ucIPAddress[4] = { 192, 168, 1, 241 }; +static const byte ucNetMask[4] = { 255, 255, 255, 0 }; +static const byte ucGatewayAddress[4] = { 192, 168, 1, 1 }; +static const byte ucDNSServerAddress[4] = { 192, 168, 1, 1 }; +static const byte g_ether0_mac_address[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; + +/* Client connects to the server with these details. */ +#define SERVER_IP "192.168.1.240" +#define DEFAULT_PORT 11111 +#define CERT ca_cert_der_1024 +#define SIZEOF_CERT sizeof_ca_cert_der_1024 + +#define FR_SOCKET_SUCCESS 0 + +#endif /* WOLFSSL_THREAD_ENTRY_H_ */ diff --git a/IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/README.md b/IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/README.md new file mode 100755 index 000000000..d509cca84 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/README.md @@ -0,0 +1,4 @@ +Create a 'dummy' Renesas RA C Project Using RA Library. +Copy and Paste the generated 'script' and 'src' folder into this folder. + +These are linked to in other projects. diff --git a/IDE/Renesas/e2studio/RA6M3G/common/src/freertos_tcp_port.c b/IDE/Renesas/e2studio/RA6M3G/common/src/freertos_tcp_port.c new file mode 100644 index 000000000..9e5715316 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/common/src/freertos_tcp_port.c @@ -0,0 +1,65 @@ +/* freertos_tcp_port.c + * + * Copyright (C) 2006-2020 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 "bsp_api.h" +#include "FreeRTOS.h" +#include "FreeRTOS_sockets.h" +#include "FreeRTOS_IP.h" +#include + +#define HOSTNAME "wolfssl_ra6m3g" + +/* + * Contains callback functions for FreeRTOS+TCP + * The following implementations are NOT SUITABLE FOR PRODUCTION. + * They currently serve to build the projects and are not secure. + */ + +uint32_t ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress, + uint16_t usSourcePort, + uint32_t ulDestinationAddress, + uint16_t usDestinationPort); + +const char *pcApplicationHostnameHook(void) { + return HOSTNAME; +} + +uint32_t ulRand(void) { + return (uint32_t) rand(); +} + +/* Disabled in RA Configuration. Re-Enable within FreeRTOS+TCP Stack Properties */ +void vApplicationIPNetworkEventHook(eIPCallbackEvent_t eNetworkEvent) { + (void) eNetworkEvent; +} + +uint32_t ulApplicationGetNextSequenceNumber(uint32_t ulSourceAddress, + uint16_t usSourcePort, + uint32_t ulDestinationAddress, + uint16_t usDestinationPort) +{ + (void) ulSourceAddress; + (void) usSourcePort; + (void) ulDestinationAddress; + (void) usDestinationPort; + + return ulRand(); +} diff --git a/IDE/Renesas/e2studio/RA6M3G/common/user_settings.h b/IDE/Renesas/e2studio/RA6M3G/common/user_settings.h new file mode 100644 index 000000000..161e52c1b --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/common/user_settings.h @@ -0,0 +1,77 @@ +/* user_settings.h + * + * Copyright (C) 2006-2020 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 USER_SETTINGS_H_ +#define USER_SETTINGS_H_ + +/* Temporary defines. Not suitable for production. */ +#define WOLFSSL_GENSEED_FORTEST /* Warning: define your own seed gen */ +/* End temporary defines */ + +/* Operating Environment and Threading */ +#define FREERTOS +#define FREERTOS_TCP +#define NO_DEV_RANDOM +#define NO_WRITEV +#define NO_MAIN_DRIVER +#define BENCH_EMBEDDED + +/* Filesystem and IO */ +#define NO_WOLFSSL_DIR +#define WOLFSSL_NO_CURRDIR +#define NO_FILESYSTEM + +/* Cryptography Enable Options */ +#define HAVE_CHACHA +#define HAVE_POLY1305 +#define HAVE_ECC +#define HAVE_RSA +#define HAVE_SHA256 +#define HAVE_SUPPORTED_CURVES +#define HAVE_TLS_EXTENSIONS +#define HAVE_TRUNCATED_HMAC +#define HAVE_EXTENDED_MASTER +#define HAVE_ALPN +#define HAVE_SNI +#define HAVE_OCSP +#define HAVE_AESGCM +#define HAVE_ONE_TIME_AUTH + +/* Non-Fast Math may call realloc. This project has no realloc support */ +#define USE_FAST_MATH +#define ALT_ECC_SIZE +#define TFM_TIMING_RESISTANT +#define ECC_TIMING_RESISTANT +#define WC_RSA_BLINDING +#define WOLFSSL_SMALL_STACK +#define WOLFSSL_DH_CONST + +/* Cryptography Disable options */ +#define NO_PWDBASED +#define NO_DSA +#define NO_DES3 +#define NO_RABBIT +#define NO_RC4 +#define NO_MD4 + +void wolfssl_thread_entry(void *pvParameters); +extern void initialise_monitor_handles(void); + +#endif /* USER_SETTINGS_H_ */ diff --git a/IDE/Renesas/e2studio/RA6M3G/common/util.h b/IDE/Renesas/e2studio/RA6M3G/common/util.h new file mode 100644 index 000000000..805415b04 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/common/util.h @@ -0,0 +1,48 @@ +/* util.h + * + * Copyright (C) 2006-2020 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 _UTIL_H_ +#define _UTIL_H_ +#include "common/user_settings.h" +#include +#include "FreeRTOS_IP.h" +#include + +static void util_Cleanup(xSocket_t xSock, WOLFSSL_CTX *ctx, WOLFSSL *ssl) { + printf("Cleaning up socket and wolfSSL objects.\n"); + if (xSock != NULL) + FreeRTOS_closesocket(xSock); + if (ssl != NULL) + wolfSSL_free(ssl); + if (ctx != NULL) + wolfSSL_CTX_free(ctx); + wolfSSL_Cleanup(); +} + +static inline void util_inf_loop(xSocket_t xClientSocket, WOLFSSL_CTX *ctx, + WOLFSSL *ssl) { + util_Cleanup(xClientSocket, ctx, ssl); + printf("Reached infinite loop.\n"); + while (1) + ; +} + +#endif /* _UTIL_H */ diff --git a/IDE/Renesas/e2studio/RA6M3G/include.am b/IDE/Renesas/e2studio/RA6M3G/include.am new file mode 100644 index 000000000..c0bab82b8 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/include.am @@ -0,0 +1,32 @@ +# vim:ft=automake +# included from Top Level Makefile.am +# All paths should be given relative to the root + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/src/wolfssl_thread_entry.c +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.cproject +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/benchmark-wolfcrypt/.project + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/client-wolfssl/src/wolfssl_thread_entry.c +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.cproject +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/client-wolfssl/.project +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/client-wolfssl/wolfssl_thread_entry.h + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/common/ra6m3g/README.md +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/common/src/freertos_tcp_port.c +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/common/user_settings.h +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/common/util.h + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/server-wolfssl/src/wolfssl_thread_entry.c +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.cproject +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.project +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/server-wolfssl/wolfssl_thread_entry.h + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/src/wolfssl_thread_entry.c +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.cproject +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.project + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/wolfssl/.cproject +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/wolfssl/.project +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/wolfssl/configuration.xml + +EXTRA_DIST+= IDE/Renesas/e2studio/RA6M3G/README.md diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.cproject b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.cproject new file mode 100644 index 000000000..402e450b8 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.cproject @@ -0,0 +1,320 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.project b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.project new file mode 100644 index 000000000..70c1bd5f9 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/.project @@ -0,0 +1,60 @@ + + + server_wolfSSL_RA6M3G + + + + + + org.eclipse.xtext.ui.shared.xtextBuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.renesas.cdt.ra.contentgen.raExecutableNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + org.eclipse.xtext.ui.shared.xtextNature + + + + common/user_settings.h + 1 + PARENT-1-PROJECT_LOC/common/user_settings.h + + + common/util.h + 1 + PARENT-1-PROJECT_LOC/common/util.h + + + script/ra6m3.ld + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/script/ra6m3.ld + + + src/hal_entry.c + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/src/hal_entry.c + + + common/src/freertos_tcp_port.c + 1 + PARENT-1-PROJECT_LOC/common/src/freertos_tcp_port.c + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/common/src/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/common/src/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/script/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/script/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/src/wolfssl_thread_entry.c new file mode 100644 index 000000000..6e9bba82a --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/src/wolfssl_thread_entry.c @@ -0,0 +1,172 @@ +/* wolfssl_thread_entry.c + * + * Copyright (C) 2006-2020 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 +#include +#include +#include "wolfssl_thread_entry.h" + +/* FreeRTOS+TCP */ +#include "FreeRTOS_IP.h" +#include "FreeRTOS_Sockets.h" + +/* Project Tools */ +#include "common/util.h" +#include + +void wolfssl_thread_entry(void *pvParameters) { + FSP_PARAMETER_NOT_USED(pvParameters); + + /* FreeRTOS+TCP parameters and objects */ + BaseType_t fr_status; + struct freertos_sockaddr xClient, xBindAddress; + Socket_t xListeningSocket, xConnectedSocket; + socklen_t xSize = sizeof(xClient); + const BaseType_t xBacklog = 1; /* Max number of connections */ + static const TickType_t xReceiveTimeOut = portMAX_DELAY; + + /* Return Code */ + int ret = WOLFSSL_FAILURE; + + /* Send/Receive Message */ + const char *reply = "I hear ya fa shizzle!\n"; + char buff[256]; + + /* wolfSSL objects */ + WOLFSSL_CTX *ctx = NULL; + WOLFSSL *ssl = NULL; + + /* Output to Renesas Debug Virtual Console */ + initialise_monitor_handles(); +#ifdef DEBUG_WOLFSSL + wolfSSL_Debugging_ON(); +#endif + + fr_status = FreeRTOS_IPInit(ucIPAddress,ucNetMask, ucGatewayAddress, + ucDNSServerAddress, g_ether0_mac_address); + + if (pdPASS != fr_status) { + printf("Error [%ld]: FreeRTOS_IPInit.\n",fr_status); + while (1); + } + /* Attempt to open the socket. */ + xListeningSocket = FreeRTOS_socket(FREERTOS_AF_INET, + FREERTOS_SOCK_STREAM, + FREERTOS_IPPROTO_TCP); + configASSERT(xListeningSocket != FREERTOS_INVALID_SOCKET); + + /* Set a time out so accept() will just wait for a connection. */ + FreeRTOS_setsockopt(xListeningSocket, 0, + FREERTOS_SO_RCVTIMEO, &xReceiveTimeOut, sizeof(xReceiveTimeOut)); + + xBindAddress.sin_port = (uint16_t) DEFAULT_PORT; + xBindAddress.sin_port = FreeRTOS_htons(xBindAddress.sin_port); + + configASSERT(xListeningSocket != FREERTOS_INVALID_SOCKET); + + ret = FreeRTOS_bind(xListeningSocket, &xBindAddress, sizeof(xBindAddress)); + if (ret == FR_SOCKET_SUCCESS) + ret = FreeRTOS_listen(xListeningSocket, xBacklog); + + if (ret != FR_SOCKET_SUCCESS) { + printf("Error [%d]: FreeRTOS_bind.\n",ret); + while (1); + } + + while (1) { + ret = WOLFSSL_FAILURE; + xConnectedSocket = FreeRTOS_accept(xListeningSocket, &xClient, &xSize); + configASSERT(xConnectedSocket != FREERTOS_INVALID_SOCKET); + + /* Create WOLFSSL_CTX object */ + ctx = wolfSSL_CTX_new(wolfTLSv1_2_server_method()); + + /* Load server certificates into WOLFSSL_CTX */ + if (ctx == NULL) { + printf("Error: wolfSSL_CTX_new.\n"); + break; + } + ret = wolfSSL_CTX_use_certificate_buffer(ctx, CERT_BUF, SIZEOF_CERT_BUF, + SSL_FILETYPE_ASN1); + + /* Load server key into WOLFSSL_CTX */ + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_CTX_use_certificate_buffer.\n",ret); + break; + } + ret = wolfSSL_CTX_use_PrivateKey_buffer(ctx, KEY_BUF, SIZEOF_KEY_BUF, + SSL_FILETYPE_ASN1); + + /* Create a WOLFSSL object */ + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_CTX_use_PrivateKey_buffer.\n",ret); + break; + } + ssl = wolfSSL_new(ctx); + + /* Attach wolfSSL to the socket */ + if (ssl == NULL) { + printf("Error: wolfSSL_new.\n"); + break; + } + ret = wolfSSL_set_fd(ssl, (int) xConnectedSocket); + + /* Establish TLS connection */ + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_set_fd.\n",ret); + break; + } + ret = wolfSSL_accept(ssl); + + /* Read the client data into our buff array */ + if (ret != WOLFSSL_SUCCESS) { + printf("Error [%d]: wolfSSL_set_fd.\n",ret); + break; + } + memset(buff, 0, sizeof(buff)); + ret = wolfSSL_read(ssl, buff, sizeof(buff) - 1); + + if (ret < 0) + break; + + /* Check for server shutdown command */ + if (strncmp(buff, "shutdown", 8) == 0) + break; + + /* Write our reply into buff */ + memset(buff, 0, sizeof(buff)); + memcpy(buff, reply, strlen(reply)); + + /* Reply back to the client */ + ret = wolfSSL_write(ssl, buff, (int) strlen(buff)); + + /* Cleanup after this connection */ + util_Cleanup(xConnectedSocket, ctx, ssl); + } + + /* Shutdown TLS Server */ + ret = wolfSSL_shutdown(ssl); + if (ret == WOLFSSL_SHUTDOWN_NOT_DONE) { + wolfSSL_shutdown(ssl); + } + + /* Cleanup connection */ + util_inf_loop(xConnectedSocket, ctx, ssl); +} diff --git a/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/wolfssl_thread_entry.h b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/wolfssl_thread_entry.h new file mode 100755 index 000000000..6e459ca8c --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/server-wolfssl/wolfssl_thread_entry.h @@ -0,0 +1,43 @@ +/* wolfssl_thread_entry.h + * + * Copyright (C) 2006-2020 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_THREAD_ENTRY_H_ +#define WOLFSSL_THREAD_ENTRY_H_ + +#include + +static const byte ucIPAddress[4] = { 192, 168, 1, 241 }; +static const byte ucNetMask[4] = { 255, 255, 255, 0 }; +static const byte ucGatewayAddress[4] = { 192, 168, 1, 1 }; +static const byte ucDNSServerAddress[4] = { 192, 168, 1, 1 }; +static const byte g_ether0_mac_address[6] = { 0x00, 0x11, 0x22, 0x33, 0x44, 0x55 }; + +/* Server Cert and Key */ +#define CERT_BUF server_cert_der_1024 +#define SIZEOF_CERT_BUF sizeof_server_cert_der_1024 +#define KEY_BUF server_key_der_1024 +#define SIZEOF_KEY_BUF sizeof_server_key_der_1024 + +/* Port That the wolfSSL Server connects to. */ +#define DEFAULT_PORT 11111 + +#define FR_SOCKET_SUCCESS 0 + +#endif /* WOLFSSL_THREAD_ENTRY_H_ */ diff --git a/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.cproject b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.cproject new file mode 100644 index 000000000..bfcbafd28 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.cproject @@ -0,0 +1,305 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.project b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.project new file mode 100644 index 000000000..507e93cab --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/.project @@ -0,0 +1,54 @@ + + + test_wolfCrypt_RA6M3G + + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + com.renesas.cdt.ra.contentgen.raExecutableNature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + + + + common/user_settings.h + 1 + PARENT-1-PROJECT_LOC/common/user_settings.h + + + common/util.h + 1 + PARENT-1-PROJECT_LOC/common/util.h + + + script/ra6m3.ld + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/script/ra6m3.ld + + + src/hal_entry.c + 1 + PARENT-1-PROJECT_LOC/common/ra6m3g/src/hal_entry.c + + + src/test.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/test/test.c + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/common/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/common/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/script/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/script/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/src/wolfssl_thread_entry.c b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/src/wolfssl_thread_entry.c new file mode 100644 index 000000000..257a1d479 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/test-wolfcrypt/src/wolfssl_thread_entry.c @@ -0,0 +1,32 @@ +/* wolfssl_thread_entry.c + * + * Copyright (C) 2006-2020 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 +#include "wolfcrypt/test/test.h" + +void wolfssl_thread_entry(void* pvParameters) +{ + FSP_PARAMETER_NOT_USED (pvParameters); + /* Benchmark output is displayed to Renesas Debug Virtual Console */ + initialise_monitor_handles(); + wolfcrypt_test(0); + while(1); +} diff --git a/IDE/Renesas/e2studio/RA6M3G/wolfssl/.cproject b/IDE/Renesas/e2studio/RA6M3G/wolfssl/.cproject new file mode 100644 index 000000000..a28b9e11d --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/wolfssl/.cproject @@ -0,0 +1,334 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/wolfssl/.project b/IDE/Renesas/e2studio/RA6M3G/wolfssl/.project new file mode 100644 index 000000000..c3fda822f --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/wolfssl/.project @@ -0,0 +1,554 @@ + + + wolfSSL_RA6M3G + + + + + + com.renesas.cdt.ra.contentgen.raBuilder + + + + + org.eclipse.cdt.managedbuilder.core.genmakebuilder + clean,full,incremental, + + + + + org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder + full,incremental, + + + + + + org.eclipse.cdt.core.cnature + org.eclipse.cdt.managedbuilder.core.managedBuildNature + org.eclipse.cdt.managedbuilder.core.ScannerConfigNature + com.renesas.cdt.ra.contentgen.raNature + + + + src/bio.c + 1 + PARENT-5-PROJECT_LOC/src/bio.c + + + src/crl.c + 1 + PARENT-5-PROJECT_LOC/src/crl.c + + + src/include.am + 1 + PARENT-5-PROJECT_LOC/src/include.am + + + src/internal.c + 1 + PARENT-5-PROJECT_LOC/src/internal.c + + + src/keys.c + 1 + PARENT-5-PROJECT_LOC/src/keys.c + + + src/ocsp.c + 1 + PARENT-5-PROJECT_LOC/src/ocsp.c + + + src/sniffer.c + 1 + PARENT-5-PROJECT_LOC/src/sniffer.c + + + src/ssl.c + 1 + PARENT-5-PROJECT_LOC/src/ssl.c + + + src/tls.c + 1 + PARENT-5-PROJECT_LOC/src/tls.c + + + src/tls13.c + 1 + PARENT-5-PROJECT_LOC/src/tls13.c + + + src/wolfio.c + 1 + PARENT-5-PROJECT_LOC/src/wolfio.c + + + wolfcrypt/aes.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/aes.c + + + wolfcrypt/arc4.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/arc4.c + + + wolfcrypt/asm.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/asm.c + + + wolfcrypt/asn.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/asn.c + + + wolfcrypt/blake2b.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/blake2b.c + + + wolfcrypt/blake2s.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/blake2s.c + + + wolfcrypt/camellia.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/camellia.c + + + wolfcrypt/chacha.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/chacha.c + + + wolfcrypt/chacha20_poly1305.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/chacha20_poly1305.c + + + wolfcrypt/cmac.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/cmac.c + + + wolfcrypt/coding.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/coding.c + + + wolfcrypt/compress.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/compress.c + + + wolfcrypt/cpuid.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/cpuid.c + + + wolfcrypt/cryptocb.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/cryptocb.c + + + wolfcrypt/curve25519.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/curve25519.c + + + wolfcrypt/des3.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/des3.c + + + wolfcrypt/dh.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/dh.c + + + wolfcrypt/dsa.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/dsa.c + + + wolfcrypt/ecc.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ecc.c + + + wolfcrypt/ecc_fp.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ecc_fp.c + + + wolfcrypt/ed25519.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ed25519.c + + + wolfcrypt/error.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/error.c + + + wolfcrypt/evp.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/evp.c + + + wolfcrypt/fe_low_mem.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/fe_low_mem.c + + + wolfcrypt/fe_operations.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/fe_operations.c + + + wolfcrypt/ge_low_mem.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ge_low_mem.c + + + wolfcrypt/ge_operations.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ge_operations.c + + + wolfcrypt/hash.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/hash.c + + + wolfcrypt/hc128.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/hc128.c + + + wolfcrypt/hmac.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/hmac.c + + + wolfcrypt/idea.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/idea.c + + + wolfcrypt/include.am + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/include.am + + + wolfcrypt/integer.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/integer.c + + + wolfcrypt/logging.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/logging.c + + + wolfcrypt/md2.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/md2.c + + + wolfcrypt/md4.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/md4.c + + + wolfcrypt/md5.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/md5.c + + + wolfcrypt/memory.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/memory.c + + + wolfcrypt/misc.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/misc.c + + + wolfcrypt/pkcs12.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/pkcs12.c + + + wolfcrypt/pkcs7.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/pkcs7.c + + + wolfcrypt/poly1305.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/poly1305.c + + + wolfcrypt/port + 2 + virtual:/virtual + + + wolfcrypt/pwdbased.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/pwdbased.c + + + wolfcrypt/rabbit.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/rabbit.c + + + wolfcrypt/random.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/random.c + + + wolfcrypt/ripemd.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/ripemd.c + + + wolfcrypt/rsa.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/rsa.c + + + wolfcrypt/sha.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sha.c + + + wolfcrypt/sha256.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sha256.c + + + wolfcrypt/sha3.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sha3.c + + + wolfcrypt/sha512.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sha512.c + + + wolfcrypt/signature.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/signature.c + + + wolfcrypt/sp_arm32.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_arm32.c + + + wolfcrypt/sp_arm64.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_arm64.c + + + wolfcrypt/sp_armthumb.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_armthumb.c + + + wolfcrypt/sp_c32.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_c32.c + + + wolfcrypt/sp_c64.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_c64.c + + + wolfcrypt/sp_cortexm.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_cortexm.c + + + wolfcrypt/sp_int.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_int.c + + + wolfcrypt/sp_x86_64.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/sp_x86_64.c + + + wolfcrypt/srp.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/srp.c + + + wolfcrypt/tfm.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/tfm.c + + + wolfcrypt/wc_encrypt.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/wc_encrypt.c + + + wolfcrypt/wc_pkcs11.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/wc_pkcs11.c + + + wolfcrypt/wc_port.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/wc_port.c + + + wolfcrypt/wolfevent.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/wolfevent.c + + + wolfcrypt/wolfmath.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/wolfmath.c + + + wolfcrypt/port/Renesas + 2 + virtual:/virtual + + + wolfcrypt/port/af_alg + 2 + virtual:/virtual + + + wolfcrypt/port/arm + 2 + virtual:/virtual + + + wolfcrypt/port/Renesas/README.md + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/Renesas/README.md + + + wolfcrypt/port/Renesas/renesas_tsip_aes.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/Renesas/renesas_tsip_aes.c + + + wolfcrypt/port/Renesas/renesas_tsip_sha.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/Renesas/renesas_tsip_sha.c + + + wolfcrypt/port/Renesas/renesas_tsip_util.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/Renesas/renesas_tsip_util.c + + + wolfcrypt/port/af_alg/afalg_aes.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/af_alg/afalg_aes.c + + + wolfcrypt/port/af_alg/afalg_hash.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/af_alg/afalg_hash.c + + + wolfcrypt/port/af_alg/wc_afalg.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/af_alg/wc_afalg.c + + + wolfcrypt/port/arm/armv8-32-curve25519.S + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-32-curve25519.S + + + wolfcrypt/port/arm/armv8-32-curve25519.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-32-curve25519.c + + + wolfcrypt/port/arm/armv8-32-sha512-asm.S + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-32-sha512-asm.S + + + wolfcrypt/port/arm/armv8-32-sha512-asm.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-32-sha512-asm.c + + + wolfcrypt/port/arm/armv8-aes.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-aes.c + + + wolfcrypt/port/arm/armv8-chacha.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-chacha.c + + + wolfcrypt/port/arm/armv8-curve25519.S + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-curve25519.S + + + wolfcrypt/port/arm/armv8-curve25519.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-curve25519.c + + + wolfcrypt/port/arm/armv8-poly1305.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-poly1305.c + + + wolfcrypt/port/arm/armv8-sha256.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-sha256.c + + + wolfcrypt/port/arm/armv8-sha512-asm.S + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-sha512-asm.S + + + wolfcrypt/port/arm/armv8-sha512-asm.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-sha512-asm.c + + + wolfcrypt/port/arm/armv8-sha512.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/armv8-sha512.c + + + wolfcrypt/port/arm/cryptoCell.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/cryptoCell.c + + + wolfcrypt/port/arm/cryptoCellHash.c + 1 + PARENT-5-PROJECT_LOC/wolfcrypt/src/port/arm/cryptoCellHash.c + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/wolfssl/configuration.xml b/IDE/Renesas/e2studio/RA6M3G/wolfssl/configuration.xml new file mode 100644 index 000000000..8a0c408b9 --- /dev/null +++ b/IDE/Renesas/e2studio/RA6M3G/wolfssl/configuration.xml @@ -0,0 +1,368 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + I/O Port + Renesas.RA.0.8.0.pack + + + Board Support Package Common Files + Renesas.RA.0.8.0.pack + + + Arm CMSIS Version 5 - Core (M) + Arm.CMSIS5.5.5.1.pack + + + Amazon FreeRTOS + Amazon.AWS.0.8.0.pack + + + RA6M3G-EK Board Support Files + Renesas.RA_board_ra6m3g_ek.0.8.0.pack + + + Board support package for R7FA6M3AH3CFC + Renesas.RA_mcu_ra6m3.0.8.0.pack + + + Board support package for RA6M3 + Renesas.RA_mcu_ra6m3.0.8.0.pack + + + Board support package for RA6M3 + Renesas.RA_mcu_ra6m3.0.8.0.pack + + + Amazon FreeRTOS - Memory Management - Heap 4 + Amazon.AWS.0.8.0.pack + + + r_ether to FreeRTOS+TCP Wrapper + Renesas.RA.0.8.0.pack + + + Ethernet + Renesas.RA.0.8.0.pack + + + Ethernet PHY + Renesas.RA.0.8.0.pack + + + FreeRTOS+TCP + Amazon.AWS.0.8.0.pack + + + Amazon FreeRTOS - Buffer Allocation 2 + Amazon.AWS.0.8.0.pack + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/IDE/Renesas/e2studio/RA6M3G/wolfssl/src/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/wolfssl/src/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/Renesas/e2studio/RA6M3G/wolfssl/wolfcrypt/.gitkeep b/IDE/Renesas/e2studio/RA6M3G/wolfssl/wolfcrypt/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/IDE/include.am b/IDE/include.am index 2ea00f2de..d4d774a07 100644 --- a/IDE/include.am +++ b/IDE/include.am @@ -23,6 +23,7 @@ include IDE/ECLIPSE/SIFIVE/include.am include IDE/mynewt/include.am include IDE/Renesas/cs+/Projects/include.am include IDE/Renesas/e2studio/Projects/include.am +include IDE/Renesas/e2studio/RA6M3G/include.am include IDE/WICED-STUDIO/include.am include IDE/CRYPTOCELL/include.am include IDE/M68K/include.am diff --git a/src/internal.c b/src/internal.c index e88163632..e40a1220c 100644 --- a/src/internal.c +++ b/src/internal.c @@ -7006,6 +7006,15 @@ ProtocolVersion MakeDTLSv1_2(void) return (unsigned int)(((float)xTaskGetTickCount())/configTICK_RATE_HZ); } +#elif defined(FREERTOS) + + #include "task.h" + + unsigned int LowResTimer(void) + { + return (unsigned int)(((float)xTaskGetTickCount())/configTICK_RATE_HZ); + } + #elif defined(FREESCALE_KSDK_BM) #include "lwip/sys.h" /* lwIP */ diff --git a/wolfssl/wolfcrypt/settings.h b/wolfssl/wolfcrypt/settings.h index 572b108b6..b7beae382 100644 --- a/wolfssl/wolfcrypt/settings.h +++ b/wolfssl/wolfcrypt/settings.h @@ -285,6 +285,10 @@ #endif #endif +#if defined(WOLFSSL_RENESAS_RA6M3G) + /* settings in user_settings.h */ +#endif + #if defined(HAVE_LWIP_NATIVE) /* using LwIP native TCP socket */ #define WOLFSSL_LWIP #define NO_WRITEV diff --git a/wolfssl/wolfio.h b/wolfssl/wolfio.h index 9ea0a0322..0faac3887 100644 --- a/wolfssl/wolfio.h +++ b/wolfssl/wolfio.h @@ -148,6 +148,11 @@ #endif #endif #endif + + #if defined(WOLFSSL_RENESAS_RA6M3G) /* Uses FREERTOS_TCP */ + #include + #endif + #endif /* USE_WINDOWS_API */ #ifdef __sun