mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 14:28:07 +00:00
fix(core): fix f4 monoctr in non-production builds
[no changelog]
This commit is contained in:
parent
884d5b07cf
commit
8507335806
@ -22,6 +22,12 @@
|
||||
#include "model.h"
|
||||
#include "string.h"
|
||||
|
||||
#if !PRODUCTION
|
||||
// we don't want to override OTP on development boards
|
||||
// lets mock this functionality
|
||||
static uint8_t dummy_version = 0;
|
||||
#endif
|
||||
|
||||
#if PRODUCTION
|
||||
static int get_otp_block(monoctr_type_t type) {
|
||||
switch (type) {
|
||||
@ -71,7 +77,10 @@ secbool monoctr_write(monoctr_type_t type, uint8_t value) {
|
||||
}
|
||||
|
||||
ensure(flash_otp_write(block, 0, bits, FLASH_OTP_BLOCK_SIZE), NULL);
|
||||
|
||||
#else
|
||||
if (value >= dummy_version) {
|
||||
dummy_version = value;
|
||||
}
|
||||
#endif
|
||||
return sectrue;
|
||||
}
|
||||
@ -124,9 +133,7 @@ secbool monoctr_read(monoctr_type_t type, uint8_t* value) {
|
||||
return secfalse;
|
||||
}
|
||||
#else
|
||||
|
||||
*value = 0;
|
||||
|
||||
*value = dummy_version;
|
||||
#endif
|
||||
|
||||
return sectrue;
|
||||
|
Loading…
Reference in New Issue
Block a user