Skip to content

Commit 9dd8b7c

Browse files
committed
Renamed FLASH_OTP_ROT to FLASH_OTP_KEYSTORE
1 parent 34652ff commit 9dd8b7c

File tree

10 files changed

+31
-33
lines changed

10 files changed

+31
-33
lines changed

Makefile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ ifeq ($(SIGN),NONE)
3535
PRIVATE_KEY=
3636
else
3737
PRIVATE_KEY=wolfboot_signing_private_key.der
38-
ifeq ($(FLASH_OTP_ROT),1)
38+
ifeq ($(FLASH_OTP_KEYSTORE),1)
3939
OBJS+=./src/flash_otp_keystore.o
4040
else
4141
OBJS+=./src/keystore.o
@@ -127,7 +127,7 @@ ifeq ($(TARGET),nxp_t1024)
127127
MAIN_TARGET:=factory_wstage1.bin
128128
endif
129129

130-
ifeq ($(FLASH_OTP_ROT),1)
130+
ifeq ($(FLASH_OTP_KEYSTORE),1)
131131
MAIN_TARGET:=include/target.h tools/keytools/otp/otp-keystore-primer factory.bin
132132
endif
133133

@@ -188,7 +188,7 @@ $(PRIVATE_KEY):
188188
$(Q)$(MAKE) keytools_check
189189
$(Q)(test $(SIGN) = NONE) || ("$(KEYGEN_TOOL)" $(KEYGEN_OPTIONS) -g $(PRIVATE_KEY)) || true
190190
$(Q)(test $(SIGN) = NONE) && (echo "// SIGN=NONE" > src/keystore.c) || true
191-
$(Q)(test $(FLASH_OTP_ROT) = 0) || (make -C tools/keytools/otp) || true
191+
$(Q)(test $(FLASH_OTP_KEYSTORE) = 0) || (make -C tools/keytools/otp) || true
192192

193193
keytools: include/target.h
194194
@echo "Building key tools"
@@ -244,7 +244,7 @@ wolfboot_stage1.bin: wolfboot.elf stage1/loader_stage1.bin
244244
$(Q) cp stage1/loader_stage1.bin wolfboot_stage1.bin
245245

246246
wolfboot.elf: include/target.h $(LSCRIPT) $(OBJS) $(LIBS) $(BINASSEMBLE) FORCE
247-
$(Q)(test $(SIGN) = NONE) || (test $(FLASH_OTP_ROT) = 1) || (grep -q $(SIGN_ALG) src/keystore.c) || \
247+
$(Q)(test $(SIGN) = NONE) || (test $(FLASH_OTP_KEYSTORE) = 1) || (grep -q $(SIGN_ALG) src/keystore.c) || \
248248
(echo "Key mismatch: please run 'make distclean' to remove all keys if you want to change algorithm" && false)
249249
@echo "\t[LD] $@"
250250
@echo $(OBJS)

hal/stm32h5.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ void hal_prepare_boot(void)
432432
#endif
433433
}
434434

435-
#ifdef FLASH_OTP_ROT
435+
#ifdef FLASH_OTP_KEYSTORE
436436

437437
/* Public API */
438438

@@ -500,4 +500,4 @@ int hal_flash_otp_read(uint32_t flashAddress, void* data, uint32_t length)
500500
return 0;
501501
}
502502

503-
#endif /* FLASH_OTP_ROT */
503+
#endif /* FLASH_OTP_KEYSTORE */

hal/stm32h7.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ void hal_prepare_boot(void)
513513
clock_pll_off();
514514
}
515515

516-
#ifdef FLASH_OTP_ROT
516+
#ifdef FLASH_OTP_KEYSTORE
517517
static void flash_otp_wait(void)
518518
{
519519
/* Wait for the FLASH operation to complete by polling on QW flag to be reset. */
@@ -610,5 +610,5 @@ int hal_flash_otp_read(uint32_t flashAddress, void* data, uint32_t length)
610610
return 0;
611611
}
612612

613-
#endif /* FLASH_OTP_ROT */
613+
#endif /* FLASH_OTP_KEYSTORE */
614614

hal/stm32h7.h

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -279,22 +279,20 @@
279279
#define FLASH_OPT_KEY1 (0x08192A3BU)
280280
#define FLASH_OPT_KEY2 (0x4C5D6E7FU)
281281

