mirror of
https://github.com/trezor/trezor-firmware.git
synced 2024-11-18 21:48:13 +00:00
17 lines
298 B
C
17 lines
298 B
C
#include STM32_HAL_H
|
|
|
|
static RNG_HandleTypeDef rng_handle = {
|
|
.State = HAL_RNG_STATE_RESET,
|
|
.Instance = RNG,
|
|
};
|
|
|
|
int rng_init(void) {
|
|
__HAL_RCC_RNG_CLK_ENABLE();
|
|
HAL_RNG_Init(&rng_handle);
|
|
return 0;
|
|
}
|
|
|
|
uint32_t rng_get(void) {
|
|
return HAL_RNG_GetRandomNumber(&rng_handle);
|
|
}
|