You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
trezor-firmware/micropython/trezorhal/rng.c

16 lines
264 B

#include STM32_HAL_H
static RNG_HandleTypeDef rng_handle = {
.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);
}