mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-12-18 20:38:10 +00:00
storage: use fixed hw_entropy in unprivileged mode
This commit is contained in:
parent
9a9c537afd
commit
67c0f8b8a1
@ -89,12 +89,6 @@ void check_lock_screen(void)
|
|||||||
|
|
||||||
int main(void)
|
int main(void)
|
||||||
{
|
{
|
||||||
#if EMULATOR
|
|
||||||
memzero(HW_ENTROPY_DATA, HW_ENTROPY_LEN);
|
|
||||||
#else
|
|
||||||
desig_get_unique_id((uint32_t*)HW_ENTROPY_DATA);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef APPVER
|
#ifndef APPVER
|
||||||
setup();
|
setup();
|
||||||
__stack_chk_guard = random32(); // this supports compiler provided unpredictable stack protection checks
|
__stack_chk_guard = random32(); // this supports compiler provided unpredictable stack protection checks
|
||||||
@ -106,12 +100,19 @@ int main(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!is_mode_unprivileged()) {
|
if (!is_mode_unprivileged()) {
|
||||||
|
desig_get_unique_id((uint32_t*)HW_ENTROPY_DATA);
|
||||||
timer_init();
|
timer_init();
|
||||||
|
|
||||||
#ifdef APPVER
|
#ifdef APPVER
|
||||||
// enable MPU (Memory Protection Unit)
|
// enable MPU (Memory Protection Unit)
|
||||||
mpu_config();
|
mpu_config();
|
||||||
|
#endif
|
||||||
|
} else {
|
||||||
|
#if EMULATOR
|
||||||
|
memzero(HW_ENTROPY_DATA, HW_ENTROPY_LEN);
|
||||||
|
#else
|
||||||
|
// we are running in unprivileged mode
|
||||||
|
// use fixed HW_ENTROPY
|
||||||
|
memset(HW_ENTROPY_DATA, 0x3C, HW_ENTROPY_LEN);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
/*
|
/*
|
||||||
* The length of the sector header in bytes. The header is preserved between sector erasures.
|
* The length of the sector header in bytes. The header is preserved between sector erasures.
|
||||||
*/
|
*/
|
||||||
#define NORCOW_HEADER_LEN (0x000)
|
#define NORCOW_HEADER_LEN (0x100)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Current storage version.
|
* Current storage version.
|
||||||
|
Loading…
Reference in New Issue
Block a user