1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-12-17 11:58:13 +00:00

Add finalize_rand()

This commit is contained in:
Dustin Laurence 2014-12-19 19:24:59 -08:00
parent fb747384a0
commit 661751ab4b
2 changed files with 7 additions and 0 deletions

6
rand.c
View File

@ -33,6 +33,12 @@ void init_rand(void)
f = fopen("/dev/urandom", "r"); f = fopen("/dev/urandom", "r");
} }
void finalize_rand(void)
{
fclose(f);
f = NULL;
}
uint32_t random32(void) uint32_t random32(void)
{ {
uint32_t r; uint32_t r;

1
rand.h
View File

@ -27,6 +27,7 @@
#include <stdint.h> #include <stdint.h>
void init_rand(void); void init_rand(void);
void finalize_rand(void);
uint32_t random32(void); uint32_t random32(void);
void random_buffer(uint8_t *buf, size_t len); void random_buffer(uint8_t *buf, size_t len);