Update RZ examples

- Use xSPI0 boot mode
 - Update FSP from v1.3 to v2.0.0
 - Simplify UART
 - Migrate new User Ctx
 - Update README
 - Fix SCE TLS on RA6M4
This commit is contained in:
Hideki Miyazaki
2025-07-26 18:35:44 +09:00
parent a1e2ba2cd3
commit 9b7caac3ef
24 changed files with 870 additions and 425 deletions

View File

@@ -21,37 +21,49 @@ The example project summary is listed below and is relevant for every project.
### Project Summary
|Item|Name/Version|
|:--|:--|
|e2Studio|2025-04.1 (25.4.1)|
|Board|RZN2L|
|Device|R9A07G084M08GBG|
|Toolchain|GCC for Renesas RZ|
|Toolchain Version|10.3.1.20210824|
|FSP Version|1.2.0|
|FSP Version|2.0.0|
#### Selected software components
|Components|Version|Note|
|:--|:--|:--|
|Board Support Package Common Files|v1.20||
|I/O Port|v1.2.0||
|Arm CMSIS Version 5 - Core (M)|v5.7.0+renesas.1||
|Board support package for R9A07G084M04GBG|v1.2.0|Note1|
|Board support package for RZN2L|v1.2.0||
|Board support package for RZN2L - FSP Data|v1.2.0||
|RSK+RZN2L Board Support Files (RAM execution without flash memory)|v1.2.0||
|FreeRTOS - Buffer Allocation 2|v1.2.0||
|FreeRTOS - Memory Management - Heap 4|v1.2.0||
|FreeRTOS+TCP|v1.2.0||
|Ethernet PHY |v1.2.0||
|Ethernet Selector|v1.2.0||
|Ethernet|v1.2.0||
|Ethernet Switch|v1.2.0||
|SCI UART|v1.2.0||
|r_ether to FreeRTOS+TCP Wrapper|v1.2.0||
|Renesas Secure IP Driver|v1.3.0+fsp.1.2.0|Need to contact Renesas to get RSIP module|
|RSIP Engine for RZ/N2L|v1.3.0+fsp.1.2.0|Need to contact Renesas to get RSIP module|
|Board Support Package Common Files|v2.0.0||
|I/O Port|v2.0.0||
|Arm CMSIS Version 5 - Core (M)|v5.7.0+renesas.1.fsp.2.0.0||
|Board support package for R9A07G084M04GBG|v2.0.0|Note1|
|Board support package for RZN2L|v2.0.0||
|Board support package for RZN2L - FSP Data|v2.0.0||
|RSK+RZN2L Board Support Files (xSPI0 x1 boot mode)|v2.0.0||
|FreeRTOS - Buffer Allocation 2|v2.0.0||
|FreeRTOS - Memory Management - Heap 4|v2.0.0||
|FreeRTOS+TCP|v2.0.0||
|Ethernet PHY |v2.0.0||
|Ethernet Selector|v2.0.0||
|Ethernet|v2.0.0||
|Ethernet Switch|v2.0.0||
|SCI UART|v2.0.0||
|r_ether to FreeRTOS+TCP Wrapper|v2.0.0||
|Renesas Secure IP Driver|v1.5.0+fsp.1.3.0||
|RSIP Engine for RZ/N2L|v1.5.0+fsp.1.3.0||
Note1:\
To use RSIP driver, a device type should be `R9A07G084M04GBG`. However, choosing `R9A07G084M04GBG` won't allow to select `RSK+RZN2L` board. This example uses LED and external flash memory on `RSK + RZN2L` board. Therefore, the example temporary `R9A07G084M04GBG` for the device type. Updating e2studio or fsp could resolve the issue.
To use RSIP driver, a device type should be `R9A07G084M08GBG`. However, choosing `R9A07G084M04GBG` won't allow to select `RSK+RZN2L` board. This example uses LED and external flash memory on `RSK + RZN2L` board. Therefore, the example temporary `R9A07G084M04GBG` for the device type. Updating e2studio or fsp could resolve the issue.
## Board Settings
This example program uses `xSPI0 boot`. Therefore, the board's switch and jumper settings required to run the sample program from external flash are shown below. For details on each setting, see the Renesas Starter Kit+ for RZN2L User's Manual.
|Project|SW4-1|SW4-2|SW4-3|SW4-4|SW4-7|
|:--|:--|:--|:--|:--|:--|
|xSPI0 boot mode|ON|ON|ON|ON|OFF|
|Project|CN8|CN24|
|:--|:--|:--|
|xSPI0 boot mode|Short 2-3|Short2-3|
## Setup Steps and Build wolfSSL Library
@@ -63,7 +75,7 @@ Note1:\
+ Click File->New->`RZ/N C/C++ FSP Project`.
+ Enter project name `dummy_application`.
+ Select Board: to `RSK+RZN2L (RAM execution without flash memory)`.
+ Select Board: to `RSK+RZN2L (xSPI0 x1 boot mode)`.
+ Select Device: to `R9A07G084M04GBG`. Click Next.
+ Check to `Executable`
+ Select FreeRTOS from RTOS selection. Click Finish.
@@ -93,31 +105,125 @@ Note1:\
+ Click `Generate Project Content` on FSP configuration GUI
3.) Prepare UART to logging
+ Download Sample package from [BACnet Start-Up](https://www.renesas.com/us/en/products/microcontrollers-microprocessors/rz-mpus/bacnet-start-rzn2l-rsk)
+ Download Example packages from [RZ/N2L Group Example program](https://www.renesas.com/us/en/document/scd/rzn2l-group-example-program?r=1622651) and unzip the archived file.
+ unzip RZN2L_RSK_sci_uart_Rev200.zip
+ unzip RZN2L_RSK_sci_uart_Rev200/basis/gcc/RZN2L_RSK_sci_uart_Rev200a.zip
+
+ Copy the following C source files from the project to src/serial_io folder of `test_RZN2L`\
um_serial_io_uart.c\
um_serial_io_task_writer.c\
um_serial_io_cfg.h\
um_common_api.h\
um_common_cfg.h\
um_serial_io.c\
um_serial_io.h\
um_serial_io_api.h\
um_serial_io_internal.h
sio_char.h\
siochar.c
4.) Prepare loader project
+ Download Example packages from [RZ/N2L Group Example of separating loader program and application program projects](https://www.renesas.com/en/document/scd/11691006?language=en&r=1622651) and unzip the archived file.
+ Unzip `RZN2L_loader_application\gcc\xspi0bootx1\Loader_application_projects.zip
+ Copy `RZN2L_bsp_xspi0bootx1_loader` and `RZN2L_bsp_xspi0bootx1_app` to `<wolfSSL>\IDE\Renesas\e2studio\RZN2L` folder
+ Import `RZN2L_bsp_xspi0bootx1_loader` from `e2studio`
+ Open um_serial_io_task_writer.c and re-name printf to uart_printf
## Build `test_RZN2L`
1). Modify `fsp/src/bsp/cmsis/Device/RENESAS/Source/cr/startup_core.c`:
ORIGINAL
```
BSP_TARGET_ARM BSP_ATTRIBUTE_STACKLESS void __Vectors (void)
{
__asm volatile (
" ldr pc,=Reset_Handler \n"
```
==>
3.) Build `test_RZN2L` project
MODIFIED
```
BSP_TARGET_ARM BSP_ATTRIBUTE_STACKLESS void __Vectors (void)
{
__asm volatile (
#if 0
" ldr pc,=Reset_Handler \n"
#else
" ldr pc,=local_system_init \n"
#endif
```
1). Modify `fsp/src/bsp/cmsis/Device/RENESAS/Source/startup.c`:
## Run `test_RZN2L`
ORIGINAL
```
void SystemInit (void)
{
#if BSP_CFG_EARLY_INIT
...
#if BSP_CFG_C_RUNTIME_INIT
1). Right click the project and Select menu `Debug` -> `Renesas GDB Hardware debugging`
/* Copy the loader data from external Flash to internal RAM. */
bsp_loader_data_init();
2). Select J-Link ARM and R9A07G084M04
/* Clear loader bss section in internal RAM. */
bsp_loader_bss_init();
#endif
...
#if !(BSP_CFG_RAM_EXECUTION)
3). Break at Entry point. Change `cpsr` register value from 0xXXXXX1yy to 0xXXXXX1da
/* Copy the application program from external Flash to internal RAM. */
bsp_copy_to_ram();
/* Clear bss section in internal RAM. */
bsp_application_bss_init();
#endif
...
}
```
==>
MODIFIED
```
BSP_TARGET_ARM void mpu_cache_init (void)
{
...
if BSP_CFG_C_RUNTIME_INIT && !defined(EXTERNAL_LOADER_APP)
/* Copy the loader data from external Flash to internal RAM. */
bsp_loader_data_init();
/* Clear loader bss section in internal RAM. */
bsp_loader_bss_init();
#endif
...
#if !(BSP_CFG_RAM_EXECUTION) && !defined(EXTERNAL_LOADER_APP)
/* Copy the application program from external Flash to internal RAM. */
/* bsp_copy_to_ram(); */
/* Clear bss section in internal RAM. */
bsp_application_bss_init();
#endif
...
}
```
2). Copy contenst of `fsp_xspi0_boot_app.ld` of `RZN2L_bsp_xspi0bootx1_app\script\` to `test_RZN2L\script\fsp_xspi0_boot.ld`
3). Right click the project and Select menu `Debug` -> `Renesas GDB Hardware debugging`
4). Select J-Link ARM and R9A07G084M04
5). Build `test_RZN2L`
## Build loader project
+ Modify `src/Flash_section.s`:
ORIGINAL
```
.incbin "../../RZN2L_bsp_xspi0bootx1_app/Debug/RZN2L_bsp_xspi0bootx1_app.bin"
```
==>
MODIFIED
```
.incbin "../../test/Debug/test_RZN2L.bin"
```
+ Modify `Load Image and Symbol`. Open `Debug Configuration` -> Open `Statup` tab -> Replace `RZN2L_bsp_xspi0bootx1_app.elf` to `test_RZN2L.elf`
## Run loader and `test_RZN2L`
+ Run the loader project
+ Loader download `test_RZN2L` binary from flash to system ram and execute it.
+ Note: It recommends to re-build the loader project when re-building `test_RZN2L`
## Run TLS 1.3 Client
1.) Enable `WOLFSSL_TLS13` macro in `user_settings.h`

View File

@@ -20,6 +20,7 @@
*/
/* Operating Environment and Threading */
#if defined(WOLFSSL_RENESAS_RSIP)
#define WOLFSSL_RENESAS_RZFSP_VER 200
/* FSP SM stands for Flexible Software Package Security Module
* WOLFSSL_RENESAS_FSPSM enables fundamental code when it uses.
* e.g. Open/Close/Random generator
@@ -104,7 +105,9 @@
#endif
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
#define WOLF_CRYPTO_CB_RSA_PAD
#define WOLFSSL_KEY_GEN
#define RSA_MIN_SIZE 512
#endif
int uart_printf (const char *__restrict format, ...);
@@ -112,4 +115,7 @@ int uart_printf (const char *__restrict format, ...);
#define printf uart_printf
#define TEST_SLEEP() vTaskDelay(50)
#if defined(WOLFSSL_RENESAS_RSIP)
#define CUSTOM_RAND_GENERATE_BLOCK wc_fspsm_GenerateRandBlock
#endif

View File

@@ -10,7 +10,7 @@ EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfssl_dummy.c
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolf_client.c
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolf_server.c
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/test/wolfssl_rsip_unit_test.c
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/serial_io/.gitignore
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/serial_io/app_print.c
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfCrypt/.gitignore
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/test/src/wolfSSL/.gitignore
EXTRA_DIST+= IDE/Renesas/e2studio/RZN2L/common/wolfssl_demo.h

View File

@@ -43,7 +43,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.2133049482" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1476755314" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1180377769" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.385566364" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M04GBG" valueType="string"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.385566364" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M08GBG" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.85130646" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.438363043" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.family.734485543" name="Arm family (-mcpu)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-r52" valueType="enumerated"/>
@@ -66,6 +66,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.878213280" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include.1404470165" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
@@ -96,17 +97,32 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;.&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.920863118" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.compilerC.15728131" name="Cross ARM C Compiler" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.compilerC">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.2054256250" name="Language standard" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std" useByScannerDiscovery="true" value="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.std.c99" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.737680653" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
<listOptionValue builtIn="false" value="EXTERNAL_LOADER_APP"/>
<listOptionValue builtIn="false" value="WOLFSSL_RENESAS_RSIP"/>
<listOptionValue builtIn="false" value="WOLFSSL_RENESAS_RZN2L"/>
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include.1392028571" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/generate&quot;"/>
@@ -142,6 +158,20 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;.&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.1188589179" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
@@ -154,7 +184,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano.1707323954" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint.2121320154" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript.35544828" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;fsp_ram_execution.ld&quot;"/>
<listOptionValue builtIn="false" value="&quot;fsp_xspi0_boot.ld&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath.1169036561" name="User defined archive search directories (-L)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/script&quot;"/>
@@ -436,6 +466,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.managedbuild.gcc.rz.archives.includeFiles.1438841261" name="Standard archive (library) files (-l)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.includeFiles" valueType="stringList"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys.1028106860" name="Do not use syscalls (--specs=nosys.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnosys" value="false" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat.584424940" name="Use float with nano printf (-u _printf_float)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.useprintffloat" value="false" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano.2085931869" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano" value="true" valueType="boolean"/>
<inputType id="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c.1165207646" superClass="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinputdependency" paths="$(LIBRARY_GENERATOR_OUTPUTTYPE_OUTPUTS)"/>
@@ -448,12 +479,16 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano.1744364271" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint.1291406965" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript.310553223" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;fsp_ram_execution.ld&quot;"/>
<listOptionValue builtIn="false" value="&quot;fsp_xspi0_boot.ld&quot;"/>
</option>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano.803193311" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano" value="true" valueType="boolean"/>
</tool>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver.1683309259" name="Cross ARM GNU Archiver" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver"/>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.flash.495323055" name="Cross ARM GNU Create Flash Image" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.flash">
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice.1427749577" name="Output file format (-O)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice" value="ilg.gnuarmeclipse.managedbuild.cross.option.createflash.choice.srec" valueType="enumerated"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice.1427749577" name="Output file format (-O)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.choice" value="ilg.gnuarmeclipse.managedbuild.cross.option.createflash.choice.binary" valueType="enumerated"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.flash.other.182390017" name="Other flags" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.flash.other" valueType="stringList">
<listOptionValue builtIn="false" value="--gap-fill 0xff"/>
</option>
</tool>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.listing.1833581304" name="Cross ARM GNU Create Listing" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.listing">
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source.421010994" name="Display source (--source|-S)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.createlisting.source" value="true" valueType="boolean"/>
@@ -784,7 +819,7 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop.926371065" name="Warn if suspicious logical ops (-Wlogical-op)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.logicalop" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn.1328296477" name="Warn if struct is returned (-Wagreggate-return)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.agreggatereturn" value="true" valueType="boolean"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal.1500121997" name="Warn if floats are compared as equal (-Wfloat-equal)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.warnings.floatequal" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.1664475593" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M04GBG" valueType="string"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.deviceName.1664475593" name="Device name" superClass="com.renesas.cdt.managedbuild.gcc.rz.deviceName" value="R9A07G084M08GBG" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name.75533497" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.toolchain.name" value="GNU Tools for ARM Embedded Processors" valueType="string"/>
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.349814325" name="Architecture" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.architecture" value="ilg.gnuarmeclipse.managedbuild.cross.option.architecture.arm" valueType="enumerated"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.family.2115333421" name="Arm family (-mcpu)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.family" value="ilg.gnuarmeclipse.managedbuild.cross.option.arm.target.mcpu.cortex-r52" valueType="enumerated"/>
@@ -807,6 +842,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs.305259748" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.assembler.defs" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include.1749182888" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.assembler.include" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/src}&quot;"/>
@@ -837,6 +873,20 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;.&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input.456671311" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.assembler.input"/>
</tool>
@@ -845,6 +895,7 @@
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs.856881917" name="Defined symbols (-D)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.compiler.defs" useByScannerDiscovery="true" valueType="definedSymbols">
<listOptionValue builtIn="false" value="_RENESAS_RZN_"/>
<listOptionValue builtIn="false" value="_RZN_CORE=CR52_0"/>
<listOptionValue builtIn="false" value="_RZN_ORDINAL=1"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include.1411892430" name="Include paths (-I)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.compiler.include" useByScannerDiscovery="false" valueType="includePath">
<listOptionValue builtIn="false" value="&quot;${ProjDirPath}/generate&quot;"/>
@@ -877,6 +928,20 @@
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip/rzt2n2/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;.&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/bsp/mcu/all/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/ca}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/rm_freertos_port/cr}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/arm/CMSIS_5/CMSIS/Core_A/Include}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/sb_lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/rsip/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/otp/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private/lib/inc}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/rzt_rzn/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/primitive}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/private}&quot;"/>
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}/rzn/fsp/src/r_rsip_protected/src/common/public}&quot;"/>
</option>
<inputType id="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input.179835817" superClass="ilg.gnuarmeclipse.managedbuild.cross.tool.c.compiler.input"/>
</tool>
@@ -889,11 +954,12 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano.2140522055" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.c.linker.usenewlibnano" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint.2072792159" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript.1599876065" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linkerscript" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;fsp_ram_execution.ld&quot;"/>
<listOptionValue builtIn="false" value="&quot;fsp_xspi0_boot.ld&quot;"/>
</option>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath.1202803303" name="User defined archive search directories (-L)" superClass="com.renesas.cdt.managedbuild.gcc.rz.archives.userIncludePath" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}/script&quot;"/>
</option>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano.885232888" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.usenewlibnano" value="true" valueType="boolean"/>
<inputType id="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c.899703779" superClass="com.renesas.cdt.managedbuild.gcc.rz.inputType.linker.c">
<additionalInput kind="additionalinputdependency" paths="$(USER_OBJS)"/>
<additionalInput kind="additionalinputdependency" paths="$(LIBRARY_GENERATOR_OUTPUTTYPE_OUTPUTS)"/>
@@ -906,8 +972,9 @@
<option id="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano.1225392189" name="Use newlib-nano (--specs=nano.specs)" superClass="ilg.gnuarmeclipse.managedbuild.cross.option.cpp.linker.usenewlibnano" value="true" valueType="boolean"/>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint.827697822" name="Entry Point:" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.entrypoint" value="-Wl,-esystem_init" valueType="string"/>
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript.963403495" name="Script files (-T)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.cpp.linkerscript" valueType="stringList">
<listOptionValue builtIn="false" value="&quot;fsp_ram_execution.ld&quot;"/>
<listOptionValue builtIn="false" value="&quot;fsp_xspi0_boot.ld&quot;"/>
</option>
<option id="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano.1785719899" name="Use newlib-nano (--specs=nano.specs)" superClass="com.renesas.cdt.managedbuild.gcc.rz.option.linker.cpp.usenewlibnano" value="true" valueType="boolean"/>
</tool>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver.1356408537" name="Cross ARM GNU Archiver" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.archiver"/>
<tool id="com.renesas.cdt.managedbuild.gcc.rz.tool.flash.1736780445" name="Cross ARM GNU Create Flash Image" superClass="com.renesas.cdt.managedbuild.gcc.rz.tool.flash">

View File

@@ -1,243 +0,0 @@
/*
Linker File for Renesas RZ/N2L FSP
*/
MEMORY
{
ATCM : ORIGIN = 0x00000000, LENGTH = 0x00020000
BTCM : ORIGIN = 0x00100000, LENGTH = 0x00020000
SYSTEM_RAM : ORIGIN = 0x10000000, LENGTH = 0x00180000
SYSTEM_RAM_MIRROR : ORIGIN = 0x30000000, LENGTH = 0x00180000
xSPI0_CS0_SPACE_MIRROR : ORIGIN = 0x40000000, LENGTH = 0x04000000
xSPI0_CS1_SPACE_MIRROR : ORIGIN = 0x44000000, LENGTH = 0x04000000
xSPI1_CS0_SPACE_MIRROR : ORIGIN = 0x48000000, LENGTH = 0x04000000
xSPI1_CS1_SPACE_MIRROR : ORIGIN = 0x4C000000, LENGTH = 0x04000000
CS0_SPACE_MIRROR : ORIGIN = 0x50000000, LENGTH = 0x04000000
CS2_SPACE_MIRROR : ORIGIN = 0x54000000, LENGTH = 0x04000000
CS3_SPACE_MIRROR : ORIGIN = 0x58000000, LENGTH = 0x04000000
CS5_SPACE_MIRROR : ORIGIN = 0x5C000000, LENGTH = 0x04000000
xSPI0_CS0_SPACE : ORIGIN = 0x60000000, LENGTH = 0x04000000
xSPI0_CS1_SPACE : ORIGIN = 0x64000000, LENGTH = 0x04000000
xSPI1_CS0_SPACE : ORIGIN = 0x68000000, LENGTH = 0x04000000
xSPI1_CS1_SPACE : ORIGIN = 0x6C000000, LENGTH = 0x04000000
CS0_SPACE : ORIGIN = 0x70000000, LENGTH = 0x04000000
CS2_SPACE : ORIGIN = 0x74000000, LENGTH = 0x04000000
CS3_SPACE : ORIGIN = 0x78000000, LENGTH = 0x04000000
CS5_SPACE : ORIGIN = 0x7C000000, LENGTH = 0x04000000
}
SECTIONS
{
.loader_text 0x00102000 : AT (0x00102000)
{
*(.loader_text)
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.text*)
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.text*)
*/fsp/src/bsp/mcu/all/bsp_irq.o(.text*)
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.text*)
*/fsp/src/r_ioport/r_ioport.o(.text*)
KEEP(*(.warm_start))
} > BTCM
.loader_data :
{
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.data*)
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.data*)
*/fsp/src/bsp/mcu/all/bsp_irq.o(.data*)
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.data*)
*/fsp/src/r_ioport/r_ioport.o(.data*)
__loader_bss_start = .;
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(.bss*)
*/fsp/src/bsp/mcu/all/bsp_clocks.o(.bss*)
*/fsp/src/bsp/mcu/all/bsp_irq.o(.bss*)
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.bss*)
*/fsp/src/r_ioport/r_ioport.o(.bss*)
*/fsp/src/bsp/cmsis/Device/RENESAS/Source/*.o(COMMON)
*/fsp/src/bsp/mcu/all/bsp_clocks.o(COMMON)
*/fsp/src/bsp/mcu/all/bsp_irq.o(COMMON)
*/fsp/src/bsp/mcu/all/bsp_register_protection.o(.COMMON)
*/fsp/src/r_ioport/r_ioport.o(.COMMON)
__loader_bss_end = . ;
} > BTCM
.intvec 0x00000000 : AT (0x00000000)
{
_fvector_start = .;
KEEP(*(.intvec))
_fvector_end = .;
} > ATCM
.text 0x30000000 : AT (0x30000000)
{
_text_start = .;
*(.text*)
KEEP(*(.init))
KEEP(*(.fini))
/* .ctors */
*crtbegin.o(.ctors)
*crtbegin?.o(.ctors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .ctors)
*(SORT(.ctors.*))
*(.ctors)
_ctor_end = .;
/* .dtors */
*crtbegin.o(.dtors)
*crtbegin?.o(.dtors)
*(EXCLUDE_FILE(*crtend?.o *crtend.o) .dtors)
*(SORT(.dtors.*))
*(.dtors)
_dtor_end = .;
*(.rodata*)
_erodata = .;
KEEP(*(.eh_frame*))
} > SYSTEM_RAM_MIRROR
.rvectors :
{
_rvectors_start = .;
KEEP(*(.rvectors))
_rvectors_end = .;
} > SYSTEM_RAM_MIRROR
.ARM.extab :
{
*(.ARM.extab* .gnu.linkonce.armextab.*)
} > SYSTEM_RAM_MIRROR
__exidx_start = .;
.ARM.exidx :
{
*(.ARM.exidx* .gnu.linkonce.armexidx.*)
} > SYSTEM_RAM_MIRROR
__exidx_end = .;
.got :
{
*(.got)
*(.got.plt)
_text_end = .;
} > SYSTEM_RAM_MIRROR
.data :
{
_data_start = .;
*(vtable)
*(.data.*)
*(.data)
. = ALIGN(4);
/* preinit data */
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP(*(.preinit_array))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
/* init data */
PROVIDE_HIDDEN (__init_array_start = .);
KEEP(*(SORT(.init_array.*)))
KEEP(*(.init_array))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
/* finit data */
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP(*(SORT(.fini_array.*)))
KEEP(*(.fini_array))
PROVIDE_HIDDEN (__fini_array_end = .);
KEEP(*(.jcr*))
. = ALIGN(4);
/* All data end */
_data_end = .;
} > SYSTEM_RAM_MIRROR
.bss :
{
. = ALIGN(4);
__bss_start__ = .;
_bss = .;
*(.bss*)
*(COMMON)
. = ALIGN(4);
__bss_end__ = .;
_ebss = .;
_end = .;
} > SYSTEM_RAM_MIRROR
.heap (NOLOAD) :
{
. = ALIGN(8);
__HeapBase = .;
/* Place the STD heap here. */
KEEP(*(.heap))
__HeapLimit = .;
} > SYSTEM_RAM_MIRROR
.thread_stack (NOLOAD):
{
. = ALIGN(8);
__ThreadStackBase = .;
/* Place the Thread stacks here. */
KEEP(*(.stack*))
__ThreadStackLimit = .;
} > SYSTEM_RAM_MIRROR
.sys_stack (NOLOAD) :
{
. = ALIGN(8);
__SysStackBase = .;
/* Place the sys_stack here. */
KEEP(*(.sys_stack))
__SysStackLimit = .;
} > BTCM
.svc_stack (NOLOAD) :
{
. = ALIGN(8);
__SvcStackBase = .;
/* Place the svc_stack here. */
KEEP(*(.svc_stack))
__SvcStackLimit = .;
} > BTCM
.irq_stack (NOLOAD) :
{
. = ALIGN(8);
__IrqStackBase = .;
/* Place the irq_stack here. */
KEEP(*(.irq_stack))
__IrqStackLimit = .;
} > BTCM
.fiq_stack (NOLOAD) :
{
. = ALIGN(8);
__FiqStackBase = .;
/* Place the fiq_stack here. */
KEEP(*(.fiq_stack))
__FiqStackLimit = .;
} > BTCM
.und_stack (NOLOAD) :
{
. = ALIGN(8);
__UndStackBase = .;
/* Place the und_stack here. */
KEEP(*(.und_stack))
__UndStackLimit = .;
} > BTCM
.abt_stack (NOLOAD) :
{
. = ALIGN(8);
__AbtStackBase = .;
/* Place the abt_stack here. */
KEEP(*(.abt_stack))
__AbtStackLimit = .;
} > BTCM
.shared_noncache_buffer 0x300C0000 : AT (0x300C0000)
{
. = ALIGN(32);
_sncbuffer_start = .;
KEEP(*(.shared_noncache_buffer*))
_sncbuffer_end = .;
} > SYSTEM_RAM_MIRROR
.noncache_buffer 0x30100000 : AT (0x30100000)
{
. = ALIGN(32);
_ncbuffer_start = .;
KEEP(*(.noncache_buffer*))
_ncbuffer_end = .;
} > SYSTEM_RAM_MIRROR
}

View File

@@ -0,0 +1,54 @@
/* local_system_init.c
*
* Custom configuration for wolfCrypt/wolfSSL.
* Enabled via WOLFSSL_USER_SETTINGS.
*
*
* Copyright (C) 2024 wolfSSL Inc.
*
* This file is part of wolfBoot.
*
* wolfBoot 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 3 of the License, or
* (at your option) any later version.
*
* wolfBoot 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"
void local_system_init (void);
BSP_TARGET_ARM void local_system_init (void)
{
#if 1
/* This software loops are only needed when debugging. */
__asm volatile (
" mov r0, #0 \n"
" movw r1, #0xf07f \n"
" movt r1, #0x2fa \n"
"software_loop: \n"
" adds r0, #1 \n"
" cmp r0, r1 \n"
" bne software_loop \n"
::: "memory");
#endif
__asm volatile (
"set_vbar: \n"
" LDR r0, =__Vectors \n"
" MCR p15, #0, r0, c12, c0, #0 \n" /* Write r0 to VBAR */
::: "memory");
__asm volatile (
"jump_stack_init: \n"
" ldr r0, =stack_init \n"
" blx r0 \n" /* Jump to stack_init */
);
}

View File

@@ -20,13 +20,10 @@
*/
#include "rzn2l_tst_thread.h"
#include "um_common_cfg.h"
#include "um_common_api.h"
#include "um_serial_io_api.h"
#include "um_serial_io.h"
#include "wolfssl_demo.h"
#include "user_settings.h"
#include "sio_char.h"
#include <stdio.h>
typedef struct func_args {
int argc;
@@ -34,23 +31,20 @@ typedef struct func_args {
int return_code;
} func_args;
static serial_io_instance_ctrl_t g_serial_io0_ctrl;
static serial_io_cfg_t const g_serial_io0_cfg =
{
.p_uart_instance = &g_uart0,
};
serial_io_instance_t const g_serial_io0 =
{
.p_ctrl = &g_serial_io0_ctrl,
.p_cfg = &g_serial_io0_cfg,
.p_api = &g_serial_io_on_serial_io,
};
FSP_CPP_HEADER
void R_BSP_WarmStart(bsp_warm_start_event_t event)
BSP_PLACE_IN_SECTION(".warm_start");
FSP_CPP_FOOTER
void user_uart_callback (uart_callback_args_t * p_args);
void Clr_CallbackCtx(FSPSM_ST *g);
void RSIP_KeyGeneration(FSPSM_ST *g);
uint32_t volatile g_tx_complete = 0;
uint32_t volatile g_rx_complete = 0;
uint32_t g_ofband_index = 0;
uint8_t g_ofband_received[TRANSFER_LENGTH];
void R_BSP_WarmStart(bsp_warm_start_event_t event)
{
if (BSP_WARM_START_RESET == event) {
@@ -61,8 +55,47 @@ void R_BSP_WarmStart(bsp_warm_start_event_t event)
}
}
#if defined(TLS_CLIENT) || \
defined(TLS_SERVER)
void user_uart_callback (uart_callback_args_t* p_args)
{
/* Handle the UART event */
switch (p_args->event)
{
/* Received a character */
case UART_EVENT_RX_CHAR:
/* Only put the next character in the receive
* buffer if there is space for it
*/
if (sizeof(g_ofband_received) > g_ofband_index)
{
/* Write either the next one or two bytes
* depending on the receive data size
*/
if ((UART_DATA_BITS_7 == g_uart0_cfg.data_bits) ||
(UART_DATA_BITS_8 == g_uart0_cfg.data_bits))
{
g_ofband_received[g_ofband_index++] =
(uint8_t) p_args->data;
} else {
uint16_t * p_dest =
(uint16_t *)&g_ofband_received[g_ofband_index];
*p_dest = (uint16_t) p_args->data;
g_ofband_index += 2;
}
}
break;
/* Receive complete */
case UART_EVENT_RX_COMPLETE:
g_rx_complete = 1;
break;
/* Transmit complete */
case UART_EVENT_TX_COMPLETE:
g_tx_complete = 1;
break;
default:break;
}
}
#if defined(TLS_CLIENT) || defined(TLS_SERVER)
extern uint8_t g_ether0_mac_address[6];
const byte ucIPAddress[4] = { 192, 168, 11, 241 };
const byte ucNetMask[4] = { 255, 255, 255, 0 };
@@ -82,9 +115,6 @@ void R_BSP_WarmStart(bsp_warm_start_event_t event)
FSPSM_ST guser_PKCbInfo;
#endif
void Clr_CallbackCtx(FSPSM_ST *g);
void RSIP_KeyGeneration(FSPSM_ST *g);
void RSIP_KeyGeneration(FSPSM_ST *g)
{
fsp_err_t rsip_error_code = FSP_SUCCESS;
@@ -201,36 +231,16 @@ void wolfSSL_TLS_cleanup()
#endif
serial_io_instance_t const * gp_serial_io0 = &g_serial_io0;
static void serial_init()
{
usr_err_t usr_err;
/** Open Serial I/O module. */
usr_err = gp_serial_io0->p_api->open
(gp_serial_io0->p_ctrl, gp_serial_io0->p_cfg );
if( USR_SUCCESS != usr_err )
{
USR_DEBUG_BLOCK_CPU();
}
/** Start Serial I/O module. */
usr_err = gp_serial_io0->p_api->start( gp_serial_io0->p_ctrl );
if( USR_SUCCESS != usr_err )
{
USR_DEBUG_BLOCK_CPU();
}
printf( " Started Serial I/O interface." );
}
/* rzn2l_tst_thread entry function */
/* pvParameters contains TaskHandle_t */
void rzn2l_tst_thread_entry(void *pvParameters)
{
FSP_PARAMETER_NOT_USED (pvParameters);
serial_init();
fsp_err_t err;
(void)err;
/* Open the transfer instance with initial configuration. */
err = R_SCI_UART_Open(&g_uart0_ctrl, &g_uart0_cfg);
#if defined(UNIT_TEST)
@@ -368,8 +378,8 @@ void rzn2l_tst_thread_entry(void *pvParameters)
TCPInit();
int TCP_connect_retry = 0;
printf("\n Start TLS Connection to %s port(%d)\n", SERVER_IP, DEFAULT_PORT);
printf("\n");
printf("Start TLS Connection to %s port(%d)\n", SERVER_IP, DEFAULT_PORT);
wolfSSL_TLS_client_init();
do {

View File

@@ -1,2 +0,0 @@
*
!.gitignore

View File

@@ -0,0 +1,83 @@
/* app_print.c
*
* Copyright (C) 2006-2025 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 3 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 <stdint.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
#include "hal_data.h"
static char g_uart_buf[256]; ///< uart tx buffer
extern volatile uint32_t g_tx_complete;
void uart_printf( const char *format, ... );
void uart_printf( const char *format, ... )
{
va_list va;
uint32_t bytes;
uint32_t offset, len, skip;
char chara;
const char ch = '\r';
char* p;
va_start( va, format );
bytes = (uint32_t)vsprintf(g_uart_buf, format, va);
va_end( va );
if (bytes > 0) {
p = &g_uart_buf[0];
offset = 0;
skip = 0;
do {
len = 0;
skip = 0;
for (;offset < bytes; offset++, len++) {
chara = g_uart_buf[offset];
if ('\n' == chara) {
skip = 1;
len += 1;
break;
}
if ('\r' == chara && (offset + 1) < bytes &&
'\n' == g_uart_buf[offset + 1]){
skip = 2;
len += 2;
break;
}
}
/* write buffer without LF */
R_SCI_UART_Write(&g_uart0_ctrl, (uint8_t*)p, len);
while(!g_tx_complete);
g_tx_complete = 0;
if (skip > 0) {
R_SCI_UART_Write(&g_uart0_ctrl, (uint8_t*)&ch, 1);
while(!g_tx_complete);
}
p += (len + skip);
offset += skip;
} while(offset < bytes);
}
g_tx_complete = 0;
}

View File

@@ -81,7 +81,7 @@ int rsip_crypt_sha_multitest();
int rsip_crypt_test();
void Clr_CallbackCtx(FSPSM_ST *g);
void RSIP_KeyGeneration(FSPSM_ST *g);
FSPSM_ST gCbInfo;
FSPSM_ST gCbInfo_a; /* for multi testing */
@@ -656,7 +656,6 @@ static int rsip_rsa_test(int prnt, int keySize)
const char inStr2[] = TEST_STRING2;
const word32 inLen = (word32)TEST_STRING_SZ;
const word32 outSz = RSA_TEST_BYTES;
word32 out_actual_len = 0;
byte *in = NULL;
byte *in2 = NULL;
byte *out= NULL;
@@ -738,6 +737,7 @@ static int rsip_rsa_SignVerify_test(int prnt, int keySize)
const char inStr2[] = TEST_STRING2;
const word32 inLen = (word32)TEST_STRING_SZ;
const word32 outSz = RSA_TEST_BYTES;
(void)sigSz;
byte *in = NULL;
byte *in2 = NULL;
@@ -1179,7 +1179,7 @@ int rsip_crypt_test()
/* Generate AES sce Key */
if (rsip_error_code == FSP_SUCCESS) {
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
#if defined(WOLFSSL_RENESAS_RSIP_CRYPTONLY)
/* set up Crypt Call back */
Clr_CallbackCtx(&gCbInfo);
Clr_CallbackCtx(&gCbInfo_a);
@@ -1207,40 +1207,51 @@ int rsip_crypt_test()
devId1 = ret;
ret = 0;
}
#if RSA_MIN_SIZE < 1024
if (ret == 0) {
printf(" rsip_rsa_test(512)(this will be done"
" by SW because RSIP doesn't support 512 bits key size.)");
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 0;
ret = rsip_rsa_test(1, 512);
RESULT_STR(ret)
}
#endif
#if RSA_MIN_SIZE <= 1024
if (ret == 0) {
printf(" rsip_rsa_test(1024)");
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 1;
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 1;
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 0;
ret = rsip_rsa_test(1, 1024);
RESULT_STR(ret)
}
if (ret == 0) {
printf(" rsip_rsa_test(2048)");
ret = rsip_rsa_test(1, 2048);
RESULT_STR(ret)
}
if (ret == 0) {
gCbInfo.hash_type = RSIP_HASH_TYPE_SHA256 ;
printf(" rsip_rsa_SignVerify_test(1024)");
ret = rsip_rsa_SignVerify_test(1, 1024);
RESULT_STR(ret)
}
#endif
if (ret == 0) {
printf(" rsip_rsa_test(2048)");
gCbInfo.keyflgs_crypt.bits.rsapri1024_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapub1024_installedkey_set = 0;
gCbInfo.keyflgs_crypt.bits.rsapri2048_installedkey_set = 1;
gCbInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 1;
ret = rsip_rsa_test(1, 2048);
RESULT_STR(ret)
}
if (ret == 0 && rsip_error_code == FSP_SUCCESS) {
printf(" rsip_rsa_SignVerify_test(2048)");
ret = rsip_rsa_SignVerify_test(1, 2048);
RESULT_STR(ret)
}
#endif /* WOLFSSL_RENESAS_RSIP_CRYPTONLY */
#endif /* WOLFSSL_RENESAS_RSIP_CRYPTONLY */
#ifndef NO_SHA256
printf(" sha256_test()");
@@ -1293,7 +1304,7 @@ int rsip_crypt_test()
}
if (ret == 0) {
printf("rsip_crypt_Sha_AesCbcGcm_multitest\n");
printf(" multi Sha AesCbcGcm thread test\n");
ret = rsip_crypt_Sha_AesCbcGcm_multitest();
}

View File

@@ -21,13 +21,30 @@
#include <wolfssl/wolfcrypt/wc_port.h>
#define YEAR 2023
#define MON 9
static int tick = 0;
#define YEAR ( \
((__DATE__)[7] - '0') * 1000 + \
((__DATE__)[8] - '0') * 100 + \
((__DATE__)[9] - '0') * 10 + \
((__DATE__)[10] - '0') * 1 \
)
#define MONTH ( \
__DATE__[2] == 'n' ? (__DATE__[1] == 'a' ? 1 : 6) \
: __DATE__[2] == 'b' ? 2 \
: __DATE__[2] == 'r' ? (__DATE__[0] == 'M' ? 3 : 4) \
: __DATE__[2] == 'y' ? 5 \
: __DATE__[2] == 'l' ? 7 \
: __DATE__[2] == 'g' ? 8 \
: __DATE__[2] == 'p' ? 9 \
: __DATE__[2] == 't' ? 10 \
: __DATE__[2] == 'v' ? 11 \
: 12 \
)
time_t time(time_t *t)
{
(void)t;
return ((YEAR-1970)*365+30*MON)*24*60*60 + tick++;
return ((YEAR-1970)*365+30*MONTH)*24*60*60 + tick++;
}

View File

@@ -44,15 +44,22 @@
#define cmn_hw_lock tsip_hw_lock
#define cmn_hw_unlock tsip_hw_unlock
#define FSPSM_ST TsipUserCtx;
#define MAX_FSPSM_CBINDEX 5
#define FSPSM_ST TsipUserCtx;
#define FSPSM_ST_Internal TsipUserCtx_Internal
#endif
#include <wolfssl/wolfcrypt/wc_port.h>
#include <wolfssl/wolfcrypt/types.h>
#include <wolfssl/wolfcrypt/asn.h>
#ifdef NO_INLINE
#include <wolfssl/wolfcrypt/misc.h>
#else
#define WOLFSSL_MISC_INCLUDED
#include <wolfcrypt/src/misc.c>
#endif
#ifndef WOLFSSL_RENESAS_TSIP_CRYPTONLY
#include <wolfssl/internal.h>
#include <wolfssl/internal.h>
#endif
#include <wolfssl/error-ssl.h>
#include <wolfssl/wolfcrypt/error-crypt.h>
@@ -65,16 +72,9 @@ uint32_t g_CAscm_Idx = (uint32_t)-1; /* index of CM table */
static int gdevId = INITIAL_DEVID; /* initial dev Id for Crypt Callback */
#ifdef WOLF_CRYPTO_CB
/* store callback ctx by devId */
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
#define MAX_FSPSM_CBINDEX 5
FSPSM_ST *gCbCtx[MAX_FSPSM_CBINDEX];
#elif defined(WOLFSSL_RENESAS_TSIP_TLS) || \
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
#define FSPSM_ST TsipUserCtx;
#define MAX_FSPSM_CBINDEX 5
TsipUserCtx *gCbCtx[MAX_FSPSM_CBINDEX];
#endif
#include <wolfssl/wolfcrypt/cryptocb.h>
@@ -274,8 +274,9 @@ static int Renesas_cmn_CryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
#endif /* HAVE_ECC */
}
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
#elif (defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY))\
&& !defined(NO_WOLFSSL_RENESAS_FSPSM_AES)
if (info->algo_type == WC_ALGO_TYPE_CIPHER) {
#if !defined(NO_AES)
@@ -285,6 +286,20 @@ static int Renesas_cmn_CryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
#if !defined(NO_RSA) && defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
else if (info->algo_type == WC_ALGO_TYPE_PK) {
if (info->pk.type == WC_PK_TYPE_RSA_GET_SIZE) {
if (cbInfo->keyflgs_crypt.bits.rsapri2048_installedkey_set ||
cbInfo->keyflgs_crypt.bits.rsapub2048_installedkey_set )
{
*info->pk.rsa_get_size.keySize = 256;
ret = 0;
} else if (
cbInfo->keyflgs_crypt.bits.rsapri1024_installedkey_set ||
cbInfo->keyflgs_crypt.bits.rsapub1024_installedkey_set )
{
*info->pk.rsa_get_size.keySize = 128;
ret = 0;
}
}
#if defined(WOLFSSL_KEY_GEN)
if (info->pk.type == WC_PK_TYPE_RSA_KEYGEN) {
ret = wc_fspsm_MakeRsaKey(info->pk.rsakg.key,
@@ -400,13 +415,8 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
(void)ssl;
(void)ctx;
#if defined(WOLFSSL_RENESAS_TSIP_TLS) || \
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
TsipUserCtx* cbInfo = (TsipUserCtx*)ctx;
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS) || \
defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
FSPSM_ST* cbInfo = (FSPSM_ST*)ctx;
#endif
size_t internal_sz = sizeof(FSPSM_ST_Internal);
if (cbInfo == NULL
#if (!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY) && \
@@ -418,6 +428,27 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
WOLFSSL_MSG("Invalid devId\n");
return INVALID_DEVID;
}
/* On Crypt Only mode, it is possible to call this method
* first. On that time, internal instance has not yet been allocated.
*/
if (!cbInfo->internal) {
if (!ssl)
cbInfo->internal =
(FSPSM_ST_Internal*)XMALLOC(internal_sz, ssl->heap,
DYNAMIC_TYPE_TMP_BUFFER);
else
cbInfo->internal = (FSPSM_ST_Internal*)XMALLOC(internal_sz, NULL,
DYNAMIC_TYPE_TMP_BUFFER);
if (!cbInfo->internal) {
return MEMORY_E;
}
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) ||\
defined(WOLFSSL_RENESAS_TSIP_TLS)
if (ssl)
cbInfo->internal->heap = ssl->heap;
#endif
ForceZero(cbInfo->internal, internal_sz);
}
/* need exclusive control because of static variable */
if ((cmn_hw_lock()) == 0) {
/* sanity check for overflow */
@@ -459,7 +490,23 @@ int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx)
*/
void wc_CryptoCb_CleanupRenesasCmn(int* id)
{
FSPSM_ST* cbInfo = NULL;
wc_CryptoCb_UnRegisterDevice(*id);
/* retrieve internal instance */
cbInfo = (FSPSM_ST*)gCbCtx[cbInfo->internal->devId - INITIAL_DEVID];
if (!cbInfo->internal) {
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) && \
!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
XFREE(cbInfo->internal, cbInfo->internal->heap,
DYNAMIC_TYPE_TMP_BUFFER);
#else
XFREE(cbInfo->internal, NULL, DYNAMIC_TYPE_TMP_BUFFER);
#endif
cbInfo->internal = NULL;
}
*id = INVALID_DEVID;
}
@@ -754,7 +801,7 @@ WOLFSSL_LOCAL int Renesas_cmn_generateSessionKey(WOLFSSL* ssl, void* ctx)
ret = wc_tsip_generateSessionKey(ssl, cbInfo,
cbInfo->internal->devId);
#elif defined(WOLFSSL_RENESAS_FSPSM_TLS)
ret = wc_fspsm_generateSessionKey(ssl, ctx, cbInfo->devId);
ret = wc_fspsm_generateSessionKey(ssl, ctx, cbInfo->internal->devId);
#endif
}
else {

View File

@@ -49,7 +49,7 @@
struct Aes;
WOLFSSL_LOCAL void *Renesas_cmn_GetCbCtxBydevId(int devId);
void *Renesas_cmn_GetCbCtxBydevId(int devId);
#define SCE_AES_GCM_AUTH_TAG_SIZE 16
@@ -60,14 +60,16 @@ extern FSPSM_INSTANCE gFSPSM_ctrl;
typedef fsp_err_t (*aesGcmEncInitFn)
(FSPSM_AESGCM_HANDLE*, FSPSM_AES_PWKEY, uint8_t*, uint32_t);
typedef fsp_err_t (*aesGcmEncUpdateFn)
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t);
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t,
uint32_t*);
typedef fsp_err_t (*aesGcmEncFinalFn)
(FSPSM_AESGCM_HANDLE*, uint8_t*, uint32_t*, uint8_t*);
typedef fsp_err_t (*aesGcmDecInitFn)
(FSPSM_AESGCM_HANDLE*, FSPSM_AES_PWKEY, uint8_t*, uint32_t);
typedef fsp_err_t (*aesGcmDecUpdateFn)
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t);
(FSPSM_AESGCM_HANDLE*,uint8_t*, uint8_t*, uint32_t, uint8_t*, uint32_t,
uint32_t*);
typedef fsp_err_t (*aesGcmDecFinalFn)
(FSPSM_AESGCM_HANDLE*, uint8_t*, uint32_t*, uint8_t*, uint32_t);
@@ -77,72 +79,136 @@ static fsp_err_t _R_RSIP_AES_GCM_EncryptInit(FSPSM_AESGCM_HANDLE* h,
FSPSM_AES_PWKEY k, uint8_t* iv,
uint32_t iv_l)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_AES_AEAD_Init(&gFSPSM_ctrl, RSIP_AES_AEAD_MODE_GCM_ENC,
(FSPSM_AES_PWKEY const)k,
(uint8_t* const)iv, iv_l);
#else
(void) h;
return R_RSIP_AES_GCM_EncryptInit(&gFSPSM_ctrl, (FSPSM_AES_PWKEY const)k,
(uint8_t* const)iv, iv_l);
#endif
}
/* wrapper for Gcm encrypt/decript ADD update */
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
static fsp_err_t _R_RSIP_AES_GCM_ADDUpdate(uint8_t* p_add, uint32_t add_len)
{
return R_RSIP_AES_AEAD_AADUpdate(&gFSPSM_ctrl, p_add, add_len);
}
#endif
/* wrapper for Gcm encrypt update */
static fsp_err_t _R_RSIP_AES_GCM_EncryptUpdate(FSPSM_AESGCM_HANDLE* h,
uint8_t* p_plain, uint8_t* p_cipher, uint32_t plain_length,
uint8_t* p_add, uint32_t add_len)
uint8_t* p_add, uint32_t add_len, uint32_t* out_len)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
(void) p_add;
(void) add_len;
return R_RSIP_AES_AEAD_Update(&gFSPSM_ctrl, (uint8_t* const) p_plain,
(uint32_t const) plain_length,
(uint8_t* const) p_cipher,
(uint32_t* const) out_len);
#else
(void) h;
return R_RSIP_AES_GCM_EncryptUpdate(&gFSPSM_ctrl, (uint8_t* const) p_plain,
(uint8_t* const) p_cipher,
(uint32_t const) plain_length,
(uint8_t* const) p_add,
(uint32_t const) add_len);
#endif
}
/* wrapper for Gcm encrypt final */
static fsp_err_t _R_RSIP_AES_GCM_EncryptFinal(FSPSM_AESGCM_HANDLE* h,
uint8_t* p_cipher, uint32_t* c_len,
uint8_t* p_atag)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_AEAD_Finish(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
(uint32_t* const) c_len,
(uint8_t* const) p_atag);
#else
(void) h;
return R_RSIP_AES_GCM_EncryptFinal(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
(uint32_t* const) c_len,
(uint8_t* const) p_atag);
#endif
}
/* wrapper for Gcm decrypt init */
static fsp_err_t _R_RSIP_AES_GCM_DecryptInit(FSPSM_AESGCM_HANDLE* h,
FSPSM_AES_PWKEY k, uint8_t* iv, uint32_t iv_l)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_AES_AEAD_Init(&gFSPSM_ctrl, RSIP_AES_AEAD_MODE_GCM_DEC,
(FSPSM_AES_PWKEY const)k,
(uint8_t* const)iv, iv_l);
#else
(void) h;
return R_RSIP_AES_GCM_DecryptInit(&gFSPSM_ctrl, (FSPSM_AES_PWKEY const)k,
(uint8_t* const)iv, iv_l);
#endif
}
/* wrapper for Gcm decrypt update */
static fsp_err_t _R_RSIP_AES_GCM_DecryptUpdate(FSPSM_AESGCM_HANDLE* h,
uint8_t* p_cipher, uint8_t* p_plain, uint32_t c_length,
uint8_t* p_add, uint32_t add_len)
uint8_t* p_add, uint32_t add_len, uint32_t* out_len)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
(void) p_add;
(void) add_len;
return R_RSIP_AES_AEAD_Update(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
(uint32_t const) c_length,
(uint8_t* const) p_plain,
(uint32_t* const) out_len);
#else
(void) h;
return R_RSIP_AES_GCM_DecryptUpdate(&gFSPSM_ctrl, (uint8_t* const) p_cipher,
(uint8_t* const) p_plain,
(uint32_t const) c_length,
(uint8_t* const) p_add,
(uint32_t const) add_len);
#endif
}
/* wrapper for Gcm decrypt final */
static fsp_err_t _R_RSIP_AES_GCM_DecryptFinal(FSPSM_AESGCM_HANDLE* h,
uint8_t* p_plain, uint32_t* plain_len,
uint8_t* p_atag, uint32_t atag_len)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_AEAD_Verify(&gFSPSM_ctrl, (uint8_t* const) p_plain,
(uint32_t* const) plain_len,
(uint8_t* const) p_atag,
(uint32_t const) atag_len);
#else
(void) h;
return R_RSIP_AES_GCM_DecryptFinal(&gFSPSM_ctrl, (uint8_t* const) p_plain,
(uint32_t* const) plain_len,
(uint8_t* const) p_atag,
(uint32_t const) atag_len);
#endif
}
/* wrapper for aes cbc encrypt init */
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptInit(FSPSM_AES_HANDLE* h,
FSPSM_AES_PWKEY k,
uint8_t* iv)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_Cipher_Init(&gFSPSM_ctrl,
RSIP_AES_CIPHER_MODE_CBC_ENC,
k, iv);
#else
(void) h;
return R_RSIP_AES_Cipher_EncryptInit(&gFSPSM_ctrl,
RSIP_AES_MODE_CBC,
k, iv);
#endif
}
/* wrapper for aes cbc encrypt update */
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptUpdate(FSPSM_AES_HANDLE* h,
@@ -150,31 +216,53 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptUpdate(FSPSM_AES_HANDLE* h,
uint8_t* p_cipher,
uint32_t plain_length)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_Cipher_Update(&gFSPSM_ctrl,
(const uint8_t* const)p_plain,
(uint8_t* const)p_cipher,
(const uint32_t)plain_length);
#else
(void) h;
return R_RSIP_AES_Cipher_EncryptUpdate(&gFSPSM_ctrl,
(const uint8_t* const)p_plain,
(uint8_t* const)p_cipher,
(const uint32_t)plain_length);
#endif
}
/* wrapper for aes cbc encrypt final */
static fsp_err_t _R_RSIP_AESCBC_Cipher_EncryptFinal(FSPSM_AES_HANDLE* h,
uint8_t* p_cipher,
uint32_t* cipher_lengh)
uint32_t* cipher_length)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
(void) p_cipher;
(void) cipher_length;
return R_RSIP_AES_Cipher_Finish(&gFSPSM_ctrl);
#else
(void) h;
return R_RSIP_AES_Cipher_EncryptFinal(&gFSPSM_ctrl,
(uint8_t* const)p_cipher,
(uint32_t* const)cipher_lengh);
(uint32_t* const)cipher_length);
#endif
}
/* wrapper for aes cbc decrypt init */
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptInit(FSPSM_AES_HANDLE* h,
FSPSM_AES_PWKEY k,
uint8_t* iv)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_Cipher_Init(&gFSPSM_ctrl,
RSIP_AES_CIPHER_MODE_CBC_DEC,
k, iv);
#else
(void) h;
return R_RSIP_AES_Cipher_DecryptInit(&gFSPSM_ctrl,
RSIP_AES_MODE_CBC,
k, iv);
#endif
}
/* wrapper for aes cbc decrypt update */
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptUpdate(FSPSM_AES_HANDLE* h,
@@ -182,21 +270,36 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptUpdate(FSPSM_AES_HANDLE* h,
uint8_t* p_plain,
uint32_t cipher_lengh)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
return R_RSIP_AES_Cipher_Update(&gFSPSM_ctrl,
(const uint8_t* const)p_cipher,
(uint8_t* const)p_plain,
(const uint32_t)cipher_lengh);
#else
(void) h;
return R_RSIP_AES_Cipher_DecryptUpdate(&gFSPSM_ctrl,
(const uint8_t* const)p_cipher,
(uint8_t* const)p_plain,
(const uint32_t)cipher_lengh);
#endif
}
/* wrapper for aes cbc encrypt final */
static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptFinal(FSPSM_AES_HANDLE* h,
uint8_t* p_plain,
uint32_t* plain_lengh)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void) h;
(void) p_plain;
(void) plain_lengh;
return R_RSIP_AES_Cipher_Finish(&gFSPSM_ctrl);
#else
(void) h;
return R_RSIP_AES_Cipher_DecryptFinal(&gFSPSM_ctrl,
(uint8_t* const)p_plain,
(uint32_t* const)plain_lengh);
#endif
}
#endif
/* Perform Aes Gcm encryption by FSP SM
@@ -212,7 +315,7 @@ static fsp_err_t _R_RSIP_AESCBC_Cipher_DecryptFinal(FSPSM_AES_HANDLE* h,
* ctx The callback context
* return FSP_SUCCESS(0) on Success, otherwise negative value
*/
WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
const byte* in, word32 sz,
byte* iv, word32 ivSz,
byte* authTag, word32 authTagSz,
@@ -222,6 +325,8 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
int ret;
FSPSM_AESGCM_HANDLE _handle;
uint32_t dataLen = sz;
uint32_t out_len = 0;
uint32_t out_len_tmp = 0;
FSPSM_ST *info = (FSPSM_ST*)ctx;
aesGcmEncInitFn initFn;
@@ -354,11 +459,22 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
ret = initFn(&_handle, key_client_aes, (uint8_t*)iv_l, ivSz_l);
if (ret == FSP_SUCCESS) {
/* pass only AAD and it's size before passing cipher text */
#if defined(WOLFSSL_RENESAS_RSIP) &&\
(WOLFSSL_RENESAS_RZFSP_VER >= 220)
ret = _R_RSIP_AES_GCM_ADDUpdate((uint8_t*)authIn, authInSz);
#else
ret = updateFn(&_handle, NULL, NULL, 0UL, (uint8_t*)authIn,
authInSz);
authInSz,
&out_len_tmp);
#endif
}
if (ret == FSP_SUCCESS) {
ret = updateFn(&_handle, plainBuf, cipherBuf, sz, NULL, 0UL);
out_len_tmp = 0;
ret = updateFn(&_handle, plainBuf, cipherBuf, sz, NULL, 0UL,
&out_len_tmp);
out_len += out_len_tmp;
}
if (ret != FSP_SUCCESS) {
WOLFSSL_MSG("R_XXXX_AesXXXGcmEncryptUpdate2: failed");
@@ -372,12 +488,21 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
* from its error state and all the trailing APIs will fail.
*/
dataLen = 0;
out_len_tmp = 0;
ret = finalFn(&_handle,
cipherBuf + (sz + delta - WC_AES_BLOCK_SIZE),
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
&out_len_tmp,
#else
&dataLen,
#endif
aTagBuf);
if (ret == FSP_SUCCESS) {
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
out_len += out_len_tmp;
dataLen = out_len;
#endif
/* copy encrypted data to out */
if (sz != dataLen) {
WOLFSSL_MSG("sz is not equal to dataLen!!!!");
@@ -423,7 +548,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmEncrypt(struct Aes* aes, byte* out,
* ctx The Callback context
* return FSP_SUCCESS(0) on Success, otherwise negative value
*/
WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
const byte* in, word32 sz,
const byte* iv, word32 ivSz,
const byte* authTag, word32 authTagSz,
@@ -433,6 +558,8 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
int ret;
FSPSM_AESGCM_HANDLE _handle;
uint32_t dataLen = sz;
uint32_t out_len = 0;
uint32_t out_len_tmp = 0;
FSPSM_ST *info = (FSPSM_ST*)ctx;
aesGcmDecInitFn initFn;
@@ -559,11 +686,19 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
if (ret == FSP_SUCCESS) {
/* pass only AAD and it's size before passing cipher text */
#if defined(WOLFSSL_RENESAS_RSIP) &&\
(WOLFSSL_RENESAS_RZFSP_VER >= 220)
ret = _R_RSIP_AES_GCM_ADDUpdate((uint8_t*)authIn, authInSz);
#else
ret = updateFn(&_handle, NULL, NULL, 0UL, (uint8_t*)authIn,
authInSz);
authInSz, &out_len_tmp);
#endif
}
if (ret == FSP_SUCCESS) {
ret = updateFn(&_handle, cipherBuf, plainBuf, sz, NULL, 0UL);
out_len_tmp = 0;
ret = updateFn(&_handle, cipherBuf,
plainBuf, sz, NULL, 0UL, &out_len_tmp);
out_len += out_len_tmp;
}
if (ret != FSP_SUCCESS) {
WOLFSSL_MSG("R_XXXX_AesXXXGcmDecryptUpdate: failed in decrypt");
@@ -572,13 +707,22 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
if (ret == FSP_SUCCESS) {
dataLen = 0;
out_len_tmp = 0;
ret = finalFn(&_handle,
plainBuf + (sz + delta - WC_AES_BLOCK_SIZE),
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
&out_len_tmp,
#else
&dataLen,
#endif
aTagBuf,
min(16, authTagSz));
if (ret == FSP_SUCCESS) {
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
out_len += out_len_tmp;
dataLen = out_len;
#endif
/* copy plain data to out */
if (sz != dataLen) {
WOLFSSL_MSG("sz is not equal to dataLen!!!!");
@@ -617,7 +761,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesGcmDecrypt(struct Aes* aes, byte* out,
* sz Length of cipher text/plaintext in bytes
* return FSP_SUCCESS(0) on Success, otherwise negative value
*/
WOLFSSL_LOCAL int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
const byte* in, word32 sz)
{
FSPSM_AES_HANDLE _handle;
@@ -691,7 +835,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesCbcEncrypt(struct Aes* aes, byte* out,
* sz Length of cipher text/plaintext in bytes
* return FSP_SUCCESS(0) on Success, otherwise negative value
*/
WOLFSSL_LOCAL int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
const byte* in, word32 sz)
{
FSPSM_AES_HANDLE _handle;
@@ -759,7 +903,7 @@ WOLFSSL_LOCAL int wc_fspsm_AesCbcDecrypt(struct Aes* aes, byte* out,
* aes The AES object.
* return none
*/
WOLFSSL_LOCAL void wc_fspsm_Aesfree(Aes* aes)
void wc_fspsm_Aesfree(Aes* aes)
{
#if defined(WOLFSSL_RENESAS_FSPSM_TLS)
/* In the case of session key, memory is allocated
@@ -814,7 +958,7 @@ int wc_AesSetKey(Aes* aes, const byte* userKey, word32 keylen,
}
#endif
WOLFSSL_LOCAL int wc_fspsm_AesCipher(int devIdArg, wc_CryptoInfo* info,
int wc_fspsm_AesCipher(int devIdArg, wc_CryptoInfo* info,
void* ctx)
{
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);

View File

@@ -43,52 +43,148 @@ extern FSPSM_INSTANCE gFSPSM_ctrl;
/* wrapper for RSIP SHA1 Init */
static fsp_err_t _R_RSIP_SHA1_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA1);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA1 );
#endif
}
/* wrapper for RSIP SHA224 Init */
static fsp_err_t _R_RSIP_SHA224_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA224);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA224 );
#endif
}
/* wrapper for RSIP SHA256 Init */
static fsp_err_t _R_RSIP_SHA256_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA256);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA256 );
#endif
}
/* wrapper for RSIP SHA384 Init */
static fsp_err_t _R_RSIP_SHA384_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA384);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA384 );
#endif
}
/* wrapper for RSIP SHA512 Init */
static fsp_err_t _R_RSIP_SHA512_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512 );
#endif
}
/* wrapper for RSIP SHA512_224 Init */
static fsp_err_t _R_RSIP_SHA512_224_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512_224);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512_224 );
#endif
}
/* wrapper for RSIP SHA512_256 Init */
static fsp_err_t _R_RSIP_SHA512_256_GenerateInit(FSPSM_SHA_HANDLE* h)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Init(&gFSPSM_ctrl, RSIP_HASH_TYPE_SHA512_256);
#else
return R_RSIP_SHA_GenerateInit(&gFSPSM_ctrl, h, RSIP_HASH_TYPE_SHA512_256 );
#endif
}
/* wrapper for RSIP SHA Update */
static fsp_err_t _R_RSIP_SHA_GenerateUpdate(FSPSM_SHA_HANDLE* h,
uint8_t* m, uint32_t len)
{
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Update(&gFSPSM_ctrl, m, len);
#else
return R_RSIP_SHA_GenerateUpdate(&gFSPSM_ctrl, h, m, len );
#endif
}
/* wrapper for RSIP SHA Final */
static fsp_err_t _R_RSIP_SHA_GenerateFinal(FSPSM_SHA_HANDLE* h,
uint8_t* d, uint32_t *sz)
{
(void) sz;
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
(void)h;
return R_RSIP_SHA_Finish(&gFSPSM_ctrl, d);
#else
return R_RSIP_SHA_GenerateFinal(&gFSPSM_ctrl, h, d);
#endif
}
#endif /* WOLFSSL_RENESAS_RSIP */
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220)
static int FSPSM_FuncGet(uint32_t sha_type, void** Init,
void** Update, void** Final)
{
(void)Init;
(void)Update;
(void)Final;
switch(sha_type) {
case FSPSM_SHA1:
*Init = FSPSM_SHA1_Init;
*Update = FSPSM_SHA1_Up;
*Final = FSPSM_SHA1_Final;
break;
case FSPSM_SHA256:
*Init = FSPSM_SHA256_Init;
*Update = FSPSM_SHA256_Up;
*Final = FSPSM_SHA256_Final;
break;
case FSPSM_SHA224:
*Init = FSPSM_SHA224_Init;
*Update = FSPSM_SHA224_Up;
*Final = FSPSM_SHA224_Final;
break;
case FSPSM_SHA384:
*Init = FSPSM_SHA384_Init;
*Update = FSPSM_SHA384_Up;
*Final = FSPSM_SHA384_Final;
break;
case FSPSM_SHA512:
*Init = FSPSM_SHA512_Init;
*Update = FSPSM_SHA512_Up;
*Final = FSPSM_SHA512_Final;
break;
case FSPSM_SHA512_224:
*Init = FSPSM_SHA512_224_Init;
*Update = FSPSM_SHA512_224_Up;
*Final = FSPSM_SHA512_224_Final;
break;
case FSPSM_SHA512_256:
*Init = FSPSM_SHA512_256_Init;
*Update = FSPSM_SHA512_256_Up;
*Final = FSPSM_SHA512_256_Final;
break;
default:
return BAD_FUNC_ARG;
}
return 0;
}
#endif
/* Free up allocation for msg
*
* hash The FSPSM Hash object.
@@ -99,7 +195,8 @@ static void FSPSM_HashFree(wolfssl_FSPSM_Hash* hash)
if (hash == NULL)
return;
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
XFREE(hash->msg, hash->heap, DYNAMIC_TYPE_TMP_BUFFER);
hash->msg = NULL;
#endif
@@ -114,7 +211,8 @@ static int FSPSM_HashCopy(wolfssl_FSPSM_Hash* src, wolfssl_FSPSM_Hash* dst)
XMEMCPY(dst, src, sizeof(wolfssl_FSPSM_Hash));
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
if (src->len > 0 && src->msg != NULL) {
dst->msg = (byte*)XMALLOC(src->len, dst->heap, DYNAMIC_TYPE_TMP_BUFFER);
if (dst->msg == NULL) {
@@ -135,7 +233,7 @@ static int FSPSM_HashCopy(wolfssl_FSPSM_Hash* src, wolfssl_FSPSM_Hash* dst)
static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
word32 sha_type)
{
#if defined(WOLFSSL_RENESAS_RSIP)
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER < 220)
int ret;
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
#endif
@@ -148,7 +246,8 @@ static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
hash->sha_type = sha_type;
hash->heap = heap;
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
hash->len = 0;
hash->used = 0;
hash->msg = NULL;
@@ -199,7 +298,7 @@ static int FSPSM_HashInit(wolfssl_FSPSM_Hash* hash, void* heap, int devId,
static int FSPSM_HashUpdate(wolfssl_FSPSM_Hash* hash,
const byte* data, word32 sz)
{
#if defined(WOLFSSL_RENESAS_RSIP)
#if defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER < 220)
int ret;
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
#endif
@@ -208,7 +307,8 @@ static int FSPSM_HashUpdate(wolfssl_FSPSM_Hash* hash,
return BAD_FUNC_ARG;
}
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
if (hash->len < hash->used + sz) {
if (hash->msg == NULL) {
hash->msg = (byte*)XMALLOC(hash->used + sz, hash->heap,
@@ -292,7 +392,8 @@ static int FSPSM_HashFinal(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
void* heap;
(void) outSz;
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
FSPSM_SHA_HANDLE handle;
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
@@ -300,14 +401,21 @@ static int FSPSM_HashFinal(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
if (hash == NULL || out == NULL) {
return BAD_FUNC_ARG;
}
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
if (hash->sha_type == FSPSM_SHA256) {
Init = FSPSM_SHA256_Init;
Update = FSPSM_SHA256_Up;
Final = FSPSM_SHA256_Final;
} else
return BAD_FUNC_ARG;
#else
Init = NULL;
Update = NULL;
Final = NULL;
ret = FSPSM_FuncGet(hash->sha_type, (void**)&Init,
(void**)&Update, (void**)&Final);
if (ret != 0) return ret;
#endif
wc_fspsm_hw_lock();
if (Init(&handle) == FSP_SUCCESS) {
@@ -379,7 +487,8 @@ static int FSPSM_HashGet(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
uint32_t sz = 0;
(void) outSz;
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
FSPSM_SHA_HANDLE handle;
fsp_err_t (*Init)(FSPSM_SHA_HANDLE*);
fsp_err_t (*Update)(FSPSM_SHA_HANDLE*, uint8_t*, uint32_t);
@@ -392,14 +501,23 @@ static int FSPSM_HashGet(wolfssl_FSPSM_Hash* hash, byte* out, word32 outSz)
return BAD_FUNC_ARG;
}
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
if (hash->sha_type == FSPSM_SHA256) {
Init = FSPSM_SHA256_Init;
Update = FSPSM_SHA256_Up;
Final = FSPSM_SHA256_Final;
} else
return BAD_FUNC_ARG;
#else
Init = NULL;
Update = NULL;
Final = NULL;
ret = FSPSM_FuncGet(hash->sha_type, (void**)&Init,
(void**)&Update, (void**)&Final);
if (ret != 0) return ret;
#endif
wc_fspsm_hw_lock();
if (Init(&handle) == FSP_SUCCESS) {
ret = Update(&handle, (uint8_t*)hash->msg, hash->used);

View File

@@ -1278,6 +1278,11 @@ WOLFSSL_API int wc_fspsm_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
ForceZero(uCtx->internal, sizeof(FSPSM_ST_Internal));
uCtx->internal->ssl = ssl;
uCtx->internal->ctx = ssl->ctx;
uCtx->internal->heap = ssl->heap;
uCtx->internal->side = ssl->ctx->method->side;
ssl->RenesasUserCtx = user_ctx; /* ssl doesn't own user_ctx */
wolfSSL_SetEccVerifyCtx(ssl, user_ctx);

View File

@@ -2246,7 +2246,7 @@ WOLFSSL_API int tsip_set_callback_ctx(WOLFSSL* ssl, void* user_ctx)
WOLFSSL_ENTER("tsip_set_callback_ctx");
TsipUserCtx* uCtx = (TsipUserCtx*)user_ctx;
if (user_ctx == NULL) {
if (user_ctx == NULL || ssl == NULL) {
WOLFSSL_MSG("user ctx is null");
return BAD_FUNC_ARG;
}

View File

@@ -1065,6 +1065,7 @@ void wc_ShaFree(wc_Sha* sha)
#if (defined(WOLFSSL_RENESAS_TSIP_TLS) || \
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \
!defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220)) ||\
defined(WOLFSSL_RENESAS_RX64_HASH)
XFREE(sha->msg, sha->heap, DYNAMIC_TYPE_TMP_BUFFER);
sha->msg = NULL;

View File

@@ -2303,7 +2303,8 @@ void wc_Sha256Free(wc_Sha256* sha256)
((defined(WOLFSSL_RENESAS_TSIP_TLS) || \
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)) && \
!defined(NO_WOLFSSL_RENESAS_TSIP_CRYPT_HASH)) || \
(defined(WOLFSSL_RENESAS_SCEPROTECT) && \
((defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))) && \
!defined(NO_WOLFSSL_RENESAS_FSPSM_HASH)) || \
defined(WOLFSSL_RENESAS_RX64_HASH) || \
defined(WOLFSSL_HASH_KEEP)

View File

@@ -1500,7 +1500,8 @@ void wc_Sha512Free(wc_Sha512* sha512)
KcapiHashFree(&sha512->kcapi);
#endif
#if defined(WOLFSSL_HASH_KEEP)
#if defined(WOLFSSL_HASH_KEEP) ||\
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
if (sha512->msg != NULL) {
ForceZero(sha512->msg, sha512->len);
XFREE(sha512->msg, sha512->heap, DYNAMIC_TYPE_TMP_BUFFER);
@@ -1931,7 +1932,8 @@ void wc_Sha384Free(wc_Sha384* sha384)
KcapiHashFree(&sha384->kcapi);
#endif
#if defined(WOLFSSL_HASH_KEEP)
#if defined(WOLFSSL_HASH_KEEP) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
if (sha384->msg != NULL) {
ForceZero(sha384->msg, sha384->len);
XFREE(sha384->msg, sha384->heap, DYNAMIC_TYPE_TMP_BUFFER);

View File

@@ -263,7 +263,7 @@ const byte const_byte_array[] = "A+Gd\0\0\0";
#include <printx.h>
#undef printf
#define printf printx
#elif defined(WOLFSSL_RENESAS_RSIP)
#elif defined(WOLFSSL_RENESAS_RSIP) || defined(WOLFSSL_RENESAS_RZN2L)
#ifndef TEST_SLEEP
#define TEST_SLEEP() vTaskDelay(50)
#endif

View File

@@ -21,12 +21,13 @@
#ifndef __RENESAS_FSPSM_CRYPT_H__
#define __RENESAS_FSPSM_CRYPT_H__
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h>
#ifdef __cplusplus
extern "C" {
#endif
#define WOLFSSL_FSPSM_ILLEGAL_CIPHERSUITE -1
#define MAX_FSPSM_CBINDEX 5
typedef void* FSPSM_W_KEYVAR;
@@ -44,9 +45,6 @@ struct FSPSM_key_flg_ST {
typedef struct FSPSM_ST_Internal FSPSM_ST_Internal;
typedef struct FSPSM_tag_ST {
/* unique number for each session */
int devId;
/* installed key handling */
/* aes */
FSPSM_W_KEYVAR wrapped_key_aes256;

View File

@@ -34,6 +34,7 @@
#define FSPSM_key_flg_ST sce_keyflgs_crypt
#define FSPSM_tag_ST tagUser_SCEPKCbInfo
#define FSPSM_ST User_SCEPKCbInfo
#define FSPSM_ST_Internal FSPSM_ST_Internal
#define FSPSM_ST_PKC SCE_PKCbInfo
/* map SCE API to macro */
@@ -167,28 +168,38 @@
#elif defined(WOLFSSL_RENESAS_RSIP)
#include "r_rsip.h"
#if (WOLFSSL_RENESAS_RZFSP_VER >= 200)
#include "r_rsip_api.h"
#endif
/* structure, type so on */
#define FSPSM_W_KEYVAR renesas_rsip_wrappedkey
#define FSPSM_tls_flg_ST rsip_keyflgs_tls
#define FSPSM_key_flg_ST rsip_keyflgs_crypt
#define FSPSM_tag_ST tagUser_RSIPPKCbInfo
#define FSPSM_ST User_RSIPPKCbInfo
#define FSPSM_ST_Internal FSPSM_ST_Internal
#define FSPSM_ST_PKC RSIP_PKCbInfo
#define FSPSM_KEY_TYPE rsip_key_type_t
#define FSPSM_INSTANCE rsip_instance_ctrl_t
#define gFSPSM_ctrl rsip_ctrl
#define FSPSM_CONFIG rsip_cfg_t
#if (WOLFSSL_RENESAS_RZFSP_VER >= 220)
#define gFSPSM_ctrl g_rsip_ctrl
#define gFSPSM_cfg g_rsip_cfg
#else
#define gFSPSM_ctrl rsip_ctrl
#define gFSPSM_cfg rsip_cfg
#endif
#define H_INSTANCE gFSPSM_ctrl
#define FSPSM_OPEN R_RSIP_Open
#define FSPSM_CLOSE R_RSIP_Close
/* rnd generation func */
#define R_RANDOM_GEN(b) R_RSIP_RandomNumberGenerate(&gFSPSM_ctrl,b)
#define R_RANDOM_GEN(b) \
R_RSIP_RandomNumberGenerate(&gFSPSM_ctrl, (uint8_t* const)b)
/* sha 1*/
#define FSPSM_SHA_HANDLE rsip_sha_handle_t
#define FSPSM_SHA1_Init _R_RSIP_SHA1_GenerateInit
#define FSPSM_SHA1_Up _R_RSIP_SHA_GenerateUpdate
#define FSPSM_SHA1_Final _R_RSIP_SHA_GenerateFinal

View File

@@ -22,7 +22,7 @@
#ifndef _RENESAS_FSPSM_INTERNAL_H_
#define _RENESAS_FSPSM_INTERNAL_H_
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-types.h>
#include <wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h>
/* Wrapped TLS FSP Key Set Flags */
@@ -32,9 +32,18 @@ struct FSPSM_tls_flg_ST {
};
struct FSPSM_ST_Internal {
/* unique number for each session */
int devId;
#if defined(WOLFSSL_RENESAS_FSPSM_TLS) && \
!defined(WOLFSSL_RENESAS_FSPSM_CRYPTONLY)
/* WOLFSSL object associated with */
struct WOLFSSL* ssl;
struct WOLFSSL_CTX* ctx;
/* HEAP_HINT */
void* heap;
/* out from R_SCE_TLS_ServerKeyExchangeVerify */
uint32_t
encrypted_ephemeral_ecdh_public_key[FSPSM_TLS_ENCRYPTED_ECCPUBKEY_SZ];
@@ -54,7 +63,6 @@ struct FSPSM_ST_Internal {
uint8_t chr;
struct FSPSM_tls_flg_ST bits;
} keyflgs_tls;
};
#ifdef WOLFSSL_RENESAS_FSPSM_TLS
@@ -92,7 +100,8 @@ typedef struct FSPSM_RSA_CTX {
typedef struct {
void* heap;
word32 sha_type;
#if defined(WOLFSSL_RENESAS_SCEPROTECT)
#if defined(WOLFSSL_RENESAS_SCEPROTECT) || \
(defined(WOLFSSL_RENESAS_RSIP) && (WOLFSSL_RENESAS_RZFSP_VER >= 220))
word32 used;
word32 len;
byte* msg;

View File

@@ -113,7 +113,7 @@ enum {
#include "wolfssl/wolfcrypt/port/Renesas/renesas-rx64-hw-crypt.h"
#elif defined(WOLFSSL_RENESAS_RSIP) && \
!defined(NO_WOLFSSL_RENESAS_FSPSM_HASH)
#include "wolfssl/wolfcrypt/port/Renesas/renesas-fspsm-crypt.h"
#include "wolfssl/wolfcrypt/port/Renesas/renesas_fspsm_internal.h"
#else
#if defined(WOLFSSL_SE050) && defined(WOLFSSL_SE050_HASH)