1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-18 04:18:10 +00:00

storage: use fixed hw_entropy in unprivileged mode

This commit is contained in:
Pavol Rusnak 2019-02-15 14:22:52 +01:00
parent 9a9c537afd
commit 67c0f8b8a1
No known key found for this signature in database
GPG Key ID: 91F3B339B9A02A3D
2 changed files with 10 additions and 9 deletions

View File

@ -89,12 +89,6 @@ void check_lock_screen(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
setup();
__stack_chk_guard = random32(); // this supports compiler provided unpredictable stack protection checks
@ -106,12 +100,19 @@ int main(void)
#endif
if (!is_mode_unprivileged()) {
desig_get_unique_id((uint32_t*)HW_ENTROPY_DATA);
timer_init();
#ifdef APPVER
// enable MPU (Memory Protection Unit)
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
}

View File

@ -29,7 +29,7 @@
/*
* 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.