Skip to content

Commit 11ce50f

Browse files
danielinuxdgarske
authored andcommitted
Removed debug print, added PKCS11_SMALL, fixes
1 parent 16bdc19 commit 11ce50f

File tree

3 files changed

+9
-15
lines changed

3 files changed

+9
-15
lines changed

hal/stm32_tz.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ void hal_tz_claim_nonsecure_area(uint32_t address, int len)
128128
address += FLASH_PAGE_SIZE;
129129
page_n++;
130130
}
131-
132131
address = start_address;
133132
while (address < end) {
134133
/* Erase claimed non-secure page, in secure mode */
@@ -141,10 +140,12 @@ void hal_tz_claim_nonsecure_area(uint32_t address, int len)
141140
#endif
142141

143142
DMB();
143+
ISB();
144144
FLASH_CR |= FLASH_CR_STRT;
145145
ISB();
146146
hal_flash_wait_complete(bank);
147147
address += FLASH_PAGE_SIZE;
148+
page_n++;
148149
}
149150
#ifndef PLATFORM_stm32h5
150151
FLASH_CR &= ~FLASH_CR_PER ;

hal/stm32h5.c

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,9 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
9393
int i = 0;
9494
uint32_t *src, *dst;
9595
uint32_t dword[2];
96-
volatile uint32_t *sr, *cr;
9796
uint32_t off = 0;
9897
uint32_t una_len = 0;
9998

100-
cr = &FLASH_CR;
101-
sr = &FLASH_SR;
102-
10399
hal_flash_clear_errors(0);
104100
src = (uint32_t *)data;
105101
dst = (uint32_t *)address;
@@ -118,15 +114,15 @@ int RAMFUNCTION hal_flash_write(uint32_t address, const uint8_t *data, int len)
118114
dword[1] = src[(i >> 2) + 1];
119115
else
120116
dword[1] = 0xFFFFFFFF;
121-
*cr |= FLASH_CR_PG;
117+
FLASH_CR |= FLASH_CR_PG;
122118
dst[i >> 2] = dword[0];
123119
ISB();
124120
dst[(i >> 2) + 1] = dword[1];
125121
ISB();
126122
hal_flash_wait_complete(0);
127-
if ((*sr & FLASH_SR_EOP) != 0)
128-
*sr |= FLASH_SR_EOP;
129-
*cr &= ~FLASH_CR_PG;
123+
if ((FLASH_SR & FLASH_SR_EOP) != 0)
124+
FLASH_SR |= FLASH_SR_EOP;
125+
FLASH_CR &= ~FLASH_CR_PG;
130126
i+=8;
131127
}
132128
#if (TZ_SECURE())
@@ -215,11 +211,6 @@ int RAMFUNCTION hal_flash_erase(uint32_t address, int len)
215211
/* Check for swapped banks to invert bnksel */
216212
if ((FLASH_OPTSR_CUR & FLASH_OPTSR_SWAP_BANK) >> 31)
217213
bnksel = !bnksel;
218-
219-
#if !TZ_SECURE() && !defined(__FLASH_OTP_PRIMER) && defined(DEBUG)
220-
printf("Erasing bank %d, page %d\r\n", bnksel, (p - base) >> 13);
221-
#endif
222-
223214
reg |= ((((p - base) >> 13) << FLASH_CR_PNB_SHIFT) | FLASH_CR_SER | (bnksel << 31));
224215
FLASH_CR = reg;
225216
ISB();

include/user_settings.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,9 @@ extern int tolower(int c);
114114
# endif
115115
# else
116116
# define HAVE_ECC_SIGN
117+
#ifndef PKCS11_SMALL
117118
# define HAVE_ECC_CDH
119+
#endif
118120
# define WOLFSSL_SP
119121
# define WOLFSSL_SP_MATH
120122
# define WOLFSSL_SP_SMALL
@@ -173,7 +175,7 @@ extern int tolower(int c);
173175
#if defined(WOLFBOOT_SIGN_RSA2048) || \
174176
defined(WOLFBOOT_SIGN_RSA3072) || \
175177
defined(WOLFBOOT_SIGN_RSA4096) || \
176-
defined(WOLFCRYPT_SECURE_MODE)
178+
(defined(WOLFCRYPT_SECURE_MODE) && (!defined(PKCS11_SMALL)))
177179

178180
# define WC_RSA_BLINDING
179181
# define WC_RSA_DIRECT

0 commit comments

Comments
 (0)