mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-01-30 01:01:00 +00:00
Add finalize_rand() to prove we have no leaks
This commit is contained in:
parent
661751ab4b
commit
ce67a85d39
6
rand.c
6
rand.c
@ -33,10 +33,12 @@ void init_rand(void)
|
|||||||
f = fopen("/dev/urandom", "r");
|
f = fopen("/dev/urandom", "r");
|
||||||
}
|
}
|
||||||
|
|
||||||
void finalize_rand(void)
|
int finalize_rand(void)
|
||||||
{
|
{
|
||||||
fclose(f);
|
int err = fclose(f);
|
||||||
f = NULL;
|
f = NULL;
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t random32(void)
|
uint32_t random32(void)
|
||||||
|
2
rand.h
2
rand.h
@ -27,7 +27,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
void init_rand(void);
|
void init_rand(void);
|
||||||
void finalize_rand(void);
|
int 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);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user