Skip to content

Commit 21ce30f

Browse files
committed
address review comments
1 parent 7b99e7b commit 21ce30f

File tree

4 files changed

+37
-27
lines changed

4 files changed

+37
-27
lines changed

.gitignore

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ IDE/Renesas/e2studio/RZN2L/app_RZ/.api_xml
158158
IDE/Renesas/e2studio/RZN2L/app_RZ/.secure_azone
159159
IDE/Renesas/e2studio/RZN2L/app_RZ/.secure_xml
160160
IDE/Renesas/e2studio/RZN2L/app_RZ/configuration.xml
161+
IDE/Renesas/e2studio/RZN2L/app_RZ/rzn_cfg.txt
162+
IDE/Release/e2Studio/RZN2L/app_RZ/JLinkLog.log
161163
IDE/Renesas/e2studio/RZN2L/flash_app/Debug
162164
IDE/Renesas/e2studio/RZN2L/flash_app/rzn
163165
IDE/Renesas/e2studio/RZN2L/flash_app/rzn_gen
@@ -167,6 +169,10 @@ IDE/Renesas/e2studio/RZN2L/flash_app/.api_xml
167169
IDE/Renesas/e2studio/RZN2L/flash_app/.secure_azone
168170
IDE/Renesas/e2studio/RZN2L/flash_app/.secure_xml
169171
IDE/Renesas/e2studio/RZN2L/flash_app/configuration.xml
172+
IDE/Renesas/e2studio/RZN2L/flash_app/rzn_cfg.txt
173+
IDE/Release/e2Studio/RZN2L/flash_app/JLinkLog.log
174+
IDE/Renesas/e2studio/RZN2L/flash_app/flash_simple_loader.elf.jlink
175+
IDE/Renesas/e2studio/RZN2L/flash_app/flash_simple_loader.elf.launch
170176
IDE/Renesas/e2studio/RZN2L/wolfboot/Debug
171177
IDE/Renesas/e2studio/RZN2L/wolfboot/rzn
172178
IDE/Renesas/e2studio/RZN2L/wolfboot/rzn_gen
@@ -176,4 +182,11 @@ IDE/Renesas/e2studio/RZN2L/wolfboot/.api_xml
176182
IDE/Renesas/e2studio/RZN2L/wolfboot/.secure_azone
177183
IDE/Renesas/e2studio/RZN2L/wolfboot/.secure_xml
178184
IDE/Renesas/e2studio/RZN2L/wolfboot/configuration.xml
185+
IDE/Renesas/e2studio/RZN2L/wolfboot/rzn_cfg.txt
186+
IDE/Release/e2Studio/RZN2L/wolfboot/JLinkLog.log
187+
IDE/Renesas/e2studio/RZN2L/wolfboot/wolfBoot_RZ.elf.jlink
188+
IDE/Renesas/e2studio/RZN2L/wolfboot/wolfBoot_RZ.elf.launch
189+
IDE/Renesas/e2studio/RZN2L/wolfboot/.cache/*
190+
IDE/Renesas/e2studio/RZN2L/flash_app/.cache/*
191+
IDE/Release/e2studio/RZN2L/app_RZ/.cache/*
179192

IDE/Renesas/e2studio/RZN2L/flash_app/src/Flash_update.s

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@
2626
the loader project. */
2727

2828
.section .IMAGE_APP_FLASH_update, "ax", %progbits
29-
/* To download the app v2, please remove comment out. */
29+
/* To download the app v2, please enable the line below. */
3030
/* .incbin "../../app_RZ/Debug/app_RZ_v2.0_signed.bin" */

IDE/Renesas/e2studio/RZN2L/flash_app/src/Flash_wrappedkey_public.s

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
/* Flash_sections.s
2-
*
3-
* Custom configuration for wolfCrypt/wolfSSL.
4-
* Enabled via WOLFSSL_USER_SETTINGS.
5-
*
1+
/* Flash_wrappedkey_public.s
62
*
73
* Copyright (C) 2024 wolfSSL Inc.
84
*
@@ -26,5 +22,5 @@
2622
the loader project. */
2723

