just use /dev/urandom
All checks were successful
k4 Build Test / do_the_build (push) Successful in 46s
All checks were successful
k4 Build Test / do_the_build (push) Successful in 46s
This commit is contained in:
parent
57fffeb0a3
commit
d614e2ced4
@ -8,7 +8,6 @@
|
|||||||
#else
|
#else
|
||||||
#include<netdb.h>
|
#include<netdb.h>
|
||||||
#include<sys/socket.h>
|
#include<sys/socket.h>
|
||||||
#include<sys/random.h>
|
|
||||||
#include<arpa/inet.h>
|
#include<arpa/inet.h>
|
||||||
#include<ifaddrs.h>
|
#include<ifaddrs.h>
|
||||||
#endif
|
#endif
|
||||||
@ -36,6 +35,13 @@
|
|||||||
#define RAND(b, i) RtlGenRandom(b, i)
|
#define RAND(b, i) RtlGenRandom(b, i)
|
||||||
#else
|
#else
|
||||||
#define RAND(b, i) getrandom(b, i, 0)
|
#define RAND(b, i) getrandom(b, i, 0)
|
||||||
|
static void getrandom(void *buf, size_t amount, int flags) {
|
||||||
|
static FILE *f;
|
||||||
|
if(!f) {
|
||||||
|
f = fopen("/dev/urandom", "rb");
|
||||||
|
}
|
||||||
|
fread(buf, 1, amount, f);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct StunMsg {
|
struct StunMsg {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user