mirror of https://github.com/wolfSSL/wolfBoot.git
reorganize folders under IDE/Renesas
parent
737c549161
commit
5ed7390c40
|
@ -1,35 +1,39 @@
|
||||||
## wolfBoot for Renesas RX72N
|
## wolfBoot for Renesas RX72N
|
||||||
|
|
||||||
#define BSP_CFG_USTACK_BYTES (0x2000)
|
## 1. Overview
|
||||||
|
|
||||||
```
|
It demonstrates simple secure firmware update by wolfBoot. A sample application v1 is
|
||||||
MCU: Renesas RX72N
|
securely updated to v2. Both versions behave the same except displaying its version of v1 or v2.
|
||||||
Board: RX72N/Envision Kit
|
They are compiled by e2Studio and running on the target board.
|
||||||
IDE: e2Studio
|
|
||||||
Compiler: CCRX
|
In this demo, you may download two versions of application binary file by Renesas Flash Programmer.
|
||||||
FIT Module: r_flash_rx
|
You can download and excute wolfBoot by e2Studio debugger. Use a USB connection between PC and the
|
||||||
|
board for the debugger and flash programmer.
|
||||||
|
|
||||||
|
## 2. Components and Tools
|
||||||
|
|
||||||
|
|Item|Name/Version|Note|
|
||||||
|
|:--|:--|:--|
|
||||||
|
|Board|RX72N/Envision Kit||
|
||||||
|
|MCU|Renesas RX72N|R5F572NNxFB|
|
||||||
|
|IDE|e2studio 2022-07|Download from Renesas site|
|
||||||
|
|Compiler|CCRX v3.04.00||
|
||||||
|
|FIT Module||Download from Renesas site|
|
||||||
|
|Flash Writer|Renesas Flash Programmer v3|Download from Renesas site|
|
||||||
|
|Key tools|keygen and sign|Included in wolfBoot|
|
||||||
|
|rx-elf-objcopy|GCC for Renesas RX 8.3.0.202202-GNURX-ELF|Included in GCC for Renesas RX|
|
||||||
|
|
||||||
|
|
||||||
e2Studio Project:
|
FIT Module
|
||||||
wolfBoot IDE/Renesas/e2studio_CCRX/wolfBoot
|
|Module|Version|Note|
|
||||||
Sample app IDE/Renesas/e2studio_CCRX/app_RenesasRX01
|
|:--|:--|:--|
|
||||||
|
|r_bsp|v7.20|#define BSP_CFG_USTACK_BYTES (0x2000)|
|
||||||
Other Tools:
|
||key size uses rsa-3072, please sets to (0x3000)|
|
||||||
- Key tool
|
|r_flash_rx|v4.90||
|
||||||
Key generation tools/keytools/keygen
|
|
||||||
Signature tools/keytools/sign
|
|
||||||
Included in wolfBoot with source code
|
|
||||||
|
|
||||||
- Flash Wirter
|
|
||||||
Renesas Flash Programmer v3
|
|
||||||
Download from Renesas site
|
|
||||||
|
|
||||||
- Binary tool:
|
|
||||||
rx-elf-objcopy.exe
|
|
||||||
Included in GCC for Renesas RX
|
|
||||||
|
|
||||||
|
|
||||||
Flash Allocation:
|
Flash Allocation:
|
||||||
|
```
|
||||||
+---------------------------+------------------------+-----+
|
+---------------------------+------------------------+-----+
|
||||||
| B |H| |H| | |
|
| B |H| |H| | |
|
||||||
| o |e| Primary |e| Update |Swap |
|
| o |e| Primary |e| Update |Swap |
|
||||||
|
@ -38,13 +42,19 @@ Flash Allocation:
|
||||||
+---------------------------+------------------------+-----+
|
+---------------------------+------------------------+-----+
|
||||||
0xffc00000: wolfBoot
|
0xffc00000: wolfBoot
|
||||||
0xffc10000: Primary partition (Header)
|
0xffc10000: Primary partition (Header)
|
||||||
0xffc10100: Primary partition (Application image)
|
0xffc10100: Primary partition (Application image) /* When it uses IMAGE_HEADER_SIZE 256, e.g. ED25519, EC256, EC384 or EC512 */
|
||||||
|
0xffc10200: Primary partition (Application image) /* When it uses IMAGE_HEADER_SIZE 512, e.g. RSA2048, RSA3072 */
|
||||||
0xffdf0000: Update partition (Header)
|
0xffdf0000: Update partition (Header)
|
||||||
0xffdf0100: Update partition (Application image)
|
0xffdf0100: Update partition (Application image)
|
||||||
0xfffd0000: Swap sector
|
0xfffd0000: Swap sector
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Decription
|
Note : Depending on IMAGE_HEADER_SIZE, it needs to change the address of Power Reset vector by Linker section.
|
||||||
|
Application default is set to 0xffc10200. It means that you need to change it when you use 256 IMAGE_HEADER_SIZE.
|
||||||
|
|
||||||
|
|
||||||
|
## 3. How to build and use
|
||||||
It has key tools running under the host environment such as Linux, Windows or MacOS.
|
It has key tools running under the host environment such as Linux, Windows or MacOS.
|
||||||
For comiling the tools, follow the instruction described in the user manual.
|
For comiling the tools, follow the instruction described in the user manual.
|
||||||
|
|
||||||
|
@ -57,7 +67,7 @@ You can download and excute wolfBoot by e2Studio debugger. Use a USB connection
|
||||||
board for the debugger and flash programmer.
|
board for the debugger and flash programmer.
|
||||||
|
|
||||||
|
|
||||||
### 1) Key generation
|
### 3-1 Key generation
|
||||||
|
|
||||||
```
|
```
|
||||||
$ cd <wolfBoot>
|
$ cd <wolfBoot>
|
||||||
|
@ -74,12 +84,12 @@ key to the store.
|
||||||
You can specify various signature algorithms such as
|
You can specify various signature algorithms such as
|
||||||
|
|
||||||
```
|
```
|
||||||
--ed25519 --ed448 --ecc256 --ecc384 --ecc521 --rsa2048 --rsa3072 --rsa4096
|
--ed25519 --ed448 --ecc256 --ecc384 --ecc521 --rsa2048 --rsa3072
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2) Compile wolfBoot
|
### 3-2 Compile wolfBoot
|
||||||
|
|
||||||
Open project under IDE/Renesas/e2studio_CCRX/wolfBoot with e2Studio, and build the project.
|
Open project under IDE/Renesas/e2studio/RX72N/wolfBoot with e2Studio, and build the project.
|
||||||
|
|
||||||
Project properties are preset for the demo.
|
Project properties are preset for the demo.
|
||||||
|
|
||||||
|
@ -88,12 +98,13 @@ Smart Configurator
|
||||||
Flash Driver: r_flash_rx
|
Flash Driver: r_flash_rx
|
||||||
|
|
||||||
Include Paths
|
Include Paths
|
||||||
"C:..\..\..\..\..\IDE/Renesas/e2Studio_CCRX/include
|
../../include : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include
|
||||||
"C:..\..\..\..\..\wolfBoot\wolfboot/include"
|
../../../../../../include : <wolfBoot>/include
|
||||||
"C:..\..\..\..\..\wolfBoot\wolfboot\include"
|
../../../../../../lib/wolfssl/ : <wolfBoot>/lib/wolfssl
|
||||||
|
|
||||||
Pre-Include
|
Pre-Include
|
||||||
../../../../../include/user_settings.h
|
../../include/user_settings.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/user_settigs.h
|
||||||
|
../../include/target.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/target.h
|
||||||
|
|
||||||
Pre-defined Pre-processor Macro
|
Pre-defined Pre-processor Macro
|
||||||
__WOLFBOOT
|
__WOLFBOOT
|
||||||
|
@ -106,9 +117,9 @@ WOLFBOOT_PARTION_INFO, PRINTF_ENABLED are for debug information about partitions
|
||||||
Eliminate them for operational use.
|
Eliminate them for operational use.
|
||||||
|
|
||||||
|
|
||||||
### 3) Compile the sample application
|
### 3-4 Compile the sample application
|
||||||
|
|
||||||
Open project under IDE/Renesas/e2studio_CCRX/app_RenesasRx01 with e2Studio, and build the project.
|
Open project under IDE/Renesas/e2studio/RX72N/app_RenesasRx01 with e2Studio, and build the project.
|
||||||
|
|
||||||
|
|
||||||
Project properties are preset for the demo.
|
Project properties are preset for the demo.
|
||||||
|
@ -118,15 +129,15 @@ Smart Configurator
|
||||||
Flash Driver: r_flash_rx
|
Flash Driver: r_flash_rx
|
||||||
|
|
||||||
Include Paths
|
Include Paths
|
||||||
"C:..\..\..\..\..\IDE/Renesas/e2Studio_CCRX/include
|
Include Paths
|
||||||
"C:..\..\..\..\..\wolfBoot\wolfboot/include"
|
../../include : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include
|
||||||
"C:..\..\..\..\..\wolfBoot\wolfboot\include"
|
../../../../../../include : <wolfBoot>/include
|
||||||
|
|
||||||
Pre-Include
|
Pre-Include
|
||||||
../../include/user_settings.h
|
../../include/user_settings.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/user_settigs.h
|
||||||
../../include/terget.h
|
../../include/target.h : <wolfBoot>/IDE/Renesas/e2studio/RX72N/include/target.h
|
||||||
|
|
||||||
Code Origin and entry point (PResetPRG) is "0xffc10100" (See Section Viewer of Linker Section).
|
Code Origin and entry point (PResetPRG) is "0xffc10200" (See Section Viewer of Linker Section).
|
||||||
```
|
```
|
||||||
|
|
||||||
app_RenesasRx01.x in ELF is gnerated under HardwareDebug. You can derive bair binary file
|
app_RenesasRx01.x in ELF is gnerated under HardwareDebug. You can derive bair binary file
|
||||||
|
@ -140,7 +151,7 @@ $ rx-elf-objcopy.exe -O binary\
|
||||||
-R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT app_RenesasRx01.x app_RenesasRx01.bin
|
-R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT app_RenesasRx01.x app_RenesasRx01.bin
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4) Generate Signature for app V1
|
### 3-5 Generate Signature for app V1
|
||||||
|
|
||||||
"sign" command under tools/keytools benerates a signature for the binary with a specified version.
|
"sign" command under tools/keytools benerates a signature for the binary with a specified version.
|
||||||
It generates a file contain a partition header and application image. The partition header
|
It generates a file contain a partition header and application image. The partition header
|
||||||
|
@ -163,7 +174,7 @@ Signing the digest...
|
||||||
Output image(s) successfully created.
|
Output image(s) successfully created.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5) Download the app V1
|
### 3-6 Download the app V1
|
||||||
|
|
||||||
You can convert the binary file to hex format and download it to the board by Flash Programmer.
|
You can convert the binary file to hex format and download it to the board by Flash Programmer.
|
||||||
The partition starts at "0xffc10000".
|
The partition starts at "0xffc10000".
|
||||||
|
@ -173,7 +184,7 @@ $ rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffc10000 app_Renesas
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### 6) Execute inital boot
|
### 3-7 Execute inital boot
|
||||||
|
|
||||||
Now, you can download and start wolfBoot program by e2Studio debugger.
|
Now, you can download and start wolfBoot program by e2Studio debugger.
|
||||||
After starting the program, you can see the partition information as follows.
|
After starting the program, you can see the partition information as follows.
|
||||||
|
@ -182,28 +193,31 @@ application V1.
|
||||||
|
|
||||||
|
|
||||||
```
|
```
|
||||||
=== Boot Partition[ffc10000] ===
|
|
||||||
Magic: WOLF
|
|
||||||
Version: 01
|
|
||||||
Status: ff
|
|
||||||
Tail Mgc: <20><><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
|
|
||||||
=== Update Partition[ffdf0000] ===
|
|
||||||
Magic: <20><><EFBFBD><EFBFBD>
|
|
||||||
Version: ff
|
|
||||||
Status: ff
|
|
||||||
Tail Mgc: <20><><EFBFBD><EFBFBD>
|
|
||||||
|
|
||||||
| ------------------------------------------------------------------- |
|
| ------------------------------------------------------------------- |
|
||||||
| Renesas RX User Application in BOOT partition started by wolfBoot |
|
| Renesas RX User Application in BOOT partition started by wolfBoot |
|
||||||
| ------------------------------------------------------------------- |
|
| ------------------------------------------------------------------- |
|
||||||
|
|
||||||
|
|
||||||
|
=== Boot Partition[ffc10000] ===
|
||||||
|
Magic: WOLF
|
||||||
|
Version: 01
|
||||||
|
Status: ff
|
||||||
|
Tail Mgc: ????
|
||||||
|
|
||||||
|
=== Update Partition[ffdf0000] ===
|
||||||
|
Magic: WOLF
|
||||||
|
Version: 02
|
||||||
|
Status: ff
|
||||||
|
Tail Mgc: ????
|
||||||
|
|
||||||
Current Firmware Version: 1
|
Current Firmware Version: 1
|
||||||
Hit any key to update the firmware.
|
Hit any key to call wolfBoot_success the firmware.
|
||||||
```
|
```
|
||||||
The application calls wolfBoot_success() to set boot partition
|
|
||||||
state and wait for any key. if you re-start the boot program at this moment,
|
After hitting any key, the application calls wolfBoot_success() to set boot partition
|
||||||
|
state and wait for any key again.
|
||||||
|
|
||||||
|
if you re-start the boot program at this moment,
|
||||||
after checking the integlity and authenticity, it jumps to the application.
|
after checking the integlity and authenticity, it jumps to the application.
|
||||||
You can see the state is Success("00").
|
You can see the state is Success("00").
|
||||||
|
|
||||||
|
@ -213,9 +227,17 @@ Magic: WOLF
|
||||||
Version: 01
|
Version: 01
|
||||||
Status: 00
|
Status: 00
|
||||||
Tail Mgc: BOOT
|
Tail Mgc: BOOT
|
||||||
|
|
||||||
|
=== Update Partition[ffdf0000] ===
|
||||||
|
Magic: WOLF
|
||||||
|
Version: 02
|
||||||
|
Status: ff
|
||||||
|
Tail Mgc: ????
|
||||||
|
|
||||||
|
Hit any key to update the firmware.
|
||||||
```
|
```
|
||||||
|
|
||||||
### 7) Generate Signed app V2 and download it
|
### 3-8 Generate Signed app V2 and download it
|
||||||
|
|
||||||
Similar to V1, you can signe and generate a binary of V2. The update partition starts at "0xffdf0000".
|
Similar to V1, you can signe and generate a binary of V2. The update partition starts at "0xffdf0000".
|
||||||
You can download it by the flash programmer.
|
You can download it by the flash programmer.
|
||||||
|
@ -227,7 +249,7 @@ rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffdf0000 app_RenesasRx
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
### 8) Re-boot and secure update to V2
|
### 3-9 Re-boot and secure update to V2
|
||||||
|
|
||||||
Now the image is downloaded but note that the partition status is not changed yet.
|
Now the image is downloaded but note that the partition status is not changed yet.
|
||||||
When it is re-boot, it checks integlity and authenticity of V1 and initiate V1 as in
|
When it is re-boot, it checks integlity and authenticity of V1 and initiate V1 as in
|
||||||
|
@ -240,6 +262,7 @@ step 6.
|
||||||
|
|
||||||
Current Firmware Version: 1
|
Current Firmware Version: 1
|
||||||
Hit any key to update the firmware.
|
Hit any key to update the firmware.
|
||||||
|
Firmware Update is triggered
|
||||||
```
|
```
|
||||||
|
|
||||||
After you see the message, hit any key so that the application calls
|
After you see the message, hit any key so that the application calls
|
||||||
|
@ -261,13 +284,20 @@ information.
|
||||||
| Renesas RX User Application in BOOT partition started by wolfBoot |
|
| Renesas RX User Application in BOOT partition started by wolfBoot |
|
||||||
| ------------------------------------------------------------------- |
|
| ------------------------------------------------------------------- |
|
||||||
|
|
||||||
|
|
||||||
|
=== Boot Partition[ffc10000] ===
|
||||||
|
Magic: WOLF
|
||||||
|
Version: 02
|
||||||
|
Status: 10
|
||||||
|
Tail Mgc: BOOT
|
||||||
|
|
||||||
|
=== Update Partition[ffdf0000] ===
|
||||||
|
Magic: WOLF
|
||||||
|
Version: 01
|
||||||
|
Status: ff
|
||||||
|
Tail Mgc: ????
|
||||||
|
|
||||||
Current Firmware Version: 2
|
Current Firmware Version: 2
|
||||||
Hit any key to update the firmware.
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Not the application behavior is almost identical but the Version is "2" this time.
|
Not the application behavior is almost identical but the Version is "2" this time.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Creating an application project from scratch
|
|
||||||
|
|
|
@ -51,8 +51,7 @@
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.126437015" 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 id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.126437015" 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.2039443943" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include.2039443943" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value="../../include"/>
|
<listOptionValue builtIn="false" value="../../include"/>
|
||||||
<listOptionValue builtIn="false" value="../../../../../include"/>
|
<listOptionValue builtIn="false" value="../../../../../../include"/>
|
||||||
<listOptionValue builtIn="false" value="../../../../../lib/wolfssl"/>
|
|
||||||
<listOptionValue builtIn="false" value="${TCINSTALL}/include"/>
|
<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/general}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_pincfg}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_pincfg}""/>
|
||||||
|
@ -83,7 +82,7 @@
|
||||||
<listOptionValue builtIn="false" value="../../include/target.h"/>
|
<listOptionValue builtIn="false" value="../../include/target.h"/>
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.1700820161" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.1700820161" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" useByScannerDiscovery="false" valueType="definedSymbols"/>
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.467816924" name="最適化レベル (-optimize)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.level0" valueType="enumerated"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.467816924" name="最適化レベル (-optimize)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.level2" valueType="enumerated"/>
|
||||||
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType.234428537" name="Compiler Input C" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType"/>
|
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType.234428537" name="Compiler Input C" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType"/>
|
||||||
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType.1840988365" name="Compiler Input CPP" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType"/>
|
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType.1840988365" name="Compiler Input CPP" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType"/>
|
||||||
</tool>
|
</tool>
|
||||||
|
@ -132,6 +131,47 @@
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.checkSection.140974100" name="セクションの割り付けアドレスをチェックする (-cpu)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.checkSection" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.checkSection.140974100" name="セクションの割り付けアドレスをチェックする (-cpu)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.checkSection" useByScannerDiscovery="false" value="true" valueType="boolean"/>
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType.1210271160" name="アドレス範囲指定方法 (-cpu(アドレス範囲指定方法))" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType.autoSpecify" valueType="enumerated"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType.1210271160" name="アドレス範囲指定方法 (-cpu(アドレス範囲指定方法))" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.memoryType.autoSpecify" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList.2135498774" name="(リンク順序のリスト) (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList" useByScannerDiscovery="false" valueType="stringList">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList.2135498774" name="(リンク順序のリスト) (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList" useByScannerDiscovery="false" valueType="stringList">
|
||||||
|
<listOptionValue builtIn="false" value="".\src\app_RenesasRX01.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src\libwolfboot.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src\renesas-rx.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/general\r_cg_hardware_setup.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/general\r_smc_cgc.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/general\r_smc_cgc_user.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/general\r_smc_interrupt.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/board/generic_rx72n\hwsetup.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\dbsct.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\lowlvl.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\lowsrc.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\mcu_locks.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_common.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_cpu.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_interrupts.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_locking.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_mcu_startup.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_bsp_software_interrupt.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\r_rx_intrinsic_functions.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\resetprg.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/all\sbrk.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/rx72n\mcu_clocks.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/rx72n\mcu_init.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/rx72n\mcu_interrupts.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/rx72n\mcu_mapped_interrupts.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_bsp/mcu/rx72n\vecttbl.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_byteq/src\r_byteq.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src/flash_type_1\r_flash_type1.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src/flash_type_3\r_flash_type3.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src/flash_type_4\r_flash_type4.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src\r_flash_fcu.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src\r_flash_group.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src\r_flash_nofcu.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_flash_rx/src\r_flash_rx.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_pincfg\Pin.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_pincfg\r_sci_rx_pinset.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_sci_rx/src\r_sci_rx.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_sci_rx/src\r_sci_rx_dmaca.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_sci_rx/src\r_sci_rx_dtc.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_sci_rx/src/targets/rx72n\r_sci_rx72n.obj""/>
|
||||||
|
<listOptionValue builtIn="false" value="".\src/smc_gen/r_sci_rx/src/targets/rx72n\r_sci_rx72n_data.obj""/>
|
||||||
<listOptionValue builtIn="false" value="".\app_RenesasRX01.lib""/>
|
<listOptionValue builtIn="false" value="".\app_RenesasRX01.lib""/>
|
||||||
</option>
|
</option>
|
||||||
</tool>
|
</tool>
|
|
@ -37,12 +37,12 @@
|
||||||
<link>
|
<link>
|
||||||
<name>src/libwolfboot.c</name>
|
<name>src/libwolfboot.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/libwolfboot.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/libwolfboot.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/renesas-rx.c</name>
|
<name>src/renesas-rx.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/hal/renesas-rx.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/hal/renesas-rx.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
</linkedResources>
|
</linkedResources>
|
||||||
</projectDescription>
|
</projectDescription>
|
|
@ -2,7 +2,7 @@
|
||||||
*
|
*
|
||||||
* Test bare-metal application.
|
* Test bare-metal application.
|
||||||
*
|
*
|
||||||
* Copyright (C) 2021 wolfSSL Inc.
|
* Copyright (C) 2023 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
* This file is part of wolfBoot.
|
* This file is part of wolfBoot.
|
||||||
*
|
*
|
||||||
|
@ -64,40 +64,46 @@ static void printPartitions(void)
|
||||||
printf("\n=== Boot Partition[%08x] ===\n", WOLFBOOT_PARTITION_BOOT_ADDRESS);
|
printf("\n=== Boot Partition[%08x] ===\n", WOLFBOOT_PARTITION_BOOT_ADDRESS);
|
||||||
printPart((uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS);
|
printPart((uint8_t*)WOLFBOOT_PARTITION_BOOT_ADDRESS);
|
||||||
printf("\n=== Update Partition[%08x] ===\n", WOLFBOOT_PARTITION_UPDATE_ADDRESS);
|
printf("\n=== Update Partition[%08x] ===\n", WOLFBOOT_PARTITION_UPDATE_ADDRESS);
|
||||||
//printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
|
printPart((uint8_t*)WOLFBOOT_PARTITION_UPDATE_ADDRESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void main(void)
|
void main(void)
|
||||||
{
|
{
|
||||||
uint8_t firmware_version = 0;
|
uint8_t firmware_version = 0;
|
||||||
|
|
||||||
hal_init();
|
|
||||||
|
|
||||||
printf("| ------------------------------------------------------------------- |\n");
|
printf("| ------------------------------------------------------------------- |\n");
|
||||||
printf("| Renesas RX User Application in BOOT partition started by wolfBoot |\n");
|
printf("| Renesas RX User Application in BOOT partition started by wolfBoot |\n");
|
||||||
printf("| ------------------------------------------------------------------- |\n\n");
|
printf("| ------------------------------------------------------------------- |\n\n");
|
||||||
|
|
||||||
|
|
||||||
|
hal_init();
|
||||||
|
|
||||||
printPartitions();
|
printPartitions();
|
||||||
|
|
||||||
/* The same as: wolfBoot_get_image_version(PART_BOOT); */
|
/* The same as: wolfBoot_get_image_version(PART_BOOT); */
|
||||||
firmware_version = wolfBoot_current_firmware_version();
|
firmware_version = wolfBoot_current_firmware_version();
|
||||||
|
|
||||||
printf("Current Firmware Version: %d\n", firmware_version);
|
printf("\nCurrent Firmware Version: %d\n", firmware_version);
|
||||||
|
|
||||||
if (firmware_version >= 1) {
|
if (firmware_version >= 1) {
|
||||||
wolfBoot_success();
|
if (firmware_version == 1) {
|
||||||
|
printf("Hit any key to call wolfBoot_success the firmware.\n");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
wolfBoot_success();
|
||||||
|
printPartitions();
|
||||||
|
|
||||||
|
printf("\nHit any key to update the firmware.\n");
|
||||||
|
getchar();
|
||||||
|
|
||||||
|
wolfBoot_update_trigger();
|
||||||
|
printf("Firmware Update is triggered\n");
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
printf("Invalid Firmware Version\n");
|
printf("Invalid Firmware Version\n");
|
||||||
goto busy_idle;
|
goto busy_idle;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Hit any key to update the firmware.\n");
|
|
||||||
getchar();
|
|
||||||
|
|
||||||
wolfBoot_update_trigger();
|
|
||||||
printf("Firmware Update is triggered\n");
|
|
||||||
|
|
||||||
/* busy wait */
|
/* busy wait */
|
||||||
busy_idle:
|
busy_idle:
|
||||||
while (1)
|
while (1)
|
|
@ -5,7 +5,7 @@
|
||||||
* target.h is automatically generated using the template in target.h.in by running
|
* target.h is automatically generated using the template in target.h.in by running
|
||||||
* "make config".
|
* "make config".
|
||||||
*
|
*
|
||||||
* Copyright (C) 2021 wolfSSL Inc.
|
* Copyright (C) 2023 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
* This file is part of wolfBoot.
|
* This file is part of wolfBoot.
|
||||||
*
|
*
|
|
@ -4,7 +4,7 @@
|
||||||
* Enabled via WOLFSSL_USER_SETTINGS.
|
* Enabled via WOLFSSL_USER_SETTINGS.
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* Copyright (C) 2021 wolfSSL Inc.
|
* Copyright (C) 2023 wolfSSL Inc.
|
||||||
*
|
*
|
||||||
* This file is part of wolfBoot.
|
* This file is part of wolfBoot.
|
||||||
*
|
*
|
||||||
|
@ -26,21 +26,15 @@
|
||||||
#ifndef H_USER_SETTINGS_
|
#ifndef H_USER_SETTINGS_
|
||||||
#define H_USER_SETTINGS_
|
#define H_USER_SETTINGS_
|
||||||
|
|
||||||
|
|
||||||
//#define WOLFBOOT_RENESAS_TSIP
|
|
||||||
//#define WOLFBOOT_DUALBOOT
|
|
||||||
|
|
||||||
#ifdef WOLFBOOT_RENESAS_TSIP
|
#ifdef WOLFBOOT_RENESAS_TSIP
|
||||||
#define WOLFSSL_RENESAS_TSIP_SIGNATURE // Current version support only RSA2048
|
#define WOLFSSL_RENESAS_TSIP_SIGNATURE // Current version support only RSA2048
|
||||||
#define WOLFSSL_NO_SW_MATH
|
#define WOLFSSL_NO_SW_MATH
|
||||||
#define WOLFBOOT_SIGN_RSA2048
|
#define WOLFBOOT_SIGN_RSA2048
|
||||||
#else
|
#else
|
||||||
/* #define WOLFBOOT_SIGN_RSA2048 */
|
#define WOLFBOOT_SIGN_RSA2048
|
||||||
/* #defube WOLFBOOT_SIGN_RSA3072 */
|
/* #define WOLFBOOT_SIGN_RSA3072 */
|
||||||
/* #defube WOLFBOOT_SIGN_RSA4096 */
|
|
||||||
/* #define WOLFBOOT_SIGN_ED25519 */
|
/* #define WOLFBOOT_SIGN_ED25519 */
|
||||||
/* #define WOLFBOOT_SIGN_ED488 */
|
/* #define WOLFBOOT_SIGN_ECC256 */
|
||||||
#define WOLFBOOT_SIGN_ECC256
|
|
||||||
/* #define WOLFBOOT_SIGN_ECC384 */
|
/* #define WOLFBOOT_SIGN_ECC384 */
|
||||||
/* #define WOLFBOOT_SIGN_ECC521 */
|
/* #define WOLFBOOT_SIGN_ECC521 */
|
||||||
#endif
|
#endif
|
||||||
|
@ -62,8 +56,7 @@
|
||||||
#define WC_NO_RNG_SIMPLE
|
#define WC_NO_RNG_SIMPLE
|
||||||
|
|
||||||
#define WOLFSSL_USER_SETTINGS /* for renesas-tsip-crypt.h */
|
#define WOLFSSL_USER_SETTINGS /* for renesas-tsip-crypt.h */
|
||||||
#define WOLFSSL_SP_MATH_ALL /* for sp_int.c */
|
|
||||||
//#define USE_FAST_MATH
|
|
||||||
/* System */
|
/* System */
|
||||||
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
#define WOLFSSL_GENERAL_ALIGNMENT 4
|
||||||
#define SINGLE_THREADED
|
#define SINGLE_THREADED
|
||||||
|
@ -75,7 +68,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(WOLFBOOT_SIGN_RSA2048) || defined(WOLFBOOT_SIGN_RSA3072) || defined(WOLFBOOT_SIGN_ED448)
|
#if defined(WOLFBOOT_SIGN_RSA2048) || defined(WOLFBOOT_SIGN_RSA3072) || defined(WOLFBOOT_SIGN_ED448)
|
||||||
#define IMAGE_HEADER_SIZE 512
|
#define IMAGE_HEADER_SIZE 512
|
||||||
#elif defined(WOLFBOOT_SIGN_RSA4096)
|
#elif defined(WOLFBOOT_SIGN_RSA4096)
|
||||||
#define IMAGE_HEADER_SIZE 1024
|
#define IMAGE_HEADER_SIZE 1024
|
||||||
#endif
|
#endif
|
||||||
|
@ -106,13 +99,13 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* ECC and SHA256 */
|
/* ECC and SHA256 */
|
||||||
#if defined (WOLFBOOT_SIGN_ECC256) ||\
|
#if defined(WOLFBOOT_SIGN_ECC256) ||\
|
||||||
defined (WOLFBOOT_SIGN_ECC384) ||\
|
defined(WOLFBOOT_SIGN_ECC384) ||\
|
||||||
defined (WOLFBOOT_SIGN_ECC521)
|
defined(WOLFBOOT_SIGN_ECC521)
|
||||||
|
|
||||||
# define HAVE_ECC
|
# define HAVE_ECC
|
||||||
# define ECC_TIMING_RESISTANT
|
# define ECC_TIMING_RESISTANT
|
||||||
|
# define ECC_USER_CURVES /* enables only 256-bit by default */
|
||||||
|
|
||||||
|
|
||||||
/* Kinetis LTC support */
|
/* Kinetis LTC support */
|
||||||
# ifdef FREESCALE_USE_LTC
|
# ifdef FREESCALE_USE_LTC
|
||||||
|
@ -124,15 +117,12 @@
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
/* SP MATH */
|
/* SP MATH */
|
||||||
#ifndef WOLFSSL_NO_SW_MATH
|
# if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL)
|
||||||
# ifndef USE_FAST_MATH
|
|
||||||
# define WOLFSSL_SP
|
# define WOLFSSL_SP
|
||||||
# define WOLFSSL_SP_MATH
|
# define WOLFSSL_SP_MATH
|
||||||
# define WOLFSSL_SP_SMALL
|
# define WOLFSSL_SP_SMALL
|
||||||
# define SP_WORD_SIZE 32
|
|
||||||
# define WOLFSSL_HAVE_SP_ECC
|
# define WOLFSSL_HAVE_SP_ECC
|
||||||
# endif
|
# endif
|
||||||
#endif
|
|
||||||
|
|
||||||
/* ECC options disabled to reduce size */
|
/* ECC options disabled to reduce size */
|
||||||
# define NO_ECC_SIGN
|
# define NO_ECC_SIGN
|
||||||
|
@ -141,25 +131,25 @@
|
||||||
# define NO_ECC_KEY_EXPORT
|
# define NO_ECC_KEY_EXPORT
|
||||||
|
|
||||||
/* Curve */
|
/* Curve */
|
||||||
# define NO_ECC192
|
|
||||||
# define NO_ECC224
|
|
||||||
#ifdef WOLFBOOT_SIGN_ECC256
|
#ifdef WOLFBOOT_SIGN_ECC256
|
||||||
# define HAVE_ECC256
|
# define HAVE_ECC256
|
||||||
# define FP_MAX_BITS (256 + 32)
|
# define FP_MAX_BITS (256 + 32)
|
||||||
# define NO_ECC384
|
#elif defined(WOLFBOOT_SIGN_ECC384)
|
||||||
# define NO_ECC521
|
|
||||||
#elif defined WOLFBOOT_SIGN_ECC384
|
|
||||||
# define HAVE_ECC384
|
# define HAVE_ECC384
|
||||||
# define FP_MAX_BITS (1024 + 32)
|
# define FP_MAX_BITS (384 * 2)
|
||||||
# define WOLFSSL_SP_384
|
# if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL)
|
||||||
# define WOLFSSL_SP_NO_256
|
# define WOLFSSL_SP_384
|
||||||
|
# define WOLFSSL_SP_NO_256
|
||||||
|
# endif
|
||||||
# define NO_ECC256
|
# define NO_ECC256
|
||||||
# define NO_ECC521
|
#elif defined(WOLFBOOT_SIGN_ECC521)
|
||||||
#elif defined WOLFBOOT_SIGN_ECC521
|
|
||||||
# define HAVE_ECC521
|
# define HAVE_ECC521
|
||||||
# define FP_MAX_BITS (544 + 32)
|
# define FP_MAX_BITS (528 * 2)
|
||||||
|
# if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL)
|
||||||
|
# define WOLFSSL_SP_521
|
||||||
|
# define WOLFSSL_SP_NO_256
|
||||||
|
# endif
|
||||||
# define NO_ECC256
|
# define NO_ECC256
|
||||||
# define NO_ECC384
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define NO_RSA
|
# define NO_RSA
|
||||||
|
@ -169,62 +159,35 @@
|
||||||
#ifdef WOLFBOOT_SIGN_RSA2048
|
#ifdef WOLFBOOT_SIGN_RSA2048
|
||||||
# define RSA_LOW_MEM
|
# define RSA_LOW_MEM
|
||||||
# define WOLFSSL_RSA_VERIFY_INLINE
|
# define WOLFSSL_RSA_VERIFY_INLINE
|
||||||
# define WOLFSSL_RSA_VERIFY_ONLY
|
|
||||||
# define WC_NO_RSA_OAEP
|
# define WC_NO_RSA_OAEP
|
||||||
# define FP_MAX_BITS (2048 * 2)
|
# define FP_MAX_BITS (2048 * 2)
|
||||||
/* sp math */
|
/* sp math */
|
||||||
#ifndef WOLFSSL_NO_SW_MATH
|
# if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL)
|
||||||
# ifndef USE_FAST_MATH
|
|
||||||
# define WOLFSSL_HAVE_SP_RSA
|
# define WOLFSSL_HAVE_SP_RSA
|
||||||
# define WOLFSSL_SP
|
# define WOLFSSL_SP
|
||||||
# define WOLFSSL_SP_SMALL
|
# define WOLFSSL_SP_SMALL
|
||||||
# define WOLFSSL_SP_MATH
|
# define WOLFSSL_SP_MATH
|
||||||
# define SP_WORD_SIZE 32
|
|
||||||
# define WOLFSSL_SP_NO_3072
|
# define WOLFSSL_SP_NO_3072
|
||||||
# define WOLFSSL_SP_NO_4096
|
# define WOLFSSL_SP_NO_4096
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# define WC_ASN_HASH_SHA256
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFBOOT_SIGN_RSA3072
|
#ifdef WOLFBOOT_SIGN_RSA3072
|
||||||
# define RSA_LOW_MEM
|
# define RSA_LOW_MEM
|
||||||
# define WOLFSSL_RSA_VERIFY_INLINE
|
# define WOLFSSL_RSA_VERIFY_INLINE
|
||||||
# define WOLFSSL_RSA_VERIFY_ONLY
|
|
||||||
# define WC_NO_RSA_OAEP
|
# define WC_NO_RSA_OAEP
|
||||||
# define FP_MAX_BITS (3072 * 2)
|
# define FP_MAX_BITS (3072 * 2)
|
||||||
/* sp math */
|
/* sp math */
|
||||||
#ifndef WOLFSSL_NO_SW_MATH
|
# if !defined(USE_FAST_MATH) && !defined(WOLFSSL_SP_MATH_ALL)
|
||||||
# ifndef USE_FAST_MATH
|
|
||||||
# define WOLFSSL_HAVE_SP_RSA
|
# define WOLFSSL_HAVE_SP_RSA
|
||||||
# define WOLFSSL_SP
|
# define WOLFSSL_SP
|
||||||
# define WOLFSSL_SP_SMALL
|
# define WOLFSSL_SP_SMALL
|
||||||
# define WOLFSSL_SP_MATH
|
# define WOLFSSL_SP_MATH
|
||||||
# define SP_WORD_SIZE 32
|
|
||||||
# define WOLFSSL_SP_NO_2048
|
# define WOLFSSL_SP_NO_2048
|
||||||
# define WOLFSSL_SP_NO_4096
|
# define WOLFSSL_SP_NO_4096
|
||||||
# endif
|
# endif
|
||||||
#endif
|
# define WC_ASN_HASH_SHA256
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef WOLFBOOT_SIGN_RSA4096
|
|
||||||
# define RSA_LOW_MEM
|
|
||||||
# define WOLFSSL_RSA_VERIFY_INLINE
|
|
||||||
# define WOLFSSL_RSA_VERIFY_ONLY
|
|
||||||
# define WC_NO_RSA_OAEP
|
|
||||||
# define FP_MAX_BITS (4096 * 2)
|
|
||||||
/* sp math */
|
|
||||||
#ifndef WOLFSSL_NO_SW_MATH
|
|
||||||
# ifndef USE_FAST_MATH
|
|
||||||
# define WOLFSSL_HAVE_SP_RSA
|
|
||||||
# define WOLFSSL_SP
|
|
||||||
# define WOLFSSL_SP_SMALL
|
|
||||||
# define WOLFSSL_SP_MATH
|
|
||||||
# define SP_WORD_SIZE 32
|
|
||||||
# define WOLFSSL_SP_4096
|
|
||||||
# define WOLFSSL_SP_NO_2048
|
|
||||||
# define WOLFSSL_SP_NO_3072
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WOLFBOOT_HASH_SHA3_384
|
#ifdef WOLFBOOT_HASH_SHA3_384
|
||||||
|
@ -300,5 +263,4 @@
|
||||||
# define WOLFSSL_SMALL_STACK
|
# define WOLFSSL_SMALL_STACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* !H_USER_SETTINGS_ */
|
#endif /* !H_USER_SETTINGS_ */
|
|
@ -50,10 +50,9 @@
|
||||||
<tool id="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler.114148530" name="Compiler" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler">
|
<tool id="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler.114148530" name="Compiler" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.base.compiler">
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.817445107" 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 id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.fpu.817445107" 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.435935644" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" useByScannerDiscovery="false" valueType="includePath">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include.435935644" name="インクルード・ファイルを検索するフォルダ (-include)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.include" useByScannerDiscovery="false" valueType="includePath">
|
||||||
<listOptionValue builtIn="false" value="../../keys"/>
|
|
||||||
<listOptionValue builtIn="false" value="../../include"/>
|
<listOptionValue builtIn="false" value="../../include"/>
|
||||||
<listOptionValue builtIn="false" value="../../../../../include"/>
|
<listOptionValue builtIn="false" value="../../../../../../include"/>
|
||||||
<listOptionValue builtIn="false" value="../../../../../lib/wolfssl"/>
|
<listOptionValue builtIn="false" value="../../../../../../lib/wolfssl"/>
|
||||||
<listOptionValue builtIn="false" value="${TCINSTALL}/include"/>
|
<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/general}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_pincfg}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_pincfg}""/>
|
||||||
|
@ -65,7 +64,6 @@
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_3}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_3}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_4}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_4}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/targets}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/targets}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_tsip_rx}""/>
|
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore.869068341" name="追加するオプション(すべての指定オプションの前に追加)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore" useByScannerDiscovery="false" valueType="stringList">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore.869068341" name="追加するオプション(すべての指定オプションの前に追加)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.userBefore" useByScannerDiscovery="false" valueType="stringList">
|
||||||
<listOptionValue builtIn="false" value=""/>
|
<listOptionValue builtIn="false" value=""/>
|
||||||
|
@ -78,12 +76,14 @@
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode.1570072024" name="出力する文字コード (-outcode)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode.utf8" valueType="enumerated"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode.1570072024" name="出力する文字コード (-outcode)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.outcode.utf8" valueType="enumerated"/>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.2058710491" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" useByScannerDiscovery="false" valueType="definedSymbols">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define.2058710491" name="プリプロセッサ・マクロの定義 (-define)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.define" useByScannerDiscovery="false" valueType="definedSymbols">
|
||||||
<listOptionValue builtIn="false" value="__WOLFBOOT"/>
|
<listOptionValue builtIn="false" value="__WOLFBOOT"/>
|
||||||
|
<listOptionValue builtIn="false" value="_RENESAS_RX_"/>
|
||||||
|
<listOptionValue builtIn="false" value="WOLFSSL_USER_SETTINGS"/>
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.preInclude.303954707" name="コンパイル単位の先頭にインクルードするファイル (-preinclude)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.preInclude" useByScannerDiscovery="false" valueType="stringList">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.preInclude.303954707" name="コンパイル単位の先頭にインクルードするファイル (-preinclude)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.preInclude" useByScannerDiscovery="false" valueType="stringList">
|
||||||
<listOptionValue builtIn="false" value="../../include/user_settings.h"/>
|
<listOptionValue builtIn="false" value="../../include/user_settings.h"/>
|
||||||
<listOptionValue builtIn="false" value="../../include/target.h"/>
|
<listOptionValue builtIn="false" value="../../include/target.h"/>
|
||||||
</option>
|
</option>
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.402664598" name="最適化レベル (-optimize)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.levelMax" valueType="enumerated"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.402664598" name="最適化レベル (-optimize)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.option.optimize.level2" valueType="enumerated"/>
|
||||||
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType.1343195127" name="Compiler Input C" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType"/>
|
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType.1343195127" name="Compiler Input C" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gcc.inputType"/>
|
||||||
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType.1547456010" name="Compiler Input CPP" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType"/>
|
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType.1547456010" name="Compiler Input CPP" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.compiler.gpp.inputType"/>
|
||||||
</tool>
|
</tool>
|
||||||
|
@ -106,7 +106,6 @@
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_3}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_3}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_4}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/flash_type_4}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/targets}""/>
|
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_flash_rx/src/targets}""/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_tsip_rx}""/>
|
|
||||||
</option>
|
</option>
|
||||||
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.assembler.inputType.718646193" name="Assembler InputType" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.assembler.inputType"/>
|
<inputType id="com.renesas.cdt.managedbuild.renesas.ccrx.assembler.inputType.718646193" name="Assembler InputType" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.assembler.inputType"/>
|
||||||
</tool>
|
</tool>
|
||||||
|
@ -131,9 +130,7 @@
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList.747513762" name="(リンク順序のリスト) (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList" useByScannerDiscovery="false" valueType="stringList">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList.747513762" name="(リンク順序のリスト) (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.noneLinkageOrderList" useByScannerDiscovery="false" valueType="stringList">
|
||||||
<listOptionValue builtIn="false" value="".\wolfBoot.lib""/>
|
<listOptionValue builtIn="false" value="".\wolfBoot.lib""/>
|
||||||
</option>
|
</option>
|
||||||
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="false" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.inputFile.1228050498" name="リンクするリロケータブル・ファイル、ライブラリ・ファイルおよびバイナリ・ファイル (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.inputFile" useByScannerDiscovery="false" valueType="stringList">
|
<option IS_BUILTIN_EMPTY="false" IS_VALUE_EMPTY="true" id="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.inputFile.1228050498" name="リンクするリロケータブル・ファイル、ライブラリ・ファイルおよびバイナリ・ファイル (-input/-library/-binary)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.linker.option.inputFile" useByScannerDiscovery="false" valueType="stringList"/>
|
||||||
<listOptionValue builtIn="false" value=""${workspace_loc:/${ProjName}/src/smc_gen/r_tsip_rx/lib/ccrx/r_tsip_rx72m_rx72n_rx66n_little.lib}""/>
|
|
||||||
</option>
|
|
||||||
</tool>
|
</tool>
|
||||||
<tool id="com.renesas.cdt.managedbuild.renesas.ccrx.base.librarian.824424223" name="Library Generator" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.base.librarian">
|
<tool id="com.renesas.cdt.managedbuild.renesas.ccrx.base.librarian.824424223" name="Library Generator" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.base.librarian">
|
||||||
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu.1603488290" name="浮動小数点演算命令を使用する (-fpu/-nofpu)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu.yes" valueType="enumerated"/>
|
<option id="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu.1603488290" name="浮動小数点演算命令を使用する (-fpu/-nofpu)" superClass="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu" useByScannerDiscovery="false" value="com.renesas.cdt.managedbuild.renesas.ccrx.librarian.option.fpu.yes" valueType="enumerated"/>
|
|
@ -37,37 +37,47 @@
|
||||||
<link>
|
<link>
|
||||||
<name>src/keystore.c</name>
|
<name>src/keystore.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/keystore.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/keystore.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>src/target.h</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-1-PROJECT_LOC/include/target.h</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>src/user_settings.h</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-1-PROJECT_LOC/include/user_settings.h</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/hal/renesas-rx.c</name>
|
<name>src/hal/renesas-rx.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/hal/renesas-rx.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/hal/renesas-rx.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/boot_renesas_rx.c</name>
|
<name>src/wolfboot/boot_renesas.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/boot_renesas_rx.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/boot_renesas.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/delta.c</name>
|
<name>src/wolfboot/delta.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/delta.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/delta.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/image.c</name>
|
<name>src/wolfboot/image.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/image.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/image.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/libwolfboot.c</name>
|
<name>src/wolfboot/libwolfboot.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/libwolfboot.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/libwolfboot.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/loader.c</name>
|
<name>src/wolfboot/loader.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/loader.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/loader.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/spi_flash.c</name>
|
<name>src/wolfboot/spi_flash.c</name>
|
||||||
|
@ -77,7 +87,7 @@
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/string.c</name>
|
<name>src/wolfboot/string.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/string.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/string.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/uart_flash.c</name>
|
<name>src/wolfboot/uart_flash.c</name>
|
||||||
|
@ -87,7 +97,7 @@
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/update_flash.c</name>
|
<name>src/wolfboot/update_flash.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/src/update_flash.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/src/update_flash.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfboot/update_flash_hwswap.c</name>
|
<name>src/wolfboot/update_flash_hwswap.c</name>
|
||||||
|
@ -102,102 +112,102 @@
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/aes.c</name>
|
<name>src/wolfcrypt/aes.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/aes.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/aes.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>src/wolfcrypt/asn.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/asn.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ecc.c</name>
|
<name>src/wolfcrypt/ecc.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ecc.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ecc.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ed25519.c</name>
|
<name>src/wolfcrypt/ed25519.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ed25519.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ed25519.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ed448.c</name>
|
<name>src/wolfcrypt/ed448.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ed448.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ed448.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/fe_448.c</name>
|
<name>src/wolfcrypt/fe_448.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/fe_448.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/fe_448.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/fe_low_mem.c</name>
|
<name>src/wolfcrypt/fe_low_mem.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/fe_low_mem.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/fe_low_mem.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/fe_operations.c</name>
|
<name>src/wolfcrypt/fe_operations.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/fe_operations.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/fe_operations.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ge_448.c</name>
|
<name>src/wolfcrypt/ge_448.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ge_448.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ge_448.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ge_low_mem.c</name>
|
<name>src/wolfcrypt/ge_low_mem.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ge_low_mem.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ge_low_mem.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/ge_operations.c</name>
|
<name>src/wolfcrypt/ge_operations.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/ge_operations.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/ge_operations.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/hash.c</name>
|
<name>src/wolfcrypt/hash.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/hash.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/hash.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/memory.c</name>
|
<name>src/wolfcrypt/memory.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/memory.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/memory.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/misc.c</name>
|
<name>src/wolfcrypt/misc.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/misc.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/misc.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/rsa.c</name>
|
<name>src/wolfcrypt/rsa.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/rsa.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/rsa.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/sha256.c</name>
|
<name>src/wolfcrypt/sha256.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/sha256.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/sha256.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/sha512.c</name>
|
<name>src/wolfcrypt/sha512.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/sha512.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/sha512.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/sp_c32.c</name>
|
<name>src/wolfcrypt/sp_c32.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-5-PROJECT_LOC/wolfssl/wolfcrypt/src/sp_c32.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/sp_c32.c</locationURI>
|
||||||
|
</link>
|
||||||
|
<link>
|
||||||
|
<name>src/wolfcrypt/sp_int.c</name>
|
||||||
|
<type>1</type>
|
||||||
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/sp_int.c</locationURI>
|
||||||
</link>
|
</link>
|
||||||
<link>
|
<link>
|
||||||
<name>src/wolfcrypt/tfm.c</name>
|
<name>src/wolfcrypt/tfm.c</name>
|
||||||
<type>1</type>
|
<type>1</type>
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/tfm.c</locationURI>
|
<locationURI>PARENT-5-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/tfm.c</locationURI>
|
||||||
</link>
|
|
||||||
<link>
|
|
||||||
<name>src/wolfcrypt/Renesas/Renesas</name>
|
|
||||||
<type>2</type>
|
|
||||||
<locationURI>virtual:/virtual</locationURI>
|
|
||||||
</link>
|
|
||||||
<link>
|
|
||||||
<name>src/wolfcrypt/Renesas/Renesas/renesas_tsip_rsa.c</name>
|
|
||||||
<type>1</type>
|
|
||||||
<locationURI>PARENT-4-PROJECT_LOC/lib/wolfssl/wolfcrypt/src/port/Renesas/renesas_tsip_rsa.c</locationURI>
|
|
||||||
</link>
|
</link>
|
||||||
</linkedResources>
|
</linkedResources>
|
||||||
</projectDescription>
|
</projectDescription>
|
|
@ -775,11 +775,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"/>
|
||||||
<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>
|
||||||
<configuration inuse="true" name="r_tsip_rx">
|
|
||||||
<component description="依存モジュール: r_bsp バージョン 7.00 Support functions: AES, GCM, CCM, CMAC, SHA, MD5, Triple-DES, ARC4, RSA, ECC, Random number generate, Key management, secure boot/secure firmware update. The ".l" in version number means library version." detailDescription="TSIP(Trusted Secure IP) driver." display="r_tsip_rx" id="r_tsip_rx1.15.l" version="1.15.l"/>
|
|
||||||
<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>
|
||||||
<tool id="System">
|
<tool id="System">
|
||||||
<section id="ocd">
|
<section id="ocd">
|
|
@ -0,0 +1,120 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#
|
||||||
|
# convert elf to hex file
|
||||||
|
# This simple shell script assumes to be run on WSL or equivarant environment.
|
||||||
|
# This script is an example. You can update the script based on your environment.
|
||||||
|
#
|
||||||
|
# usage
|
||||||
|
# elf2hex.sh <TSIP:0,1> <WOLFBOOT_DIR> <RXELF_BIN_DIR>
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
|
if [ $# -ne 4 ];then
|
||||||
|
echo "Usage: $0 <0 or 1 for TSIP use> WOLFBOOT_DIR RXELF_BIN_DIR <signature method>";
|
||||||
|
echo " sig : 0,1 : rsa-2048 (Default)"
|
||||||
|
echo " 2 : rsa-3072"
|
||||||
|
echo " 3 : ed25519"
|
||||||
|
echo " 4 : ed448"
|
||||||
|
echo " 5 : ecc256"
|
||||||
|
echo " 6 : ecc384"
|
||||||
|
echo " 7 : ecc521"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
VER1_ADDR=0xffc10000
|
||||||
|
VER2_ADDR=0xffdf0000
|
||||||
|
|
||||||
|
# signature method
|
||||||
|
RSA2048_SIGN="rsa2048"
|
||||||
|
RSA3072_SIGN="rsa3072"
|
||||||
|
ED25519_SIGN="ed25519"
|
||||||
|
ED488_SIGN="ed448"
|
||||||
|
ECC256_SIGN="ecc256"
|
||||||
|
ECC384_SIGN="ecc384"
|
||||||
|
ECC512_SIGN="ecc521"
|
||||||
|
|
||||||
|
SIGN_METHOD=${RSA2048_SIGN}
|
||||||
|
|
||||||
|
TSIPUSE=$1
|
||||||
|
WOLFBOOT_DIR="$2"
|
||||||
|
RXELF_BIN_DIR="$3"
|
||||||
|
CURRENT=$(cd $(dirname $0);pwd)
|
||||||
|
APP_RX=${CURRENT}/app_RenesasRx01
|
||||||
|
RXELF_OBJCPY_BIN="${RXELF_BIN_DIR}/rx-elf-objcopy.exe"
|
||||||
|
|
||||||
|
PATH=$PATH:${WOLFBOOT_DIR}/tools/keytools
|
||||||
|
|
||||||
|
if [ $TSIPUSE -eq 1 ]; then
|
||||||
|
VER1_ADDR=0xffc50000
|
||||||
|
VER2_ADDR=0xffe10000
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $4 in
|
||||||
|
0) ;;
|
||||||
|
1) ;;
|
||||||
|
2) SIGN_METHOD=${RSA3072_SIGN} ;;
|
||||||
|
3) SIGN_METHOD=${ED25519_SIGN} ;;
|
||||||
|
4) SIGN_METHOD=${ED488_SIGN} ;;
|
||||||
|
5) SIGN_METHOD=${ECC256_SIGN} ;;
|
||||||
|
6) SIGN_METHOD=${ECC384_SIGN} ;;
|
||||||
|
7) SIGN_METHOD=${ECC512_SIGN} ;;
|
||||||
|
*) echo "invalid signature mehtod $4. Please specifiy [0-8] for sign."
|
||||||
|
exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "Version 1 app start address : " $VER1_ADDR
|
||||||
|
echo "Version 2 app start address : " $VER2_ADDR
|
||||||
|
echo "Signature method : " $SIGN_METHOD
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo COPY app_RenesasRx01.x to RXELF_BIN_DIR to convert bin file
|
||||||
|
cp ${APP_RX}/HardwareDebug/app_RenesasRx01.x "${RXELF_BIN_DIR}"
|
||||||
|
|
||||||
|
pushd "${RXELF_BIN_DIR}"
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Run rx-elf-objcopy.exe to generate bin
|
||||||
|
"${RXELF_OBJCPY_BIN}" -O binary -R '$ADDR_C_FE7F5D00' -R '$ADDR_C_FE7F5D10' -R '$ADDR_C_FE7F5D20' -R '$ADDR_C_FE7F5D30' -R '$ADDR_C_FE7F5D40' -R '$ADDR_C_FE7F5D48' -R '$ADDR_C_FE7F5D50' -R '$ADDR_C_FE7F5D64' -R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT app_RenesasRx01.x app_RenesasRx01.bin
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo copy app_RenesasRx01.bin to wolfBoot folder to sign
|
||||||
|
cp app_RenesasRx01.bin ${WOLFBOOT_DIR}
|
||||||
|
|
||||||
|
pushd ${WOLFBOOT_DIR}
|
||||||
|
|
||||||
|
echo "generate key"
|
||||||
|
keygen --${SIGN_METHOD} -g ./pri-${SIGN_METHOD}.der
|
||||||
|
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo sign app_RenesasRx01.bin for version 1
|
||||||
|
sign --${SIGN_METHOD} app_RenesasRx01.bin ./pri-${SIGN_METHOD}.der 1.0
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo sign app_RenesasRx01.bin for version 2
|
||||||
|
sign --${SIGN_METHOD} app_RenesasRx01.bin ./pri-${SIGN_METHOD}.der 2.0
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo copy app_RenesasRx01_v1.0/v2.0_signed.bin RXELF_BIN_DIR
|
||||||
|
cp app_RenesasRx01_v1.0_signed.bin "${RXELF_BIN_DIR}"
|
||||||
|
cp app_RenesasRx01_v2.0_signed.bin "${RXELF_BIN_DIR}"
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Run rx-elf-objcopy.exe to generate hex for version 1
|
||||||
|
"${RXELF_OBJCPY_BIN}" -I binary -O srec --change-addresses=${VER1_ADDR} app_RenesasRx01_v1.0_signed.bin app_RenesasRx01_v1.0_signed.hex
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Run rx-elf-objcopy.exe to generate hex for version 2
|
||||||
|
"${RXELF_OBJCPY_BIN}" -I binary -O srec --change-addresses=${VER2_ADDR} app_RenesasRx01_v2.0_signed.bin app_RenesasRx01_v2.0_signed.hex
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo move *.hex to ${CURRENT}
|
||||||
|
mv app_RenesasRx01_v1.0_signed.hex app_RenesasRx01_v2.0_signed.hex ${CURRENT}
|
||||||
|
|
||||||
|
echo
|
||||||
|
echo Clean up all copied and generated files
|
||||||
|
rm -rf app_RenesasRx01.x app_RenesasRx01.bin app_RenesasRx01_v1.0_signed.bin app_RenesasRx01_v2.0_signed.bin
|
||||||
|
popd
|
|
@ -1,32 +0,0 @@
|
||||||
if [ "$2" = "dual" ]; then
|
|
||||||
org_primary=0xffc10000
|
|
||||||
org_update=0xffe10000
|
|
||||||
echo === Dual Bank mode ===
|
|
||||||
else
|
|
||||||
if [ "$2" = "tsip" ]; then
|
|
||||||
org_primary=0xffc50000
|
|
||||||
org_update=0xffe10000
|
|
||||||
echo === Linear mode with TSIP ===
|
|
||||||
else
|
|
||||||
org_primary=0xffc20000
|
|
||||||
org_update=0xffe00000
|
|
||||||
echo === Linear mode ===
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Primary:" $org_primary
|
|
||||||
echo "Update: " $org_update
|
|
||||||
|
|
||||||
cd wolfBoot/HardwareDebug
|
|
||||||
rx-elf-objcopy.exe -O binary -R '$ADDR_C_FE7F5D00' -R '$ADDR_C_FE7F5D10' -R '$ADDR_C_FE7F5D20' -R '$ADDR_C_FE7F5D30' -R '$ADDR_C_FE7F5D40' -R '$ADDR_C_FE7F5D48' -R '$ADDR_C_FE7F5D50' -R '$ADDR_C_FE7F5D64' -R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT wolfBoot.x wolfBoot.bin
|
|
||||||
rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffc00000 wolfBoot.bin ../../download/wolfBoot_0.hex
|
|
||||||
rx-elf-objcopy.exe -I binary -O srec --change-addresses=0xffe00000 wolfBoot.bin ../../download/wolfBoot_1.hex
|
|
||||||
|
|
||||||
cd ../..
|
|
||||||
cd $1/HardwareDebug
|
|
||||||
rx-elf-objcopy.exe -O binary -R '$ADDR_C_FE7F5D00' -R '$ADDR_C_FE7F5D10' -R '$ADDR_C_FE7F5D20' -R '$ADDR_C_FE7F5D30' -R '$ADDR_C_FE7F5D40' -R '$ADDR_C_FE7F5D48' -R '$ADDR_C_FE7F5D50' -R '$ADDR_C_FE7F5D64' -R '$ADDR_C_FE7F5D70' -R EXCEPTVECT -R RESETVECT $1.x $1.bin
|
|
||||||
sign --rsa2048 $1.bin ../../../../../pri-rsa2048.der 1.0
|
|
||||||
rx-elf-objcopy.exe -I binary -O srec --change-addresses=$org_primary $1_v1.0_signed.bin ../../download/$1_v1.0_signed.hex
|
|
||||||
sign --rsa2048 $1.bin ../../../../../pri-rsa2048.der 2.0
|
|
||||||
rx-elf-objcopy.exe -I binary -O srec --change-addresses=$org_update $1_v2.0_signed.bin ../../download/$1_v2.0_signed.hex
|
|
||||||
cd ../..
|
|
|
@ -1,26 +0,0 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include "include/user_settings.h"
|
|
||||||
#include "include/target.h"
|
|
||||||
|
|
||||||
int main(int ac, char *av)
|
|
||||||
{
|
|
||||||
printf("WOLFBOOT_FLASH_ADDR: 0x%08x\n", WOLFBOOT_FLASH_ADDR);
|
|
||||||
printf("WOLFBOOT_FLASH_SIZE: 0x%08x\n", WOLFBOOT_FLASH_SIZE);
|
|
||||||
printf("WOLFBOOT_BOOT_SIZE: 0x%08x\n", WOLFBOOT_BOOT_SIZE);
|
|
||||||
printf("WOLFBOOT_RX_EXCVECT: 0x%08x\n", WOLFBOOT_RX_EXCVECT);
|
|
||||||
printf("WOLFBOOT_SECTOR_SIZE: 0x%08x\n", WOLFBOOT_SECTOR_SIZE);
|
|
||||||
printf("\n");
|
|
||||||
printf("WOLFBOOT_PARTITION_SIZE: 0x%08x\n",
|
|
||||||
WOLFBOOT_PARTITION_SIZE);
|
|
||||||
printf("WOLFBOOT_PARTITION_BOOT_ADDRESS: 0x%08x\n",
|
|
||||||
WOLFBOOT_PARTITION_BOOT_ADDRESS);
|
|
||||||
printf("WOLFBOOT_PARTITION_UPDATE_ADDRESS: 0x%08x\n",
|
|
||||||
WOLFBOOT_PARTITION_UPDATE_ADDRESS);
|
|
||||||
printf("WOLFBOOT_PARTITION_SWAP_ADDRESS: 0x%08x\n",
|
|
||||||
WOLFBOOT_PARTITION_SWAP_ADDRESS);
|
|
||||||
printf("\n");
|
|
||||||
printf("Application Entry Address: 0x%08x\n",
|
|
||||||
WOLFBOOT_PARTITION_BOOT_ADDRESS+IMAGE_HEADER_SIZE);
|
|
||||||
return 0;
|
|
||||||
}
|
|
|
@ -513,8 +513,12 @@ struct wolfBoot_image {
|
||||||
};
|
};
|
||||||
|
|
||||||
/* do not warn if this is not used */
|
/* do not warn if this is not used */
|
||||||
|
#if !defined(__CCRX__)
|
||||||
static void __attribute__ ((unused)) wolfBoot_image_confirm_signature_ok(
|
static void __attribute__ ((unused)) wolfBoot_image_confirm_signature_ok(
|
||||||
struct wolfBoot_image *img)
|
struct wolfBoot_image *img)
|
||||||
|
#else
|
||||||
|
static void wolfBoot_image_confirm_signature_ok(struct wolfBoot_image *img)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
img->signature_ok = 1;
|
img->signature_ok = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -278,5 +278,4 @@ extern int tolower(int c);
|
||||||
# define WOLFSSL_SMALL_STACK
|
# define WOLFSSL_SMALL_STACK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif /* !H_USER_SETTINGS_ */
|
#endif /* !H_USER_SETTINGS_ */
|
||||||
|
|
|
@ -35,14 +35,22 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma inline_asm longJump
|
||||||
|
static void longJump(const uint32_t *app_offset)
|
||||||
|
{
|
||||||
|
jmp r1;
|
||||||
|
}
|
||||||
|
|
||||||
void do_boot(const uint32_t *app_offset)
|
void do_boot(const uint32_t *app_offset)
|
||||||
{
|
{
|
||||||
void (*app_entry)(void);
|
void (*app_entry)(void);
|
||||||
uint32_t app_sp;
|
uint32_t app_sp;
|
||||||
(void) app_offset;
|
(void) app_offset;
|
||||||
|
(void) app_sp;
|
||||||
|
(void) app_entry;
|
||||||
|
#if defined(__CCRX__)
|
||||||
|
longJump(app_offset);
|
||||||
|
#elif defined(_RENESAS_RA_)
|
||||||
app_sp = VECTOR_SP;
|
app_sp = VECTOR_SP;
|
||||||
|
|
||||||
__asm__ ("ldr r3, [%0]" ::"r"(app_sp));
|
__asm__ ("ldr r3, [%0]" ::"r"(app_sp));
|
||||||
|
@ -56,5 +64,6 @@ void do_boot(const uint32_t *app_offset)
|
||||||
*/
|
*/
|
||||||
app_entry = (void(*)(void))(*VECTOR_Reset_Handler);
|
app_entry = (void(*)(void))(*VECTOR_Reset_Handler);
|
||||||
(*app_entry)();
|
(*app_entry)();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
14
src/image.c
14
src/image.c
|
@ -48,11 +48,6 @@ static int wolfBoot_unseal_pubkey(uint8_t* pubkey, WOLFTPM2_KEY* tpmKey);
|
||||||
|
|
||||||
#endif /* WOLFBOOT_TPM */
|
#endif /* WOLFBOOT_TPM */
|
||||||
|
|
||||||
#ifdef WOLFBOOT_RENESAS_TSIP
|
|
||||||
#include "r_tsip_rx_if.h"
|
|
||||||
#include "key_data.h"
|
|
||||||
#include "wolfssl/wolfcrypt/port/Renesas/renesas-tsip-crypt.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static int keyslot_id_by_sha(const uint8_t *hint);
|
static int keyslot_id_by_sha(const uint8_t *hint);
|
||||||
|
|
||||||
|
@ -295,11 +290,9 @@ static int RsaUnPad(const byte *pkcsBlock, int pkcsBlockLen, byte **output)
|
||||||
static void wolfBoot_verify_signature(uint8_t key_slot,
|
static void wolfBoot_verify_signature(uint8_t key_slot,
|
||||||
struct wolfBoot_image *img, uint8_t *sig)
|
struct wolfBoot_image *img, uint8_t *sig)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret;
|
||||||
uint8_t output[IMAGE_SIGNATURE_SIZE];
|
uint8_t output[IMAGE_SIGNATURE_SIZE];
|
||||||
#ifdef WOLFBOOT_TPM
|
|
||||||
int output_sz = sizeof(output);
|
int output_sz = sizeof(output);
|
||||||
#endif
|
|
||||||
uint8_t* digest_out = NULL;
|
uint8_t* digest_out = NULL;
|
||||||
uint8_t *pubkey = keystore_get_buffer(key_slot);
|
uint8_t *pubkey = keystore_get_buffer(key_slot);
|
||||||
int pubkey_sz = keystore_get_size(key_slot);
|
int pubkey_sz = keystore_get_size(key_slot);
|
||||||
|
@ -358,6 +351,7 @@ static void wolfBoot_verify_signature(uint8_t key_slot,
|
||||||
{
|
{
|
||||||
struct RsaKey rsa;
|
struct RsaKey rsa;
|
||||||
word32 in_out = 0;
|
word32 in_out = 0;
|
||||||
|
int res = 0;
|
||||||
|
|
||||||
#if !defined(WOLFBOOT_RENESAS_SCEPROTECT)
|
#if !defined(WOLFBOOT_RENESAS_SCEPROTECT)
|
||||||
|
|
||||||
|
@ -374,7 +368,6 @@ static void wolfBoot_verify_signature(uint8_t key_slot,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WOLFBOOT_RENESAS_TSIP
|
|
||||||
XMEMCPY(output, sig, IMAGE_SIGNATURE_SIZE);
|
XMEMCPY(output, sig, IMAGE_SIGNATURE_SIZE);
|
||||||
RSA_VERIFY_FN(ret, wc_RsaSSL_VerifyInline, output, IMAGE_SIGNATURE_SIZE,
|
RSA_VERIFY_FN(ret, wc_RsaSSL_VerifyInline, output, IMAGE_SIGNATURE_SIZE,
|
||||||
&digest_out, &rsa);
|
&digest_out, &rsa);
|
||||||
|
@ -394,7 +387,6 @@ static void wolfBoot_verify_signature(uint8_t key_slot,
|
||||||
}
|
}
|
||||||
#endif /* WOLFBOOT_TPM */
|
#endif /* WOLFBOOT_TPM */
|
||||||
|
|
||||||
#ifndef WOLFBOOT_RENESAS_TSIP
|
|
||||||
#ifndef NO_RSA_SIG_ENCODING
|
#ifndef NO_RSA_SIG_ENCODING
|
||||||
if (ret > WOLFBOOT_SHA_DIGEST_SIZE) {
|
if (ret > WOLFBOOT_SHA_DIGEST_SIZE) {
|
||||||
/* larger result indicates it might have an ASN.1 encoded header */
|
/* larger result indicates it might have an ASN.1 encoded header */
|
||||||
|
@ -403,7 +395,7 @@ static void wolfBoot_verify_signature(uint8_t key_slot,
|
||||||
#endif
|
#endif
|
||||||
if (ret == WOLFBOOT_SHA_DIGEST_SIZE && img && digest_out)
|
if (ret == WOLFBOOT_SHA_DIGEST_SIZE && img && digest_out)
|
||||||
RSA_VERIFY_HASH(img, digest_out);
|
RSA_VERIFY_HASH(img, digest_out);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#endif /* WOLFBOOT_SIGN_RSA2048 || WOLFBOOT_SIGN_3072
|
#endif /* WOLFBOOT_SIGN_RSA2048 || WOLFBOOT_SIGN_3072
|
||||||
|| WOLFBOOT_SIGN_RSA4096 */
|
|| WOLFBOOT_SIGN_RSA4096 */
|
||||||
|
|
|
@ -147,6 +147,7 @@ int strncasecmp(const char *s1, const char *s2, size_t n)
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !defined(__CCRX__) /* Renesas CCRX */
|
||||||
char *strncat(char *dest, const char *src, size_t n)
|
char *strncat(char *dest, const char *src, size_t n)
|
||||||
{
|
{
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
|
@ -221,9 +222,10 @@ int memcmp(const void *_s1, const void *_s2, size_t n)
|
||||||
|
|
||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
#endif /* __CCRX__ Renesas CCRX */
|
||||||
#endif /* !BUILD_LOADER_STAGE1 || (PRINTF_ENABLED && DEBUG_UART) */
|
#endif /* !BUILD_LOADER_STAGE1 || (PRINTF_ENABLED && DEBUG_UART) */
|
||||||
|
|
||||||
|
#if !defined(__CCRX__) /* Renesas CCRX */
|
||||||
#if !defined(BUILD_LOADER_STAGE1) || defined(DEBUG_UART)
|
#if !defined(BUILD_LOADER_STAGE1) || defined(DEBUG_UART)
|
||||||
size_t strlen(const char *s)
|
size_t strlen(const char *s)
|
||||||
{
|
{
|
||||||
|
@ -269,7 +271,7 @@ void *memmove(void *dst, const void *src, size_t n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
#endif /* __CCRX__ Renesas CCRX */
|
||||||
|
|
||||||
#if defined(PRINTF_ENABLED) && defined(DEBUG_UART)
|
#if defined(PRINTF_ENABLED) && defined(DEBUG_UART)
|
||||||
void uart_writenum(int num, int base)
|
void uart_writenum(int num, int base)
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
|
|
||||||
WOLFDIR=../../lib/wolfssl/
|
|
||||||
WOLFBOOTDIR = ../..
|
|
||||||
|
|
||||||
CFLAGS= -DWOLFSSL_USER_SETTINGS -I$(WOLFDIR) -I.
|
|
||||||
|
|
||||||
# Source files
|
|
||||||
SRC=$(WOLFDIR)wolfcrypt/src/asn.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/rsa.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/ecc.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/aes.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/sp_c32.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/sp_int.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/sha256.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/sha.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/hash.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/hmac.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/memory.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/random.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/wolfmath.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/logging.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/coding.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/pwdbased.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/wc_port.c \
|
|
||||||
$(WOLFDIR)wolfcrypt/src/wc_encrypt.c \
|
|
||||||
|
|
||||||
all: der2raw
|
|
||||||
|
|
||||||
der2raw: $(SRC) der2raw.c
|
|
||||||
$(CC) -o der2raw der2raw.c $(SRC) $(CFLAGS)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm *.o der2raw
|
|
||||||
|
|
|
@ -1,444 +0,0 @@
|
||||||
/* args.h
|
|
||||||
*
|
|
||||||
* Copyright (C) 2006-2022 wolfSSL Inc.
|
|
||||||
*
|
|
||||||
* This file is part of wolfSSL. (formerly known as CyaSSL)
|
|
||||||
*
|
|
||||||
* wolfSSL is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; either version 2 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* wolfSSL is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef ARGS_H
|
|
||||||
#define ARGS_H
|
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <stdlib.h>
|
|
||||||
#include <string.h>
|
|
||||||
|
|
||||||
#define FALSE 0
|
|
||||||
#define TRUE 1
|
|
||||||
|
|
||||||
#define ARGS_STDIN 1
|
|
||||||
#define ARGS_STDOUT 1
|
|
||||||
|
|
||||||
#ifndef NO_ERROR_MESSAGE
|
|
||||||
#define FPRINTF(...) fprintf(__VA_ARGS__)
|
|
||||||
#else
|
|
||||||
#define FPRINTF(...)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
typedef struct {
|
|
||||||
int error;
|
|
||||||
long long used;
|
|
||||||
int argc;
|
|
||||||
char **argv;
|
|
||||||
} Args_ctx;
|
|
||||||
|
|
||||||
static Args_ctx args_ctx;
|
|
||||||
|
|
||||||
#define ARGS_INIT(c, v) \
|
|
||||||
int (c) = args_ctx.argc; \
|
|
||||||
char **(v) = args_ctx.argv;
|
|
||||||
|
|
||||||
#define SET_USED(c) args_ctx.used |= (0x1 << (c))
|
|
||||||
#define GET_USED(c) (0x1 << (c)) & args_ctx.used
|
|
||||||
|
|
||||||
#define SET_ERROR args_ctx.error = TRUE
|
|
||||||
|
|
||||||
static int Args_error()
|
|
||||||
{
|
|
||||||
return args_ctx.error;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Args_open(int ac, char **av)
|
|
||||||
{
|
|
||||||
args_ctx.argc = ac;
|
|
||||||
args_ctx.argv = av;
|
|
||||||
args_ctx.used = 0;
|
|
||||||
args_ctx.error = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FILE *Args_infile(const char *mode, int defaultIn)
|
|
||||||
{
|
|
||||||
FILE *in;
|
|
||||||
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
|
|
||||||
for(argv++; argc > 1; argv++, argc--) {
|
|
||||||
if(GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if((*argv)[0] != '-') {
|
|
||||||
SET_USED(argc);
|
|
||||||
if((in = fopen(*argv, mode)) != NULL)
|
|
||||||
return in;
|
|
||||||
else if(defaultIn == ARGS_STDIN) {
|
|
||||||
return stdin;
|
|
||||||
} else {
|
|
||||||
FPRINTF(stderr, "Input file open error (%s)\n", *argv);
|
|
||||||
SET_ERROR;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
FPRINTF(stderr, "No input file\n");
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static FILE *Args_outfile(const char *mode, int defaultOut)
|
|
||||||
{
|
|
||||||
FILE *out;
|
|
||||||
int infile = 0;
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if (GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if ((*argv)[0] != '-') {
|
|
||||||
SET_USED(argc);
|
|
||||||
if ((out = fopen(*(argv), mode)) != NULL)
|
|
||||||
return out;
|
|
||||||
else if (defaultOut == ARGS_STDOUT) {
|
|
||||||
return stdout;
|
|
||||||
} else {
|
|
||||||
FPRINTF(stderr, "Input file open error (%s)\n", *argv);
|
|
||||||
SET_ERROR;
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return stdout;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Args_option(char *opt)
|
|
||||||
{
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if ((*argv)[0] == '-' && strcmp(&(*argv)[1], opt) == 0) {
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int args_hexDigit2int(char h)
|
|
||||||
{
|
|
||||||
int v;
|
|
||||||
|
|
||||||
if(h >= '0' && h <= '9')
|
|
||||||
return h - '0';
|
|
||||||
if (h >= 'a' && h <= 'f')
|
|
||||||
return h - 'a' + 10;
|
|
||||||
if(h >= 'A' && h <= 'F')
|
|
||||||
return h - 'A' + 10;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static unsigned char args_twoHexDigits2bin(char *hex) {
|
|
||||||
int v1, v2;
|
|
||||||
v1 = args_hexDigit2int(hex[0]);
|
|
||||||
v2 = args_hexDigit2int(hex[1]);
|
|
||||||
if(v1 < 0 || v2 < 0)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
return v1 << 4 | v2;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void args_hex2bin(unsigned char *v, char *hex, int sz)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
char twoHex[3];
|
|
||||||
twoHex[2] = '\0';
|
|
||||||
|
|
||||||
if (v == NULL || hex == NULL){
|
|
||||||
SET_ERROR;
|
|
||||||
FPRINTF(stderr, "Invalid argument\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(strlen(hex) == 0) {
|
|
||||||
*v = 0;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
twoHex[0] = strlen(hex) % 2 ? '0' : *hex++;
|
|
||||||
twoHex[1] = *hex++;
|
|
||||||
|
|
||||||
for(i = 0; i < sz; i++) {
|
|
||||||
if((v[sz] = args_twoHexDigits2bin(twoHex)) < 0) {
|
|
||||||
SET_ERROR;
|
|
||||||
FPRINTF(stderr, "Invalid hex value\n");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if(*hex == '\0')
|
|
||||||
return;
|
|
||||||
twoHex[0] = *hex++;
|
|
||||||
twoHex[1] = *hex++;
|
|
||||||
}
|
|
||||||
SET_ERROR;
|
|
||||||
FPRINTF(stderr, "Too many digits\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Args_optHex(char *opt, unsigned char *v, int sz)
|
|
||||||
{
|
|
||||||
unsigned int *hex;
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if (GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if ((*argv)[0] == '-' && strcmp(&(*argv)[1], opt) == 0) {
|
|
||||||
SET_USED(argc);
|
|
||||||
SET_USED(argc-1);
|
|
||||||
args_hex2bin(v, *++argv, sz);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int args_dec2bin(char *dec)
|
|
||||||
{
|
|
||||||
int v = 0;
|
|
||||||
|
|
||||||
for (; *dec; dec++) {
|
|
||||||
if (*dec < '0' || *dec > '9'){
|
|
||||||
SET_ERROR;
|
|
||||||
FPRINTF(stderr, "Invalid decimal value\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
v = v * 10 + (*dec - '0');
|
|
||||||
if((unsigned int)v != (int)v) {
|
|
||||||
SET_ERROR;
|
|
||||||
FPRINTF(stderr, "Decimal value overflow\n");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int Args_optDec(char *opt, int *v)
|
|
||||||
{
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if (GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if ((*argv)[0] == '-' && strcmp(&(*argv)[1], opt) == 0) {
|
|
||||||
SET_USED(argc);
|
|
||||||
SET_USED(argc-1);
|
|
||||||
*v = args_dec2bin(*++argv);
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *Args_optStr(char *opt)
|
|
||||||
{
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if (GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if ((*argv)[0] == '-' && strcmp(&(*argv)[1], opt) == 0) {
|
|
||||||
SET_USED(argc);
|
|
||||||
SET_USED(argc - 1);
|
|
||||||
return *++argv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *Args_nthArg(int n)
|
|
||||||
{
|
|
||||||
ARGS_INIT(argc, argv);
|
|
||||||
for (argv++; argc > 1; argv++, argc--) {
|
|
||||||
if (GET_USED(argc))
|
|
||||||
continue;
|
|
||||||
if ((*argv)[0] != '-') {
|
|
||||||
SET_USED(argc);
|
|
||||||
SET_USED(argc - 1);
|
|
||||||
return *argv;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void Args_close(FILE * in, FILE * out)
|
|
||||||
{
|
|
||||||
if (in != NULL && in != stdin)
|
|
||||||
fclose(in);
|
|
||||||
if (out != NULL && out != stdout)
|
|
||||||
fclose(out);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
This command argment process assume following argment format.
|
|
||||||
|
|
||||||
$ commend [-option,...] [infile [outfile]]
|
|
||||||
|
|
||||||
Option Type:
|
|
||||||
Simple option: -? or -*. '-' followed by a single or multiple charactors.
|
|
||||||
String option: A simple option followed by a charactor string.
|
|
||||||
Hex option: A simple option followed by a hexa dicimal value
|
|
||||||
Decimal option:A simple option followed by a decimal value
|
|
||||||
|
|
||||||
|
|
||||||
--- Macro Option ---
|
|
||||||
NO_ERROR_MESSAGE: Eliminate error message
|
|
||||||
|
|
||||||
|
|
||||||
--- API Reference ---
|
|
||||||
static void Args_open(int ac, char **av)
|
|
||||||
Description:
|
|
||||||
Prepare for command argment process
|
|
||||||
Argument:
|
|
||||||
int ac: Argument count passed in main(ac, av)
|
|
||||||
int av: Argument value passed in main(ac, av)
|
|
||||||
|
|
||||||
static int Args_error()
|
|
||||||
Description:
|
|
||||||
Check if there has been errors in the previous APIs
|
|
||||||
The error flag is kept until Args_close.
|
|
||||||
Note that API return value if for indicate either the option is found or not.
|
|
||||||
You can get errors by this API. Get option APIs output error message as it is deteced
|
|
||||||
unless NO_ERROR_MESSAGE is enabled.
|
|
||||||
Return:
|
|
||||||
TRUE: There has been errors
|
|
||||||
FALSE: No error
|
|
||||||
|
|
||||||
|
|
||||||
static void Args_close(FILE *in, FILE *out)
|
|
||||||
Description:
|
|
||||||
Wrap up and close the process.
|
|
||||||
|
|
||||||
|
|
||||||
static int Args_option(char *opt)
|
|
||||||
Description:
|
|
||||||
Check if there is a specified Simple option
|
|
||||||
Argument:
|
|
||||||
char *opt: Option string to check.
|
|
||||||
Return:
|
|
||||||
TRUE: The option found
|
|
||||||
FALES: The option not found
|
|
||||||
|
|
||||||
|
|
||||||
static const char *Args_optStr(char *opt)
|
|
||||||
Description:
|
|
||||||
Check if there is a specified String option
|
|
||||||
Argument:
|
|
||||||
char *opt: Option string to check.
|
|
||||||
Return:
|
|
||||||
Non NULL: Pointer to the string
|
|
||||||
NULL: The option not found
|
|
||||||
|
|
||||||
static int Args_optDec(char *opt, int *v)
|
|
||||||
Description:
|
|
||||||
Check if there is a specified String option
|
|
||||||
Argument:
|
|
||||||
char *opt: Option string to check.
|
|
||||||
int *v: Pointer to binary converted value
|
|
||||||
Return:
|
|
||||||
TRUE: Option found
|
|
||||||
FALES: Not found
|
|
||||||
|
|
||||||
|
|
||||||
static uint8_t *Args_optHex(char *opt, uint8_t *bin, int sz)
|
|
||||||
Description:
|
|
||||||
Check if there is a specified String option
|
|
||||||
Argument:
|
|
||||||
char *opt: Option string to check.
|
|
||||||
uint8_t bin: Binary converted hex value
|
|
||||||
Return:
|
|
||||||
Non NULL: Pointer to the hex value string
|
|
||||||
NULL: No specified option
|
|
||||||
|
|
||||||
|
|
||||||
static FILE *Args_infile(const char *mode, int defaultIn)
|
|
||||||
Description:
|
|
||||||
Open the file if there is a input file argument.
|
|
||||||
Argument:
|
|
||||||
char *mode: open mode for fopen
|
|
||||||
int defaultIn:
|
|
||||||
ARGS_STDIN: Assing stdin if it has no input file argment.
|
|
||||||
Return:
|
|
||||||
non-NULL: File descriptor
|
|
||||||
NULL: No infine specified
|
|
||||||
|
|
||||||
|
|
||||||
static FILE *Args_outfile(const char *mode, int defaultOut)
|
|
||||||
Description:
|
|
||||||
Open the file if there is a output file argument.
|
|
||||||
Argument:
|
|
||||||
char *mode: open mode for fopen
|
|
||||||
int defaultOut:
|
|
||||||
ARGS_STDOUT: Assing stdin if it has no output file argment.
|
|
||||||
Return:
|
|
||||||
non-NULL: File descriptor
|
|
||||||
NULL: No out file specified
|
|
||||||
|
|
||||||
static const char *Args_nthArg(int n)
|
|
||||||
Description:
|
|
||||||
Get Nth non-optional argument
|
|
||||||
|
|
||||||
Argument:
|
|
||||||
int n: Argument position to get
|
|
||||||
Return:
|
|
||||||
Non NULL: Pointer to the argument string
|
|
||||||
NULL: No argument
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--- Example Code ---
|
|
||||||
|
|
||||||
command [-e][-pub][-s 999] in_file [out_file]
|
|
||||||
|
|
||||||
in_file is mandate. If no out_file is specified, output to stdout
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
int main(int ac, char** av)
|
|
||||||
{
|
|
||||||
FILE *in, *out;
|
|
||||||
int ret;
|
|
||||||
int keySz = 0;
|
|
||||||
int ecc;
|
|
||||||
int pub;
|
|
||||||
|
|
||||||
Args_open(ac, av);
|
|
||||||
ret = Args_optDec("s", &keySz);
|
|
||||||
ecc = Args_option("e");
|
|
||||||
pub = Args_option("pub");
|
|
||||||
in = Args_infile("rb", 0);
|
|
||||||
out = Args_outfile("w+", ARGS_STDOUT);
|
|
||||||
|
|
||||||
if (Args_error()) {
|
|
||||||
Args_close(in, out);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ecc)
|
|
||||||
ret = func1(in, out, keySz, pub);
|
|
||||||
else
|
|
||||||
ret = func2(in, out, keySz, pub);
|
|
||||||
|
|
||||||
Args_close(in, out);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
*/
|
|
|
@ -1,258 +0,0 @@
|
||||||
#include <stdio.h>
|
|
||||||
#include "args.h"
|
|
||||||
|
|
||||||
#include "wolfssl/wolfcrypt/rsa.h"
|
|
||||||
|
|
||||||
#include "wolfssl/wolfcrypt/ecc.h"
|
|
||||||
#include "wolfssl/wolfcrypt/asn.h"
|
|
||||||
#include "wolfssl/wolfcrypt/random.h"
|
|
||||||
|
|
||||||
static int rsa2raw(FILE *rsaDer, FILE *out, int keySz, int pub)
|
|
||||||
{
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
RSA_1024 = 1024,
|
|
||||||
RSA_2048 = 2048,
|
|
||||||
} rsaSize;
|
|
||||||
|
|
||||||
#define DERSIZE 1024
|
|
||||||
unsigned char der[DERSIZE];
|
|
||||||
int derSz;
|
|
||||||
int ret;
|
|
||||||
#define RSASIZE (2048/8)
|
|
||||||
|
|
||||||
unsigned char n[RSASIZE];
|
|
||||||
unsigned char e[RSASIZE];
|
|
||||||
unsigned char d[RSASIZE];
|
|
||||||
unsigned char p[RSASIZE];
|
|
||||||
unsigned char q[RSASIZE];
|
|
||||||
|
|
||||||
unsigned int nSz = sizeof(n), eSz = sizeof(e);
|
|
||||||
unsigned int dSz = sizeof(d), pSz = sizeof(p), qSz = sizeof(q);
|
|
||||||
|
|
||||||
RsaKey rsa;
|
|
||||||
unsigned int inOutIdx = 0;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
switch (keySz) {
|
|
||||||
case 0:
|
|
||||||
keySz = RSA_2048;
|
|
||||||
break;
|
|
||||||
case RSA_1024:
|
|
||||||
case RSA_2048:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "ERROR: Key Size(%d)\n", keySz);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((derSz = fread(der, 1, sizeof(der), rsaDer)) <= 0){
|
|
||||||
fprintf(stderr, "ERROR: Read DER file(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((ret = wc_InitRsaKey(&rsa, NULL)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_InitRsaKey(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(pub) {
|
|
||||||
if ((ret = wc_RsaPublicKeyDecode(der, &inOutIdx, &rsa, derSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_RsaPublicKeyDecode(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((ret = wc_RsaPrivateKeyDecode(der, &inOutIdx, &rsa, derSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_RsaPublicKeyDecode(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(n, 0, sizeof(n));
|
|
||||||
memset(e, 0, sizeof(e));
|
|
||||||
|
|
||||||
if (pub) {
|
|
||||||
if ((ret = wc_RsaFlattenPublicKey(&rsa, e, &eSz, n, &nSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_RsaFlattenPublicKey(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memset(d, 0, sizeof(d));
|
|
||||||
if ((ret = wc_RsaExportKey(&rsa,
|
|
||||||
e, &eSz, n, &nSz, d, &dSz, p, &pSz, q, &qSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_RsaExportKey(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < keySz / 8; i++) {
|
|
||||||
fprintf(out, "%02x", n[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < 4; i++) {
|
|
||||||
fprintf(out, "%02x", e[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pub) {
|
|
||||||
for (i = 0; i < keySz / 8; i++) {
|
|
||||||
fprintf(out, "%02x", d[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int ecc2raw(FILE *eccDer, FILE *out, int keySz, int pub)
|
|
||||||
{
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ECC_192 = 192,
|
|
||||||
ECC_224 = 224,
|
|
||||||
ECC_256 = 256,
|
|
||||||
ECC_384 = 364,
|
|
||||||
} eccSize;
|
|
||||||
|
|
||||||
#define ECC_DER 256
|
|
||||||
byte der[ECC_DER];
|
|
||||||
int derSz;
|
|
||||||
unsigned int inOutIdx = 0;
|
|
||||||
struct ecc_key key;
|
|
||||||
byte qx[MAX_ECC_BYTES];
|
|
||||||
byte qy[MAX_ECC_BYTES];
|
|
||||||
byte d [MAX_ECC_BYTES];
|
|
||||||
word32 qxSz = sizeof(qx);
|
|
||||||
word32 qySz = sizeof(qy);
|
|
||||||
word32 dSz = sizeof(d);
|
|
||||||
WC_RNG rng;
|
|
||||||
|
|
||||||
int i;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
switch(keySz) {
|
|
||||||
case 0:
|
|
||||||
keySz = ECC_256;
|
|
||||||
break;
|
|
||||||
case ECC_192:
|
|
||||||
case ECC_224:
|
|
||||||
case ECC_256:
|
|
||||||
case ECC_384:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
fprintf(stderr, "ERROR: Key Size(%d)\n", keySz);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((derSz = fread(der, 1, sizeof(der), eccDer)) < 0) {
|
|
||||||
fprintf(stderr, "ERROR: Read DER file(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if((ret = wc_ecc_init(&key)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_ecc_init(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pub) {
|
|
||||||
if ((ret = wc_EccPublicKeyDecode(der, &inOutIdx, &key, derSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_EccPublicKeyDecode(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ((ret = wc_EccPrivateKeyDecode(der, &inOutIdx, &key, derSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_EccPrivateKeyDecode(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
memset(qx, 0, sizeof(qx));
|
|
||||||
memset(qy, 0, sizeof(qy));
|
|
||||||
|
|
||||||
|
|
||||||
if (pub) {
|
|
||||||
if ((ret = wc_ecc_export_public_raw(&key, qx, &qxSz, qy, &qySz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_ecc_export_public_raw(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
memset(d, 0, sizeof(d));
|
|
||||||
if((ret = wc_ecc_export_private_raw(&key, qx, &qxSz, qy, &qySz, d, &dSz)) != 0) {
|
|
||||||
fprintf(stderr, "ERROR: wc_ecc_export_private_raw(%d)\n", ret);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < keySz / 8; i++) {
|
|
||||||
fprintf(out, "%02x", qx[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < keySz / 8; i++) {
|
|
||||||
fprintf(out, "%02x", qy[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pub) {
|
|
||||||
for (i = 0; i < keySz / 8; i++) {
|
|
||||||
fprintf(out, "%02x", d[i]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wc_ecc_free(&key);
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void usage(void)
|
|
||||||
{
|
|
||||||
char desc[] =
|
|
||||||
"\n"
|
|
||||||
"$ command[-e][-pub][-s <size>] in_file [out_file]\n"
|
|
||||||
"\n"
|
|
||||||
"in_file is mandate. If no out_file is specified, output to stdout\n"
|
|
||||||
"-s <size>: Key size bits in decimal (Default: 2049 bit/RSA, 256 bit/ECC)\n"
|
|
||||||
"-e: Input is a ECC key (Default: RSA)\n"
|
|
||||||
"-pub: Input is a public key (Default: private)\n"
|
|
||||||
"-? or -help: Display this help message\n";
|
|
||||||
|
|
||||||
printf("\nUsage:\n%s", desc);
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int ac, char** av)
|
|
||||||
{
|
|
||||||
FILE *in, *out;
|
|
||||||
int ret;
|
|
||||||
int keySz = 0;
|
|
||||||
int ecc;
|
|
||||||
int pub;
|
|
||||||
int help = 0;
|
|
||||||
|
|
||||||
Args_open(ac, av);
|
|
||||||
|
|
||||||
help |= Args_option("?");
|
|
||||||
help |= Args_option("help");
|
|
||||||
if (help) {
|
|
||||||
usage();
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = Args_optDec("s", &keySz);
|
|
||||||
ecc = Args_option("e");
|
|
||||||
pub = Args_option("pub");
|
|
||||||
in = Args_infile("rb", 0);
|
|
||||||
out = Args_outfile("w+", ARGS_STDOUT);
|
|
||||||
|
|
||||||
if (Args_error()) {
|
|
||||||
Args_close(in, out);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ecc)
|
|
||||||
ret = ecc2raw(in, out, keySz, pub);
|
|
||||||
else
|
|
||||||
ret = rsa2raw(in, out, keySz, pub);
|
|
||||||
|
|
||||||
Args_close(in, out);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
#define HAVE_ECC
|
|
||||||
|
|
||||||
#define ECC_TIMING_RESISTANT
|
|
||||||
#define WC_RSA_BLINDING
|
|
||||||
|
|
||||||
#define WOLFSSL_HAVE_SP_RSA
|
|
||||||
#define WOLFSSL_HAVE_SP_ECC
|
|
||||||
#define WOLFSSL_SP
|
|
||||||
|
|
||||||
#define NO_SHA
|
|
||||||
#define NO_MD5
|
|
||||||
#define NO_DES3
|
|
||||||
#define NO_DSA
|
|
||||||
#define NO_OLD_TLS
|
|
||||||
#define WOLFCRYPT_ONLY
|
|
Loading…
Reference in New Issue