2824
.section .WRAPPED_KEY_FLASH_PUB, "ax", %progbits
29-
/* To download the encrypted rsip key, please remove comment out. */
25+
/* To download the encrypted rsip key, please enable the line below. */
3026
/* .incbin "../rsa_pub2048.bin" */

hal/renesas-rz.c

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -127,47 +127,49 @@ void ext_flash_unlock(void)
127127

128128
void hal_init(void)
129129
{
130+
130131
#if defined(WOLFBOOT_RENESAS_RSIP) && !defined(WOLFBOOT_RENESAS_APP)
131-
fsp_err_t err;
132-
int ret;
133-
rsa_public_t rsip_pub_key;
134-
const size_t key_size = sizeof(rsip_pub_key);
135-
132+
133+
fsp_err_t err;
134+
int ret;
135+
rsa_public_t rsip_pub_key;
136+
const size_t key_size = sizeof(rsip_pub_key);
137+
136138
err = wolfCrypt_Init();
137139
if (err != 0) {
138-
printf("ERROR: wolfCrypt_Init %d\n", err);
139-
hal_panic();
140+
printf("ERROR: wolfCrypt_Init %d\n", err);
141+
hal_panic();
140142
}
141143

142144
/* copy the key from ext flash to RAM */
143145
ret = ext_flash_read(RENESAS_RSIP_INSTALLEDKEY_FLASH_ADDR,
144-
(uint8_t*)RENESAS_RSIP_INSTALLEDKEY_RAM_ADDR, key_size);
146+
(uint8_t*)RENESAS_RSIP_INSTALLEDKEY_RAM_ADDR, key_size);
145147
if (ret != key_size){
146148
wolfBoot_printf("Error reading public key at %lx\n",
147149
RENESAS_RSIP_INSTALLEDKEY_FLASH_ADDR);
148150
hal_panic();
149151
}
150152
/* import enrypted key */
151153
XMEMCPY(&rsip_pub_key, (const void*)RENESAS_RSIP_INSTALLEDKEY_RAM_ADDR, key_size);
152-
err = R_RSIP_KeyImportWithUFPK(&rsip_ctrl,
153-
rsip_pub_key.wufpk,
154-
rsip_pub_key.initial_vector,
155-
RSIP_KEY_TYPE_RSA_2048_PUBLIC_ENHANCED,
156-
rsip_pub_key.encrypted_user_key,
157-
p_wrapped_public_key);
158-
154+
155+
err = R_RSIP_KeyImportWithUFPK(&rsip_ctrl, rsip_pub_key.wufpk,
156+
rsip_pub_key.initial_vector,
157+
RSIP_KEY_TYPE_RSA_2048_PUBLIC_ENHANCED,
158+
rsip_pub_key.encrypted_user_key,
159+
p_wrapped_public_key);
160+
159161
XMEMSET(&pkInfo, 0, sizeof(pkInfo));
160-
pkInfo.wrapped_key_rsapub2048 =
161-
(rsip_wrapped_key_t*)p_wrapped_public_key;
162162

163+
pkInfo.wrapped_key_rsapub2048 =
164+
(rsip_wrapped_key_t*)p_wrapped_public_key;
163165
pkInfo.keyflgs_crypt.bits.rsapub2048_installedkey_set = 1;
164166
pkInfo.keyflgs_crypt.bits.message_type = 1;
165167
pkInfo.hash_type = RSIP_HASH_TYPE_SHA256;
166168
err = wc_CryptoCb_CryptInitRenesasCmn(NULL, &pkInfo);
167169

168170
if (err < 0) {
169-
wolfBoot_printf("ERROR: wc_CryptoCb_CryptInitRenesasCmn %d\n", err);
170-
hal_panic();
171+
wolfBoot_printf("ERROR: wc_CryptoCb_CryptInitRenesasCmn %d\n", err);
172+
hal_panic();
171173
}
172174

173175
#endif
@@ -203,7 +205,6 @@ void hal_flash_lock(void)
203205
return;
204206
}
205207

206-
207208
void* hal_get_primary_address(void)
208209
{
209210
return (void*)WOLFBOOT_PARTITION_BOOT_ADDRESS;

0 commit comments

Comments
 (0)