282-
#ifdef FLASH_OTP_ROT
283-
#ifndef FLASH_OTP_BASE
284-
#define FLASH_OTP_BASE 0x08FFF000
285-
#endif
286-
#ifndef FLASH_OTP_END
287-
#define FLASH_OTP_END 0x08FFF3FF
288-
#endif
289-
#ifndef OTP_SIZE
290-
#define OTP_SIZE 1024
291-
#endif
292-
#ifndef OTP_BLOCKS
293-
#define OTP_BLOCKS 16
294-
#endif
295-
296-
#define OTP_BLOCK_SIZE (OTP_SIZE / OTP_BLOCKS) /* 64 bytes */
282+
#ifndef FLASH_OTP_BASE
283+
#define FLASH_OTP_BASE 0x08FFF000
297284
#endif
285+
#ifndef FLASH_OTP_END
286+
#define FLASH_OTP_END 0x08FFF3FF
287+
#endif
288+
#ifndef OTP_SIZE
289+
#define OTP_SIZE 1024
290+
#endif
291+
#ifndef OTP_BLOCKS
292+
#define OTP_BLOCKS 16
293+
#endif
294+
295+
#define OTP_BLOCK_SIZE (OTP_SIZE / OTP_BLOCKS) /* 64 bytes */
298296

299297
/* STM32H7: Due to ECC functionality, it is not possible to write partition/sector
300298
* flags and signature more than once. This flags_cache is used to intercept write operations and

include/hal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ int hal_trng_get_entropy(unsigned char *out, unsigned len);
130130

131131
#endif
132132

133-
#ifdef FLASH_OTP_ROT
133+
#ifdef FLASH_OTP_KEYSTORE
134134

135135
int hal_flash_otp_write(uint32_t flashAddress, const void* data, uint16_t length);
136136
int hal_flash_otp_read(uint32_t flashAddress, void* data, uint32_t length);

include/otp_keystore.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
#ifndef OTP_KEYSTORE_H
2727
#define OTP_KEYSTORE_H
2828

29-
#if defined(FLASH_OTP_ROT) && !defined(WOLFBOOT_NO_SIGN)
29+
#if defined(FLASH_OTP_KEYSTORE) && !defined(WOLFBOOT_NO_SIGN)
3030
/* Specific includes for supported targets
3131
* (needed for OTP_SIZE)
3232
*/
@@ -67,6 +67,6 @@ static const char KEYSTORE_HDR_MAGIC[8] = "WOLFBOOT";
6767

6868
#endif /* KEYSTORE_ANY */
6969

70-
#endif /* FLASH_OTP_ROT */
70+
#endif /* FLASH_OTP_KEYSTORE */
7171

7272
#endif /* OTP_KEYSTORE_H */

options.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
WOLFCRYPT_OBJS+=./lib/wolfssl/wolfcrypt/src/asn.o
22

33
# Support for Built-in ROT into OTP flash memory
4-
ifeq ($(FLASH_OTP_ROT),1)
5-
CFLAGS+=-D"FLASH_OTP_ROT"
4+
ifeq ($(FLASH_OTP_KEYSTORE),1)
5+
CFLAGS+=-D"FLASH_OTP_KEYSTORE"
66
endif
77

88
# Support for TPM signature verification

src/flash_otp_keystore.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include "hal.h"
3030
#include "otp_keystore.h"
3131

32-
#if defined(FLASH_OTP_ROT) && !defined(WOLFBOOT_NO_SIGN)
32+
#if defined(FLASH_OTP_KEYSTORE) && !defined(WOLFBOOT_NO_SIGN)
3333

3434
int keystore_num_pubkeys(void)
3535
{
@@ -100,4 +100,4 @@ uint32_t keystore_get_key_type(int id)
100100
}
101101

102102

103-
#endif /* FLASH_OTP_ROT && !WOLFBOOT_NO_SIGN */
103+
#endif /* FLASH_OTP_KEYSTORE && !WOLFBOOT_NO_SIGN */

tools/config.mk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ ifeq ($(ARCH),)
7878
FORCE_32BIT=0
7979
DISK_LOCK?=0
8080
DISK_LOCK_PASSWORD?=
81-
FLASH_OTP_ROT?=0
81+
FLASH_OTP_KEYSTORE?=0
8282
endif
8383

8484
CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO_DRIVERS \
@@ -100,4 +100,4 @@ CONFIG_VARS:= ARCH TARGET SIGN HASH MCUXSDK MCUXPRESSO MCUXPRESSO_CPU MCUXPRESSO
100100
XMSS_PARAMS \
101101
ELF \
102102
NXP_CUSTOM_DCD NXP_CUSTOM_DCD_OBJS \
103-
FLASH_OTP_ROT
103+
FLASH_OTP_KEYSTORE

tools/keytools/otp/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CROSS_COMPILE?=arm-none-eabi-
99
CFLAGS+=-O0 -ggdb
1010
CFLAGS+=-I. -I../../../ -I../../../include
1111
CFLAGS+=-I./wcs
12-
CFLAGS+=-DFLASH_OTP_ROT -D__FLASH_OTP_PRIMER
12+
CFLAGS+=-DFLASH_OTP_KEYSTORE -D__FLASH_OTP_PRIMER
1313
OBJS+=startup.o otp-keystore-primer.o ../../../src/keystore.o
1414
LSCRIPT=target.ld
1515
LDFLAGS+=$(CFLAGS) -T$(LSCRIPT) -lc -Wl,-Map=otp-keystore-primer.map

0 commit comments

Comments
 (0)