1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-29 00:31:02 +00:00

Add finalize_rand() to prove we have no leaks

This commit is contained in:
Dustin Laurence 2014-12-20 10:57:38 -08:00
parent 661751ab4b
commit ce67a85d39
2 changed files with 5 additions and 3 deletions

6
rand.c
View File

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

2
rand.h
View File

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