mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-22 22:38:08 +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 "model.h"
|
||||||
#include "string.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
|
#if PRODUCTION
|
||||||
static int get_otp_block(monoctr_type_t type) {
|
static int get_otp_block(monoctr_type_t type) {
|
||||||
switch (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);
|
ensure(flash_otp_write(block, 0, bits, FLASH_OTP_BLOCK_SIZE), NULL);
|
||||||
|
#else
|
||||||
|
if (value >= dummy_version) {
|
||||||
|
dummy_version = value;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return sectrue;
|
return sectrue;
|
||||||
}
|
}
|
||||||
@ -124,9 +133,7 @@ secbool monoctr_read(monoctr_type_t type, uint8_t* value) {
|
|||||||
return secfalse;
|
return secfalse;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
*value = dummy_version;
|
||||||
*value = 0;
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return sectrue;
|
return sectrue;
|
||||||
|
Loading…
Reference in New Issue
Block a user