mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-07-30 10:47:28 +02:00
Fix TSIP port using crypto callback
- Add unit test using cb
This commit is contained in:
@ -119,8 +119,12 @@
|
||||
<listOptionValue builtIn="false" value="D_1=R_1"/>
|
||||
<listOptionValue builtIn="false" value="D_2=R_2"/>
|
||||
<listOptionValue builtIn="false" value="D_8=R_8"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM=REXRAM"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_1=REXRAM_1"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_2=REXRAM_2"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_8=REXRAM_8"/>
|
||||
</option>
|
||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection.2043161263" name="セクション (-start)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection" useByScannerDiscovery="false" value="SU,SI,B_1,R_1,B_2,R_2,B,R,B_8,R_8/04,B_ETHERNET_BUFFERS_1,B_RX_DESC_1,B_TX_DESC_1/0800000,PResetPRG,C_1,C_2,C,C_8,C$*,D*,W*,L,P/0FFE00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC,C_FIRMWARE_UPDATE_CONTROL_BLOCK,C_FIRMWARE_UPDATE_CONTROL_BLOCK_MIRROR/00100000" valueType="string"/>
|
||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection.2043161263" name="セクション (-start)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection" useByScannerDiscovery="false" value="SU,SI,B_1,R_1,B_2,R_2,B,R,B_8,R_8/04,BEXRAM_1,REXRAM_1,BEXRAM_2,REXRAM_2,BEXRAM,REXRAM,BEXRAM_8,REXRAM_8,B_ETHERNET_BUFFERS_1,B_RX_DESC_1,B_TX_DESC_1/0800000,PResetPRG,C_1,C_2,C,C_8,C$*,D*,W*,L,P/0FFE00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC,C_FIRMWARE_UPDATE_CONTROL_BLOCK,C_FIRMWARE_UPDATE_CONTROL_BLOCK_MIRROR/00100000" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.userBefore.1452234640" name="追加するオプション(すべての指定オプションの前に追加)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.userBefore" useByScannerDiscovery="false" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""/>
|
||||
</option>
|
||||
@ -218,6 +222,7 @@
|
||||
<option id="board.name" value="EnvisionKitRX72N"/>
|
||||
<option id="board.device" value="R5F572NNHxFB"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="com.renesas.cdt.managedbuild.core.deviceConfiguration"/>
|
||||
</cconfiguration>
|
||||
<cconfiguration id="com.renesas.cdt.managedbuild.renesas.ccrx.debug.configuration.992474000">
|
||||
<storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.renesas.cdt.managedbuild.renesas.ccrx.debug.configuration.992474000" moduleId="org.eclipse.cdt.core.settings" name="Debug">
|
||||
@ -261,7 +266,7 @@
|
||||
</tool>
|
||||
<tool id="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler.278830907" name="Compiler" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler">
|
||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.2144484247" name="浮動小数点演算命令を使用する (-fpu/-nofpu)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.yes" valueType="enumerated"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include.545347560" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" valueType="includePath">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include.545347560" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" useByScannerDiscovery="false" valueType="includePath">
|
||||
<listOptionValue builtIn="false" value="${TCINSTALL}/include"/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/general}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/Config_TMR0}""/>
|
||||
@ -280,7 +285,7 @@
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_ether_rx}""/>
|
||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen}""/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.935611572" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" valueType="definedSymbols">
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.935611572" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||
<listOptionValue builtIn="false" value="DEBUG_CONSOLE"/>
|
||||
</option>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore.878126292" name="追加するオプション(すべての指定オプションの前に追加)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore" useByScannerDiscovery="false" valueType="stringList">
|
||||
@ -329,8 +334,12 @@
|
||||
<listOptionValue builtIn="false" value="D_1=R_1"/>
|
||||
<listOptionValue builtIn="false" value="D_2=R_2"/>
|
||||
<listOptionValue builtIn="false" value="D_8=R_8"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM=REXRAM"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_1=REXRAM_1"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_2=REXRAM_2"/>
|
||||
<listOptionValue builtIn="false" value="DEXRAM_8=REXRAM_8"/>
|
||||
</option>
|
||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection.1046231838" name="セクション (-start)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection" useByScannerDiscovery="false" value="SU,SI,B_1,R_1,B_2,R_2,B,R/04,PResetPRG,C_1,C_2,C,C$*,D*,W*,L,P/0FFE00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC,B_ETHERNET_BUFFERS_1,B_RX_DESC_1,B_TX_DESC_1/00010000,C_FIRMWARE_UPDATE_CONTROL_BLOCK,C_FIRMWARE_UPDATE_CONTROL_BLOCK_MIRROR/00100000" valueType="string"/>
|
||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection.1046231838" name="セクション (-start)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.linkerSection" useByScannerDiscovery="false" value="SU,SI,B_1,R_1,B_2,R_2,B,R/04,PResetPRG,C_1,C_2,C,C$*,D*,W*,L,P/0FFE00000,EXCEPTVECT/0FFFFFF80,RESETVECT/0FFFFFFFC,B_ETHERNET_BUFFERS_1,B_RX_DESC_1,B_TX_DESC_1/00010000,C_FIRMWARE_UPDATE_CONTROL_BLOCK,C_FIRMWARE_UPDATE_CONTROL_BLOCK_MIRROR/00100000,BEXRAM_1,REXRAM_1,BEXRAM_2,REXRAM_2,BEXRAM,REXRAM,BEXRAM_8,REXRAM_8/00800000" valueType="string"/>
|
||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.userBefore.1651005552" name="追加するオプション(すべての指定オプションの前に追加)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.userBefore" useByScannerDiscovery="false" valueType="stringList">
|
||||
<listOptionValue builtIn="false" value=""/>
|
||||
</option>
|
||||
@ -380,6 +389,7 @@
|
||||
<option id="board.name" value="EnvisionKitRX72N"/>
|
||||
<option id="board.device" value="R5F572NNHxFB"/>
|
||||
</storageModule>
|
||||
<storageModule moduleId="com.renesas.cdt.managedbuild.core.deviceConfiguration"/>
|
||||
</cconfiguration>
|
||||
</storageModule>
|
||||
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
|
||||
|
@ -366,8 +366,8 @@
|
||||
<Item currentVect="18" id="RAM_RAMERR" priority="15" usedState="未使用"/>
|
||||
<Item currentVect="21" id="FCU_FIFERR" priority="15" usedState="未使用"/>
|
||||
<Item currentVect="23" id="FCU_FRDYI" priority="15" usedState="未使用"/>
|
||||
<Item currentVect="26" id="ICU_SWINT2" priority="1" usedState="未使用"/>
|
||||
<Item currentVect="27" id="ICU_SWINT" priority="1" usedState="未使用"/>
|
||||
<Item currentVect="26" id="ICU_SWINT2" priority="15" usedState="未使用"/>
|
||||
<Item currentVect="27" id="ICU_SWINT" priority="15" usedState="未使用"/>
|
||||
<Item currentVect="28" id="CMT0_CMI0" priority="5" usedState="使用中"/>
|
||||
<Item currentVect="29" id="CMT1_CMI1" priority="5" usedState="使用中"/>
|
||||
<Item currentVect="30" id="CMTW0_CMWI0" priority="15" usedState="未使用"/>
|
||||
@ -950,69 +950,6 @@
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_bsp">
|
||||
<component description="依存モジュール: なし The r_bsp package provides a foundation for code to be built on top of. It provides startup code, iodefines, and MCU information for different boards. There are 2 folders that make up the r_bsp package. The 'mcu' folder contains files that are common to a MCU group. These files provide functionality such as easy register access, CPU functions, and a file named 'mcu_info.h' for each MCU group. The 'mcu_info.h' file has information about the MCU on the board and is configured based on the information given in r_bsp_config.h. The information in 'mcu_info.h' is used to help configure Renesas middleware that uses the r_bsp package. The 'board' folder has a folder with startup code for each supported board. Which MCU and board is chosen is decided by the settings in 'platform.h'. The user can choose which board they are using by uncommenting the include path that applies to their board. For example, if you are using the RSK+RX64M then you would uncomment the #include "./board/generic_rx64m/r_bsp.h" include path. Users are encouraged to add their own boards to the 'board' directory. BSPs are configured by using the r_bsp_config.h file. Each board will have a reference configuration file named r_bsp_config_reference.h. The user should copy this file to their project, rename it to r_bsp_config.h, and use the options inside the file to configure the BSP for their project." detailDescription="Board Support Packages." display="r_bsp" id="r_bsp7.20" version="7.20">
|
||||
<gridItem id="BSP_CFG_USER_STACK_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USTACK_BYTES" selectedIndex="0x2000"/>
|
||||
<gridItem id="BSP_CFG_ISTACK_BYTES" selectedIndex="0x400"/>
|
||||
<gridItem id="BSP_CFG_HEAP_BYTES" selectedIndex="0xf000"/>
|
||||
<gridItem id="BSP_CFG_IO_LIB_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_FUNCTION" selectedIndex="my_sw_charget_function"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARPUT_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARPUT_FUNCTION" selectedIndex="my_sw_charput_function"/>
|
||||
<gridItem id="BSP_CFG_RUN_IN_USER_MODE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_1" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_2" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_3" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_4" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_SERIAL_PROGRAMMER_CONECT_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_ROM_CACHE_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_TRUSTED_MODE_FUNCTION" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_FAW_REG_VALUE" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ROMCODE_REG_VALUE" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_CODE_FLASH_START_BANK" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_TYPE" selectedIndex="bsp_lock_t"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION" selectedIndex="my_hw_locking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION" selectedIndex="my_hw_unlocking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION" selectedIndex="my_sw_locking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION" selectedIndex="my_sw_unlocking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_CALLBACK_PRE_INITC_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_PRE_C_FUNCTION" selectedIndex="my_sw_warmstart_prec_function"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_CALLBACK_POST_INITC_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_POST_C_FUNCTION" selectedIndex="my_sw_warmstart_postc_function"/>
|
||||
<gridItem id="BSP_CFG_PARAM_CHECKING_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_1ST_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_2ND_PRIORITY" selectedIndex="3"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_3RD_PRIORITY" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_4TH_PRIORITY" selectedIndex="2"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_5TH_PRIORITY" selectedIndex="4"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_ADDR" selectedIndex="0xFFE00000"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_SIZE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_IF_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_OA_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_DM_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_ADDR" selectedIndex="0xFFE00000"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_SIZE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_IF_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_OA_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_DM_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_FIT_IPL_MAX" selectedIndex="15"/>
|
||||
<gridItem id="BSP_CFG_SWINT_UNIT1_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SWINT_UNIT2_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SWINT_TASK_BUFFER_NUMBER" selectedIndex="8"/>
|
||||
<gridItem id="BSP_CFG_SWINT_IPR_INITIAL_VALUE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_CHANNEL" selectedIndex="9"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_BITRATE" selectedIndex="115200"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_INTERRUPT_PRIORITY" selectedIndex="15"/>
|
||||
</component>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_cmt_rx">
|
||||
<component description="依存モジュール: r_bsp バージョン 7.20 This module creates a timer tick using a CMT channel based on a frequency input by the user." detailDescription="CMT driver" display="r_cmt_rx" id="r_cmt_rx5.20" version="5.20">
|
||||
<gridItem id="CMT_RX_CFG_IPR" selectedIndex="5"/>
|
||||
@ -1141,8 +1078,8 @@
|
||||
<gridItem id="TSIP_AES_256_CBC_ENCRYPT" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_128_CBC_DECRYPT" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_256_CBC_DECRYPT" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_128_CTR" selectedIndex="0"/>
|
||||
<gridItem id="TSIP_AES_256_CTR" selectedIndex="0"/>
|
||||
<gridItem id="TSIP_AES_128_CTR" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_256_CTR" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_128_GCM_ENCRYPT" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_256_GCM_ENCRYPT" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_AES_128_GCM_DECRYPT" selectedIndex="1"/>
|
||||
@ -1184,7 +1121,7 @@
|
||||
<gridItem id="TSIP_USER_SHA_384_FUNCTION" selectedIndex="user_sha384_function"/>
|
||||
<gridItem id="TSIP_TLS" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_SECURE_BOOT" selectedIndex="0"/>
|
||||
<gridItem id="TSIP_FIRMWARE_UPDATE" selectedIndex="1"/>
|
||||
<gridItem id="TSIP_FIRMWARE_UPDATE" selectedIndex="0"/>
|
||||
<gridItem id="TSIP_MULTI_THREADING" selectedIndex="0"/>
|
||||
<gridItem id="TSIP_MULTI_THREADING_LOCK_FUNCTION" selectedIndex="user_lock_function"/>
|
||||
<gridItem id="TSIP_MULTI_THREADING_UNLOCK_FUNCTION" selectedIndex="user_unlock_function"/>
|
||||
@ -1192,6 +1129,78 @@
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
<configuration inuse="true" name="r_bsp">
|
||||
<component description="依存モジュール: なし The r_bsp package provides a foundation for code to be built on top of. It provides startup code, iodefines, and MCU information for different boards. There are 2 folders that make up the r_bsp package. The 'mcu' folder contains files that are common to a MCU group. These files provide functionality such as easy register access, CPU functions, and a file named 'mcu_info.h' for each MCU group. The 'mcu_info.h' file has information about the MCU on the board and is configured based on the information given in r_bsp_config.h. The information in 'mcu_info.h' is used to help configure Renesas middleware that uses the r_bsp package. The 'board' folder has a folder with startup code for each supported board. Which MCU and board is chosen is decided by the settings in 'platform.h'. The user can choose which board they are using by uncommenting the include path that applies to their board. For example, if you are using the RSK+RX64M then you would uncomment the #include "./board/generic_rx64m/r_bsp.h" include path. Users are encouraged to add their own boards to the 'board' directory. BSPs are configured by using the r_bsp_config.h file. Each board will have a reference configuration file named r_bsp_config_reference.h. The user should copy this file to their project, rename it to r_bsp_config.h, and use the options inside the file to configure the BSP for their project." detailDescription="Board Support Packages." display="r_bsp" id="r_bsp7.51" version="7.51">
|
||||
<gridItem id="BSP_CFG_USER_STACK_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USTACK_BYTES" selectedIndex="0x4000"/>
|
||||
<gridItem id="BSP_CFG_ISTACK_BYTES" selectedIndex="0x400"/>
|
||||
<gridItem id="BSP_CFG_HEAP_BYTES" selectedIndex="0xf000"/>
|
||||
<gridItem id="BSP_CFG_IO_LIB_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARGET_FUNCTION" selectedIndex="my_sw_charget_function"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARPUT_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_CHARPUT_FUNCTION" selectedIndex="my_sw_charput_function"/>
|
||||
<gridItem id="BSP_CFG_RUN_IN_USER_MODE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_1" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_2" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_3" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ID_CODE_LONG_4" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_SERIAL_PROGRAMMER_CONECT_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_ROM_CACHE_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_TRUSTED_MODE_FUNCTION" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_FAW_REG_VALUE" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_ROMCODE_REG_VALUE" selectedIndex="0xFFFFFFFF"/>
|
||||
<gridItem id="BSP_CFG_CODE_FLASH_START_BANK" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_TYPE" selectedIndex="bsp_lock_t"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_HW_LOCK_FUNCTION" selectedIndex="my_hw_locking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_HW_UNLOCK_FUNCTION" selectedIndex="my_hw_unlocking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_SW_LOCK_FUNCTION" selectedIndex="my_sw_locking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_LOCKING_SW_UNLOCK_FUNCTION" selectedIndex="my_sw_unlocking_function"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_CALLBACK_PRE_INITC_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_PRE_C_FUNCTION" selectedIndex="my_sw_warmstart_prec_function"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_CALLBACK_POST_INITC_ENABLED" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_USER_WARM_START_POST_C_FUNCTION" selectedIndex="my_sw_warmstart_postc_function"/>
|
||||
<gridItem id="BSP_CFG_PARAM_CHECKING_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_1ST_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_2ND_PRIORITY" selectedIndex="3"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_3RD_PRIORITY" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_4TH_PRIORITY" selectedIndex="2"/>
|
||||
<gridItem id="BSP_CFG_EBMAPCR_5TH_PRIORITY" selectedIndex="4"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_ADDR" selectedIndex="0xFFE00000"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_SIZE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_IF_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_OA_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA0_DM_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_ADDR" selectedIndex="0xFFE00000"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_SIZE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_IF_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_OA_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_NONCACHEABLE_AREA1_DM_ENABLE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_FIT_IPL_MAX" selectedIndex="15"/>
|
||||
<gridItem id="BSP_CFG_SWINT_UNIT1_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SWINT_UNIT2_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SWINT_TASK_BUFFER_NUMBER" selectedIndex="8"/>
|
||||
<gridItem id="BSP_CFG_SWINT_IPR_INITIAL_VALUE" selectedIndex="1"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_CHANNEL" selectedIndex="9"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_BITRATE" selectedIndex="115200"/>
|
||||
<gridItem id="BSP_CFG_SCI_UART_TERMINAL_INTERRUPT_PRIORITY" selectedIndex="15"/>
|
||||
<gridItem id="BSP_CFG_BUS_PRIORITY_INITIALIZE_ENABLE" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_MEMORY_BUS1_3_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_MEMORY_BUS2_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_INTERNAL_PERIPHERAL_BUS1_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_INTERNAL_PERIPHERAL_BUS2_3_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_INTERNAL_PERIPHERAL_BUS4_5_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_INTERNAL_PERIPHERAL_BUS6_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_EXTERNAL_BUS_PRIORITY" selectedIndex="0"/>
|
||||
<gridItem id="BSP_CFG_BOOTLOADER_PROJECT" selectedIndex="0"/>
|
||||
</component>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
<source description="Components supporting Firmware Integration Technology" display="Firmware Integration Technology" id="com.renesas.smc.tools.swcomponent.fit.source"/>
|
||||
</configuration>
|
||||
</tool>
|
||||
<tool id="System">
|
||||
<section id="ocd">
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include <wolfcrypt/src/misc.c>
|
||||
#endif
|
||||
#include <wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h>
|
||||
WOLFSSL_API int wc_CryptoCb_CryptInitRenesasCmn(struct WOLFSSL* ssl, void* ctx);
|
||||
|
||||
#ifdef FREERTOS
|
||||
#include "FreeRTOS.h"
|
||||
@ -71,27 +72,27 @@
|
||||
else \
|
||||
printf(" failed \n");
|
||||
#ifdef FREERTOS
|
||||
static xSemaphoreHandle exit_semaph;
|
||||
static byte exit_loop = 0;
|
||||
static byte sha_multTst_rslt = 0;
|
||||
static byte sha256_multTst_rslt = 0;
|
||||
static byte Aes128_Cbc_multTst_rslt = 0;
|
||||
static byte Aes256_Cbc_multTst_rslt = 0;
|
||||
static byte Aes128_Gcm_multTst_rslt = 0;
|
||||
static byte Aes256_Gcm_multTst_rslt = 0;
|
||||
static xSemaphoreHandle exit_semaph;
|
||||
static byte exit_loop = 0;
|
||||
static byte sha_multTst_rslt = 0;
|
||||
static byte sha256_multTst_rslt = 0;
|
||||
static byte Aes128_Cbc_multTst_rslt = 0;
|
||||
static byte Aes256_Cbc_multTst_rslt = 0;
|
||||
static byte Aes128_Gcm_multTst_rslt = 0;
|
||||
static byte Aes256_Gcm_multTst_rslt = 0;
|
||||
#endif /* FREERTOS */
|
||||
|
||||
#if defined(HAVE_AES_CBC)
|
||||
|
||||
# if defined(WOLFSSL_AES_128)
|
||||
static tsip_aes_key_index_t g_user_aes128_key_index1;
|
||||
static tsip_aes_key_index_t g_user_aes128_key_index2;
|
||||
# endif
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
static tsip_aes_key_index_t g_user_aes128_key_index1;
|
||||
static tsip_aes_key_index_t g_user_aes128_key_index2;
|
||||
#endif
|
||||
|
||||
# if defined(WOLFSSL_AES_256)
|
||||
static tsip_aes_key_index_t g_user_aes256_key_index1;
|
||||
static tsip_aes_key_index_t g_user_aes256_key_index2;
|
||||
# endif
|
||||
#if defined(WOLFSSL_AES_256)
|
||||
static tsip_aes_key_index_t g_user_aes256_key_index1;
|
||||
static tsip_aes_key_index_t g_user_aes256_key_index2;
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
@ -107,23 +108,73 @@ typedef struct tagInfo
|
||||
|
||||
void Clr_CallbackCtx(TsipUserCtx *g)
|
||||
{
|
||||
XFREE(g->rsa1024pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
XFREE(g->rsa1024pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
XFREE(g->rsa2048pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
|
||||
XFREE(g->rsa2048pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XMEMSET(g, 0, sizeof(TsipUserCtx));
|
||||
#ifndef NO_RSA
|
||||
#if defined(TSIP_RSAES_1024) && TSIP_RSAES_1024 == 1
|
||||
XFREE(g->rsa1024pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(g->rsa1024pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
#if defined(TSIP_RSAES_2048) && TSIP_RSAES_2048 == 1
|
||||
XFREE(g->rsa2048pri_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
XFREE(g->rsa2048pub_keyIdx, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
||||
#endif
|
||||
#endif
|
||||
XMEMSET(g, 0, sizeof(TsipUserCtx));
|
||||
}
|
||||
|
||||
int TSIP_AesKeyGeneration(TsipUserCtx *g, byte sz)
|
||||
{
|
||||
e_tsip_err_t tsip_error_code;
|
||||
/* Generate AES tsip Key */
|
||||
if (sz == 16) {
|
||||
tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex(
|
||||
&g_user_aes128_key_index1);
|
||||
if (tsip_error_code == TSIP_SUCCESS) {
|
||||
XMEMCPY(&g->user_aes128_key_index, &g_user_aes128_key_index1,
|
||||
sizeof(g_user_aes128_key_index1));
|
||||
g->user_aes128_key_set = 1;
|
||||
} else {
|
||||
printf("Failed to generate Aes 256 Key Index %d\n",
|
||||
tsip_error_code);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex(
|
||||
&g_user_aes128_key_index2);
|
||||
if (tsip_error_code != TSIP_SUCCESS) {
|
||||
printf("Failed to generate Aes 128 Key Index %d\n",
|
||||
tsip_error_code);
|
||||
return -1;
|
||||
}
|
||||
} else if (sz == 32) {
|
||||
tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex(
|
||||
&g_user_aes256_key_index1);
|
||||
if (tsip_error_code == TSIP_SUCCESS) {
|
||||
XMEMCPY(&g->user_aes256_key_index, &g_user_aes256_key_index1,
|
||||
sizeof(g_user_aes256_key_index1));
|
||||
g->user_aes256_key_set = 1;
|
||||
} else {
|
||||
printf("Failed to generate Aes 256 Key Index %d\n",
|
||||
tsip_error_code);
|
||||
return -1;
|
||||
}
|
||||
|
||||
tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex(
|
||||
&g_user_aes256_key_index2);
|
||||
if (tsip_error_code != TSIP_SUCCESS) {
|
||||
printf("Failed to generate Aes 256 Key Index %d\n",
|
||||
tsip_error_code);
|
||||
return -1;
|
||||
}
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_AES_CBC) && defined(WOLFSSL_AES_128)
|
||||
|
||||
static int tsip_aes_cbc_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
static int tsip_aes128_cbc_test(int prnt, int devId)
|
||||
{
|
||||
|
||||
Aes aes[1];
|
||||
|
||||
byte cipher[WC_AES_BLOCK_SIZE];
|
||||
@ -143,18 +194,15 @@ static int tsip_aes_cbc_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
ForceZero(plain, WC_AES_BLOCK_SIZE);
|
||||
|
||||
if (prnt) {
|
||||
printf(" tsip_aes_cbc_test() ");
|
||||
printf(" tsip_aes128_cbc_test() ");
|
||||
}
|
||||
|
||||
ret = wc_AesInit(aes, NULL, INVALID_DEVID);
|
||||
ret = wc_AesInit(aes, NULL, devId);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesSetKey(aes, key, WC_AES_BLOCK_SIZE, iv, AES_ENCRYPTION);
|
||||
XMEMCPY(&aes->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
|
||||
aes->ctx.keySize = aes->keylen;
|
||||
if (ret == 0) {
|
||||
ret = wc_tsip_AesCbcEncrypt(aes, cipher, msg, WC_AES_BLOCK_SIZE);
|
||||
ret = wc_AesCbcEncrypt(aes, cipher, msg, WC_AES_BLOCK_SIZE);
|
||||
}
|
||||
|
||||
wc_AesFree(aes);
|
||||
@ -165,14 +213,11 @@ static int tsip_aes_cbc_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
|
||||
#ifdef HAVE_AES_DECRYPT
|
||||
if (ret == 0)
|
||||
ret = wc_AesInit(aes, NULL, INVALID_DEVID);
|
||||
ret = wc_AesInit(aes, NULL, devId);
|
||||
if (ret == 0) {
|
||||
ret = wc_AesSetKey(aes, key, WC_AES_BLOCK_SIZE, iv, AES_DECRYPTION);
|
||||
XMEMCPY(&aes->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
aes->ctx.keySize = aes->keylen;
|
||||
if (ret == 0)
|
||||
ret = wc_tsip_AesCbcDecrypt(aes, plain, cipher, WC_AES_BLOCK_SIZE);
|
||||
ret = wc_AesCbcDecrypt(aes, plain, cipher, WC_AES_BLOCK_SIZE);
|
||||
|
||||
wc_AesFree(aes);
|
||||
}
|
||||
@ -194,7 +239,7 @@ static int tsip_aes_cbc_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
#if defined(WOLFSSL_AES_COUNTER)
|
||||
#if (defined(TSIP_AES_128_CTR) && TSIP_AES_128_CTR == 1) &&\
|
||||
(defined(WOLFSSL_AES_128))
|
||||
static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
static int tsip_aes128_ctr_test(int prnt, int devId)
|
||||
{
|
||||
int ret;
|
||||
Aes *enc = NULL;
|
||||
@ -250,6 +295,18 @@ static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
0xd3,0xda,0xe1,0x5b,0x04,0xbb,0x35,0x2f,
|
||||
0xa0,0xf5,0x9f,0xeb,0xfc,0xb4,0xda,0x3e
|
||||
};
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte oddCipher[] =
|
||||
{
|
||||
0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
|
||||
0xc2
|
||||
};
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte ctr128Wrap128Cipher[] =
|
||||
{
|
||||
0xe1,0x33,0x38,0xe3,0x6c,0xb7,0x19,0x62,
|
||||
0xe0,0x0d,0x02,0x0b,0x4c,0xed,0xbd,0x86,
|
||||
0xd3,0xda,0xe1,0x5b,0x04
|
||||
};
|
||||
|
||||
int i;
|
||||
struct {
|
||||
const byte* key;
|
||||
@ -261,6 +318,14 @@ static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
} testVec[] = {
|
||||
{ ctr128Key, (int)sizeof(ctr128Key), ctrIv,
|
||||
ctrPlain, (int)sizeof(ctrPlain), ctr128Cipher },
|
||||
/* let's try with just 9 bytes, non block size test */
|
||||
{ ctr128Key, (int)sizeof(ctr128Key), ctrIv,
|
||||
ctrPlain, (int)sizeof(oddCipher), ctr128Cipher },
|
||||
/* and an additional 9 bytes to reuse tmp left buffer */
|
||||
{ NULL, 0, NULL, ctrPlain, (int)sizeof(oddCipher), oddCipher },
|
||||
/* Counter wrapping */
|
||||
{ ctr128Key, (int)sizeof(ctr128Key), ctrIvWrap128,
|
||||
ctrPlain, (int)sizeof(ctr128Wrap128Cipher), ctr128Wrap128Cipher },
|
||||
{ ctr128Key, (int)sizeof(ctr128Key), ctrIvWrap128,
|
||||
ctrPlain, (int)sizeof(ctr128Wrap128CipherLong),
|
||||
ctr128Wrap128CipherLong },
|
||||
@ -270,33 +335,17 @@ static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (prnt)
|
||||
printf(" tsip_aes128_ctr_test() ");
|
||||
|
||||
enc = wc_AesNew(NULL, INVALID_DEVID, &ret);
|
||||
enc = wc_AesNew(NULL, devId, &ret);
|
||||
if (enc == NULL){
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
dec = wc_AesNew(NULL, INVALID_DEVID, &ret);
|
||||
dec = wc_AesNew(NULL, devId, &ret);
|
||||
if (dec == NULL){
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* test failure cases - null */
|
||||
ret = wc_tsip_AesCtr(NULL, NULL, NULL, 1);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -8; goto out;
|
||||
}
|
||||
/* test failure cases - size, but no buffer */
|
||||
ret = wc_tsip_AesCtr(enc, NULL, NULL, 1);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -9; goto out;
|
||||
}
|
||||
/* test failure cases - non block aligned */
|
||||
ret = wc_tsip_AesCtr(enc, plain, cipher, 15);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -10; goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < AES_CTR_TEST_LEN; i++) {
|
||||
if (testVec[i].key != NULL) {
|
||||
ret = wc_AesSetKeyDirect(enc, testVec[i].key, (word32)testVec[i].keySz,
|
||||
@ -305,11 +354,6 @@ static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (ret != 0) {
|
||||
ret = -3;
|
||||
goto out;
|
||||
} else {
|
||||
/* set TSIP Aes key */
|
||||
XMEMCPY(&enc->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
enc->ctx.keySize = enc->keylen;
|
||||
}
|
||||
/* Ctr only uses encrypt, even on key setup */
|
||||
ret = wc_AesSetKeyDirect(dec, testVec[i].key, (word32)testVec[i].keySz,
|
||||
@ -317,19 +361,15 @@ static int tsip_aes128_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (ret != 0) {
|
||||
ret = -4;
|
||||
goto out;
|
||||
} else {
|
||||
XMEMCPY(&dec->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
dec->ctx.keySize = dec->keylen;
|
||||
}
|
||||
}
|
||||
|
||||
ret = wc_tsip_AesCtr(enc, cipher, testVec[i].plain, (word32)testVec[i].len);
|
||||
ret = wc_AesCtrEncrypt(enc, cipher, testVec[i].plain, (word32)testVec[i].len);
|
||||
if (ret != 0) {
|
||||
ret = -5;
|
||||
goto out;
|
||||
}
|
||||
ret = wc_tsip_AesCtr(dec, plain, cipher, (word32)testVec[i].len);
|
||||
ret = wc_AesCtrEncrypt(dec, plain, cipher, (word32)testVec[i].len);
|
||||
if (ret != 0) {
|
||||
ret = -6;
|
||||
goto out;
|
||||
@ -349,7 +389,7 @@ out:
|
||||
#endif /* WOLFSSL_AES_128 */
|
||||
#if (defined(TSIP_AES_256_CTR) && TSIP_AES_256_CTR == 1) &&\
|
||||
(defined(WOLFSSL_AES_256))
|
||||
static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
static int tsip_aes256_ctr_test(int prnt, int devId)
|
||||
{
|
||||
int ret;
|
||||
Aes *enc = NULL;
|
||||
@ -407,7 +447,17 @@ static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
0x4b,0x45,0x7c,0xd6,0x8a,0xcc,0xda,0x4a,
|
||||
0x89,0xfa,0x23,0x6c,0x06,0xbf,0x26,0x05
|
||||
};
|
||||
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte oddCipher[] =
|
||||
{
|
||||
0xb9,0xd7,0xcb,0x08,0xb0,0xe1,0x7b,0xa0,
|
||||
0xc2
|
||||
};
|
||||
WOLFSSL_SMALL_STACK_STATIC const byte ctr256Wrap128Cipher[] =
|
||||
{
|
||||
0x50,0xfd,0x97,0xc3,0xe6,0x1a,0xbb,0x48,
|
||||
0x73,0xfb,0x78,0xdf,0x1e,0x8e,0x77,0xe6,
|
||||
0x4b,0x45,0x7c,0xd6,0x8a
|
||||
};
|
||||
int i;
|
||||
struct {
|
||||
const byte* key;
|
||||
@ -419,6 +469,12 @@ static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
} testVec[] = {
|
||||
{ ctr256Key, (int)sizeof(ctr256Key), ctrIv,
|
||||
ctrPlain, (int)sizeof(ctrPlain), ctr256Cipher },
|
||||
/* let's try with just 9 bytes, non block size test */
|
||||
{ ctr256Key, (int)sizeof(ctr256Key), ctrIv,
|
||||
ctrPlain, (int)sizeof(oddCipher), ctr256Cipher },
|
||||
/* Counter wrapping */
|
||||
{ ctr256Key, (int)sizeof(ctr256Key), ctrIvWrap128,
|
||||
ctrPlain, (int)sizeof(ctr256Wrap128Cipher), ctr256Wrap128Cipher },
|
||||
{ ctr256Key, (int)sizeof(ctr256Key), ctrIvWrap128,
|
||||
ctrPlain, (int)sizeof(ctr256Wrap128CipherLong),
|
||||
ctr256Wrap128CipherLong },
|
||||
@ -428,33 +484,17 @@ static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (prnt)
|
||||
printf(" tsip_aes256_ctr_test() ");
|
||||
|
||||
enc = wc_AesNew(NULL, INVALID_DEVID, &ret);
|
||||
enc = wc_AesNew(NULL, devId, &ret);
|
||||
if (enc == NULL){
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
dec = wc_AesNew(NULL, INVALID_DEVID, &ret);
|
||||
dec = wc_AesNew(NULL, devId, &ret);
|
||||
if (dec == NULL){
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* test failure cases - null */
|
||||
ret = wc_tsip_AesCtr(NULL, NULL, NULL, 1);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -8; goto out;
|
||||
}
|
||||
/* test failure cases - size, but no buffer */
|
||||
ret = wc_tsip_AesCtr(enc, NULL, NULL, 1);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -9; goto out;
|
||||
}
|
||||
/* test failure cases - non block aligned */
|
||||
ret = wc_tsip_AesCtr(enc, plain, cipher, 15);
|
||||
if (ret != BAD_FUNC_ARG) {
|
||||
ret = -10; goto out;
|
||||
}
|
||||
|
||||
for (i = 0; i < AES_CTR_TEST_LEN; i++) {
|
||||
if (testVec[i].key != NULL) {
|
||||
ret = wc_AesSetKeyDirect(enc, testVec[i].key, (word32)testVec[i].keySz,
|
||||
@ -462,11 +502,6 @@ static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (ret != 0) {
|
||||
ret = -3;
|
||||
goto out;
|
||||
} else {
|
||||
/* set TSIP Aes key */
|
||||
XMEMCPY(&enc->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
enc->ctx.keySize = enc->keylen;
|
||||
}
|
||||
/* Ctr only uses encrypt, even on key setup */
|
||||
ret = wc_AesSetKeyDirect(dec, testVec[i].key, (word32)testVec[i].keySz,
|
||||
@ -474,20 +509,15 @@ static int tsip_aes256_ctr_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (ret != 0) {
|
||||
ret = -4;
|
||||
goto out;
|
||||
} else {
|
||||
/* set TSIP Aes key */
|
||||
XMEMCPY(&dec->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
dec->ctx.keySize = enc->keylen;
|
||||
}
|
||||
}
|
||||
|
||||
ret = wc_tsip_AesCtr(enc, cipher, testVec[i].plain, (word32)testVec[i].len);
|
||||
ret = wc_AesCtrEncrypt(enc, cipher, testVec[i].plain, (word32)testVec[i].len);
|
||||
if (ret != 0) {
|
||||
ret = -5;
|
||||
goto out;
|
||||
}
|
||||
ret = wc_tsip_AesCtr(dec, plain, cipher, (word32)testVec[i].len);
|
||||
ret = wc_AesCtrEncrypt(dec, plain, cipher, (word32)testVec[i].len);
|
||||
if (ret != 0) {
|
||||
ret = -6;
|
||||
goto out;
|
||||
@ -529,7 +559,7 @@ static void tskAes128_Cbc_Test(void *pvParam)
|
||||
#endif
|
||||
|
||||
#ifdef WOLFSSL_AES_256
|
||||
static int tsip_aes256_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
static int tsip_aes256_cbc_test(int prnt, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
byte cipher[WC_AES_BLOCK_SIZE];
|
||||
@ -563,14 +593,14 @@ static int tsip_aes256_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
(void)verify;
|
||||
|
||||
if (prnt)
|
||||
printf(" tsip_aes256_test() ");
|
||||
printf(" tsip_aes256_cbc_test() ");
|
||||
|
||||
if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0){
|
||||
if (wc_AesInit(dec, NULL, devId) != 0){
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@ -579,24 +609,16 @@ static int tsip_aes256_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
if (ret != 0){
|
||||
ret = -3;
|
||||
goto out;
|
||||
} else {
|
||||
XMEMCPY(&enc->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
enc->ctx.keySize = enc->keylen;
|
||||
}
|
||||
|
||||
ret = wc_AesSetKey(dec, key, (int) sizeof(key), iv, AES_DECRYPTION);
|
||||
if (ret != 0) {
|
||||
ret = -4;
|
||||
goto out;
|
||||
} else {
|
||||
XMEMCPY(&dec->ctx.tsip_keyIdx, aes_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
dec->ctx.keySize = dec->keylen;
|
||||
}
|
||||
|
||||
ForceZero(cipher, WC_AES_BLOCK_SIZE);
|
||||
ret = wc_tsip_AesCbcEncrypt(enc, cipher, msg, (int) sizeof(msg));
|
||||
ret = wc_AesCbcEncrypt(enc, cipher, msg, (int) sizeof(msg));
|
||||
|
||||
if (ret != 0) {
|
||||
ret = -5;
|
||||
@ -604,7 +626,7 @@ static int tsip_aes256_test(int prnt, tsip_aes_key_index_t* aes_key)
|
||||
}
|
||||
|
||||
ForceZero(plain, WC_AES_BLOCK_SIZE);
|
||||
ret = wc_tsip_AesCbcDecrypt(dec, plain, cipher, (int) sizeof(cipher));
|
||||
ret = wc_AesCbcDecrypt(dec, plain, cipher, (int) sizeof(cipher));
|
||||
|
||||
if (ret != 0){
|
||||
ret = -6;
|
||||
@ -647,12 +669,10 @@ static void tskAes256_Cbc_Test(void *pvParam)
|
||||
#endif /* WOLFSSL_AES_256 */
|
||||
|
||||
#if defined(WOLFSSL_AES_256)
|
||||
static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key)
|
||||
static int tsip_aesgcm256_test(int prnt, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
TsipUserCtx userContext;
|
||||
|
||||
|
||||
/*
|
||||
* This is Test Case 16 from the document Galois/
|
||||
@ -727,13 +747,12 @@ static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key)
|
||||
XMEMSET(resultT, 0, sizeof(resultT));
|
||||
XMEMSET(resultC, 0, sizeof(resultC));
|
||||
XMEMSET(resultP, 0, sizeof(resultP));
|
||||
XMEMSET(&userContext, 0, sizeof(TsipUserCtx));
|
||||
|
||||
if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0) {
|
||||
if (wc_AesInit(dec, NULL, devId) != 0) {
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@ -742,19 +761,13 @@ static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key)
|
||||
if (result != 0) {
|
||||
ret = -3;
|
||||
goto out;
|
||||
} else {
|
||||
XMEMCPY(&userContext.user_aes256_key_index, aes256_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
userContext.user_aes256_key_set = 1;
|
||||
enc->ctx.keySize = enc->keylen;
|
||||
}
|
||||
|
||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||
result = wc_tsip_AesGcmEncrypt(enc,
|
||||
result = wc_AesGcmEncrypt(enc,
|
||||
resultC, p, sizeof(p),
|
||||
(byte*)iv1, sizeof(iv1), resultT, sizeof(resultT),
|
||||
a, sizeof(a), &userContext
|
||||
);
|
||||
a, sizeof(a));
|
||||
if (result != 0) {
|
||||
ret = -4;
|
||||
goto out;
|
||||
@ -768,11 +781,10 @@ static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key)
|
||||
dec->ctx.keySize = enc->keylen;
|
||||
}
|
||||
|
||||
result = wc_tsip_AesGcmDecrypt(dec,
|
||||
result = wc_AesGcmDecrypt(dec,
|
||||
resultP, resultC, sizeof(c1),
|
||||
iv1, sizeof(iv1), resultT, sizeof(resultT),
|
||||
a, sizeof(a), &userContext
|
||||
);
|
||||
a, sizeof(a));
|
||||
if (result != 0){
|
||||
ret = -8;
|
||||
goto out;
|
||||
@ -788,21 +800,19 @@ static int tsip_aesgcm256_test(int prnt, tsip_aes_key_index_t* aes256_key)
|
||||
|
||||
wc_AesGcmSetKey(enc, k1, sizeof(k1));
|
||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||
result = wc_tsip_AesGcmEncrypt(enc,
|
||||
result = wc_AesGcmEncrypt(enc,
|
||||
resultC, p, sizeof(p), iv1, sizeof(iv1),
|
||||
resultT + 1, sizeof(resultT) - 1,
|
||||
a, sizeof(a), &userContext
|
||||
);
|
||||
a, sizeof(a));
|
||||
if (result != 0) {
|
||||
ret = -10;
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = wc_tsip_AesGcmDecrypt(enc,
|
||||
result = wc_AesGcmDecrypt(enc,
|
||||
resultP, resultC, sizeof(p),
|
||||
iv1, sizeof(iv1), resultT + 1, sizeof(resultT) - 1,
|
||||
a, sizeof(a), &userContext
|
||||
);
|
||||
a, sizeof(a));
|
||||
if (result != 0) {
|
||||
ret = -11;
|
||||
goto out;
|
||||
@ -847,11 +857,10 @@ static void tskAes256_Gcm_Test(void *pvParam)
|
||||
|
||||
#if defined(WOLFSSL_AES_128) && defined(HAVE_AESGCM)
|
||||
|
||||
static int tsip_aesgcm128_test(int prnt, tsip_aes_key_index_t* aes128_key)
|
||||
static int tsip_aesgcm128_test(int prnt, int devId)
|
||||
{
|
||||
Aes enc[1];
|
||||
Aes dec[1];
|
||||
TsipUserCtx userContext;
|
||||
|
||||
/* The following is an interesting test case from the example
|
||||
* FIPS test vectors for AES-GCM. IVlen = 1 byte */
|
||||
@ -906,14 +915,13 @@ static int tsip_aesgcm128_test(int prnt, tsip_aes_key_index_t* aes128_key)
|
||||
XMEMSET(resultT, 0, sizeof(resultT));
|
||||
XMEMSET(resultC, 0, sizeof(resultC));
|
||||
XMEMSET(resultP, 0, sizeof(resultP));
|
||||
XMEMSET(&userContext, 0, sizeof(TsipUserCtx));
|
||||
|
||||
if (wc_AesInit(enc, NULL, INVALID_DEVID) != 0) {
|
||||
if (wc_AesInit(enc, NULL, devId) != 0) {
|
||||
ret = -1;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (wc_AesInit(dec, NULL, INVALID_DEVID) != 0) {
|
||||
if (wc_AesInit(dec, NULL, devId) != 0) {
|
||||
ret = -2;
|
||||
goto out;
|
||||
}
|
||||
@ -922,29 +930,17 @@ static int tsip_aesgcm128_test(int prnt, tsip_aes_key_index_t* aes128_key)
|
||||
if (result != 0) {
|
||||
ret = -3;
|
||||
goto out;
|
||||
} else {
|
||||
XMEMCPY(&userContext.user_aes128_key_index, aes128_key,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
userContext.user_aes128_key_set = 1;
|
||||
enc->ctx.keySize = enc->keylen;
|
||||
}
|
||||
/* AES-GCM encrypt and decrypt both use AES encrypt internally */
|
||||
result = wc_tsip_AesGcmEncrypt(enc,
|
||||
resultC, p3, sizeof(p3),
|
||||
iv3, sizeof(iv3),
|
||||
resultT, sizeof(t3),
|
||||
a3, sizeof(a3), &userContext
|
||||
);
|
||||
result = wc_AesGcmEncrypt(enc,resultC, p3, sizeof(p3), iv3, sizeof(iv3),
|
||||
resultT, sizeof(t3),a3, sizeof(a3));
|
||||
if (result != 0) {
|
||||
ret = -4;
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = wc_tsip_AesGcmDecrypt(enc,
|
||||
resultP, resultC, sizeof(c3),
|
||||
iv3, sizeof(iv3), resultT, sizeof(resultT),
|
||||
a3, sizeof(a3), &userContext
|
||||
);
|
||||
result = wc_AesGcmDecrypt(enc, resultP, resultC, sizeof(c3),
|
||||
iv3, sizeof(iv3), resultT, sizeof(resultT), a3, sizeof(a3));
|
||||
if (result != 0) {
|
||||
ret = -5;
|
||||
goto out;
|
||||
@ -1031,7 +1027,7 @@ static void tskSha256_Test(void *pvParam)
|
||||
#endif
|
||||
#endif /* FREERTOS */
|
||||
|
||||
#if !defined(NO_RSA)
|
||||
#if !defined(NO_RSA) && defined(WOLFSSL_KEY_GEN)
|
||||
|
||||
/* testing rsa sign/verify w/ rsa 2048 bit key */
|
||||
#define TEST_STRING "Everyone gets Friday off."
|
||||
@ -1513,90 +1509,91 @@ int tsip_crypt_Sha_AesCbcGcm_multitest(void)
|
||||
int tsip_crypt_test(void)
|
||||
{
|
||||
int ret = 0;
|
||||
e_tsip_err_t tsip_error_code;
|
||||
int devId;
|
||||
|
||||
/* Generate AES tsip Key */
|
||||
tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex(
|
||||
&g_user_aes128_key_index1);
|
||||
Clr_CallbackCtx(&userContext);
|
||||
if (ret != 0) {
|
||||
printf("TSIP Key Generation failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (tsip_error_code == TSIP_SUCCESS)
|
||||
tsip_error_code = R_TSIP_GenerateAes128RandomKeyIndex(
|
||||
&g_user_aes128_key_index2);
|
||||
devId = wc_CryptoCb_CryptInitRenesasCmn(NULL, &userContext);
|
||||
if (devId > 0){
|
||||
ret = 0;
|
||||
}
|
||||
|
||||
if (tsip_error_code == TSIP_SUCCESS)
|
||||
tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex(
|
||||
&g_user_aes256_key_index1);
|
||||
|
||||
if (tsip_error_code == TSIP_SUCCESS)
|
||||
tsip_error_code = R_TSIP_GenerateAes256RandomKeyIndex(
|
||||
&g_user_aes256_key_index2);
|
||||
|
||||
if (tsip_error_code == TSIP_SUCCESS) {
|
||||
|
||||
#ifndef NO_SHA
|
||||
if (ret == 0) {
|
||||
#ifndef NO_SHA
|
||||
printf(" sha_test()");
|
||||
ret = sha_test();
|
||||
RESULT_STR(ret)
|
||||
#endif
|
||||
RESULT_STR(ret);
|
||||
#endif
|
||||
|
||||
#ifndef NO_SHA256
|
||||
#ifndef NO_SHA256
|
||||
printf(" sha256_test()");
|
||||
ret = sha256_test();
|
||||
RESULT_STR(ret)
|
||||
#endif
|
||||
|
||||
ret = tsip_aes_cbc_test(1, &g_user_aes128_key_index1);
|
||||
|
||||
if (ret == 0) {
|
||||
|
||||
ret = tsip_aes256_test(1, &g_user_aes256_key_index1);
|
||||
|
||||
ret = sha256_test();
|
||||
RESULT_STR(ret);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_AESGCM
|
||||
if (ret == 0) {
|
||||
|
||||
ret = tsip_aesgcm128_test(1, &g_user_aes128_key_index1);
|
||||
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
|
||||
ret = tsip_aesgcm256_test(1, &g_user_aes256_key_index1);
|
||||
|
||||
}
|
||||
#endif
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
if (ret == 0) {
|
||||
ret = tsip_aes128_ctr_test(1, &g_user_aes128_key_index1);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
ret = tsip_aes256_ctr_test(1, &g_user_aes256_key_index1);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
#endif
|
||||
#if defined(WOLFSSL_KEY_GEN) && \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
|
||||
|
||||
#ifdef HAVE_AES_CBC
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 16);
|
||||
if (ret == 0)
|
||||
ret = tsip_aes128_cbc_test(1, devId);
|
||||
if (ret == 0) {
|
||||
Clr_CallbackCtx(&userContext);
|
||||
|
||||
ret = wc_CryptoCb_CryptInitRenesasCmn(NULL, &userContext);
|
||||
|
||||
if (ret > 0)
|
||||
ret = 0;
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 32);
|
||||
if (ret == 0)
|
||||
ret = tsip_aes256_cbc_test(1, devId);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if RSA_MIN_SIZE <= 1024
|
||||
#ifdef HAVE_AESGCM
|
||||
if (ret == 0) {
|
||||
Clr_CallbackCtx(&userContext);
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 16);
|
||||
if (ret == 0)
|
||||
ret = tsip_aesgcm128_test(1, devId);
|
||||
}
|
||||
if (ret == 0) {
|
||||
Clr_CallbackCtx(&userContext);
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 32);
|
||||
if (ret == 0)
|
||||
ret = tsip_aesgcm256_test(1, devId);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_AES_COUNTER) &&\
|
||||
(defined(TSIP_AES_128_CTR) && TSIP_AES_128_CTR == 1)
|
||||
#if defined(WOLFSSL_AES_128)
|
||||
Clr_CallbackCtx(&userContext);
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 16);
|
||||
if (ret == 0) {
|
||||
ret = tsip_aes128_ctr_test(1, devId);
|
||||
RESULT_STR(ret);
|
||||
}
|
||||
#endif
|
||||
#if defined(WOLFSSL_AES_256)
|
||||
Clr_CallbackCtx(&userContext);
|
||||
ret = TSIP_AesKeyGeneration(&userContext, 32);
|
||||
if (ret == 0) {
|
||||
ret = tsip_aes256_ctr_test(1, devId);
|
||||
RESULT_STR(ret);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(WOLFSSL_KEY_GEN) && \
|
||||
defined(WOLFSSL_RENESAS_TSIP_CRYPTONLY)
|
||||
#if RSA_MIN_SIZE <= 1024
|
||||
if (ret == 0) {
|
||||
userContext.wrappedKeyType = TSIP_KEY_TYPE_RSA1024;
|
||||
printf(" tsip_rsa_test(1024)");
|
||||
ret = tsip_rsa_test(1, 1024);
|
||||
RESULT_STR(ret)
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (ret == 0) {
|
||||
userContext.wrappedKeyType = TSIP_KEY_TYPE_RSA2048;
|
||||
printf(" tsip_rsa_test(2048)");
|
||||
@ -1605,7 +1602,7 @@ int tsip_crypt_test(void)
|
||||
}
|
||||
|
||||
|
||||
#if RSA_MIN_SIZE <= 1024
|
||||
#if RSA_MIN_SIZE <= 1024
|
||||
if (ret == 0) {
|
||||
printf(" tsip_rsa_SignVerify_test(1024)");
|
||||
|
||||
@ -1618,7 +1615,7 @@ int tsip_crypt_test(void)
|
||||
}
|
||||
|
||||
Clr_CallbackCtx(&userContext);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if (ret == 0) {
|
||||
printf(" tsip_rsa_SignVerify_test(2048)");
|
||||
|
@ -181,68 +181,7 @@ static int Renesas_cmn_CryptoDevCb(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
|
||||
if (info->algo_type == WC_ALGO_TYPE_CIPHER) {
|
||||
#if !defined(NO_AES)
|
||||
#ifdef HAVE_AESGCM
|
||||
if (info->cipher.type == WC_CIPHER_AES_GCM
|
||||
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
||||
&& cbInfo->session_key_set == 1
|
||||
#endif
|
||||
) {
|
||||
|
||||
if (info->cipher.enc) {
|
||||
ret = wc_tsip_AesGcmEncrypt(
|
||||
info->cipher.aesgcm_enc.aes,
|
||||
(byte*)info->cipher.aesgcm_enc.out,
|
||||
(byte*)info->cipher.aesgcm_enc.in,
|
||||
info->cipher.aesgcm_enc.sz,
|
||||
(byte*)info->cipher.aesgcm_enc.iv,
|
||||
info->cipher.aesgcm_enc.ivSz,
|
||||
(byte*)info->cipher.aesgcm_enc.authTag,
|
||||
info->cipher.aesgcm_enc.authTagSz,
|
||||
(byte*)info->cipher.aesgcm_enc.authIn,
|
||||
info->cipher.aesgcm_enc.authInSz,
|
||||
(void*)ctx);
|
||||
|
||||
}
|
||||
else {
|
||||
ret = wc_tsip_AesGcmDecrypt(
|
||||
info->cipher.aesgcm_dec.aes,
|
||||
(byte*)info->cipher.aesgcm_dec.out,
|
||||
(byte*)info->cipher.aesgcm_dec.in,
|
||||
info->cipher.aesgcm_dec.sz,
|
||||
(byte*)info->cipher.aesgcm_dec.iv,
|
||||
info->cipher.aesgcm_dec.ivSz,
|
||||
(byte*)info->cipher.aesgcm_dec.authTag,
|
||||
info->cipher.aesgcm_dec.authTagSz,
|
||||
(byte*)info->cipher.aesgcm_dec.authIn,
|
||||
info->cipher.aesgcm_dec.authInSz,
|
||||
(void*)ctx);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_AESGCM */
|
||||
#ifdef HAVE_AES_CBC
|
||||
if (info->cipher.type == WC_CIPHER_AES_CBC
|
||||
#ifdef WOLFSSL_RENESAS_TSIP_TLS
|
||||
&& cbInfo->session_key_set == 1
|
||||
#endif
|
||||
) {
|
||||
|
||||
if (info->cipher.enc) {
|
||||
ret = wc_tsip_AesCbcEncrypt(
|
||||
info->cipher.aescbc.aes,
|
||||
(byte*)info->cipher.aescbc.out,
|
||||
(byte*)info->cipher.aescbc.in,
|
||||
info->cipher.aescbc.sz);
|
||||
|
||||
}
|
||||
else {
|
||||
ret = wc_tsip_AesCbcDecrypt(
|
||||
info->cipher.aescbc.aes,
|
||||
(byte*)info->cipher.aescbc.out,
|
||||
(byte*)info->cipher.aescbc.in,
|
||||
info->cipher.aescbc.sz);
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_AES_CBC */
|
||||
ret = wc_tsip_AesCipher(devIdArg, info, ctx);
|
||||
#endif /* !NO_AES */
|
||||
}
|
||||
|
||||
|
@ -383,6 +383,50 @@ WOLFSSL_LOCAL int tsip_Tls13AesDecrypt(
|
||||
#if (WOLFSSL_RENESAS_TSIP_VER >= 109)
|
||||
#ifdef WOLF_CRYPTO_CB
|
||||
|
||||
static int _tsip_cpAesKeyIndex2AesCtx(wc_CryptoInfo* info, TsipUserCtx* cb)
|
||||
{
|
||||
Aes* aes = NULL;
|
||||
|
||||
if (!info || !cb)
|
||||
return -1;
|
||||
|
||||
switch(info->cipher.type) {
|
||||
#ifdef HAVE_AESGCM
|
||||
case WC_CIPHER_AES_GCM:
|
||||
if (info->cipher.enc)
|
||||
aes = info->cipher.aesgcm_enc.aes;
|
||||
else
|
||||
aes = info->cipher.aesgcm_dec.aes;
|
||||
break;
|
||||
#endif
|
||||
#ifdef HAVE_AES_CBC
|
||||
case WC_CIPHER_AES_CBC:
|
||||
aes = info->cipher.aescbc.aes;
|
||||
break;
|
||||
#endif
|
||||
#ifdef WOLFSSL_AES_COUNTER
|
||||
case WC_CIPHER_AES_CTR:
|
||||
aes = info->cipher.aesctr.aes;
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (aes && cb->user_aes256_key_set == 1) {
|
||||
XMEMCPY(&aes->ctx.tsip_keyIdx,&cb->user_aes256_key_index,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
aes->ctx.keySize = 32;
|
||||
}else if (aes && cb->user_aes128_key_set == 1) {
|
||||
XMEMCPY(&aes->ctx.tsip_keyIdx,&cb->user_aes128_key_index,
|
||||
sizeof(tsip_aes_key_index_t));
|
||||
aes->ctx.keySize = 16;
|
||||
} else
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int wc_tsip_AesCipher(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
{
|
||||
int ret = WC_NO_ERR_TRACE(NOT_COMPILED_IN);
|
||||
@ -404,7 +448,12 @@ int wc_tsip_AesCipher(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
&& cbInfo != NULL && cbInfo->session_key_set == 1
|
||||
#endif
|
||||
) {
|
||||
|
||||
ret = _tsip_cpAesKeyIndex2AesCtx(info, cbInfo);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("Failed to copy Aes Key Index from "
|
||||
"UserCtx to AES Ctx");
|
||||
return ret;
|
||||
}
|
||||
if (info->cipher.enc) {
|
||||
ret = wc_tsip_AesGcmEncrypt(
|
||||
info->cipher.aesgcm_enc.aes,
|
||||
@ -443,12 +492,21 @@ int wc_tsip_AesCipher(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
&& cbInfo != NULL && cbInfo->session_key_set == 1
|
||||
#endif
|
||||
) {
|
||||
/* encrypt and decrypt use same routine */
|
||||
ret = wc_tsip_AesCtr(
|
||||
info->cipher.aesctr.aes,
|
||||
(byte*)info->cipher.aesctr.out,
|
||||
(byte*)info->cipher.aesctr.in,
|
||||
info->cipher.aesctr.sz);
|
||||
int remain = (int)(info->cipher.aesctr.sz % WC_AES_BLOCK_SIZE);
|
||||
if (remain == 0) {
|
||||
ret = _tsip_cpAesKeyIndex2AesCtx(info, cbInfo);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("Failed to copy Aes Key Index from "
|
||||
"UserCtx to AES Ctx");
|
||||
return ret;
|
||||
}
|
||||
/* encrypt and decrypt use same routine */
|
||||
ret = wc_tsip_AesCtr(
|
||||
info->cipher.aesctr.aes,
|
||||
(byte*)info->cipher.aesctr.out,
|
||||
(byte*)info->cipher.aesctr.in,
|
||||
info->cipher.aesctr.sz);
|
||||
}
|
||||
}
|
||||
#endif /* WOLFSSL_AES_COUNTER */
|
||||
|
||||
@ -458,7 +516,12 @@ int wc_tsip_AesCipher(int devIdArg, wc_CryptoInfo* info, void* ctx)
|
||||
&& cbInfo != NULL && cbInfo->session_key_set == 1
|
||||
#endif
|
||||
) {
|
||||
|
||||
ret = _tsip_cpAesKeyIndex2AesCtx(info, cbInfo);
|
||||
if (ret != 0) {
|
||||
WOLFSSL_MSG("Failed to copy Aes Key Index from "
|
||||
"UserCtx to AES Ctx");
|
||||
return ret;
|
||||
}
|
||||
if (info->cipher.enc) {
|
||||
ret = wc_tsip_AesCbcEncrypt(
|
||||
info->cipher.aescbc.aes,
|
||||
|
Reference in New Issue
Block a user