|
@@ -10,6 +10,7 @@ extern "C" {
|
|
|
|
|
|
|
|
#include <NTL/ZZ_p.h>
|
|
#include <NTL/ZZ_p.h>
|
|
|
|
|
|
|
|
|
|
+#include <fstream>
|
|
|
#include <vector>
|
|
#include <vector>
|
|
|
#include <stdio.h>
|
|
#include <stdio.h>
|
|
|
#include <errno.h>
|
|
#include <errno.h>
|
|
@@ -286,6 +287,14 @@ static void controllerconn_event_cb(struct bufferevent *bev, short events,
|
|
|
|
|
|
|
|
int worker_main(const char *controller_host, unsigned short controller_port)
|
|
int worker_main(const char *controller_host, unsigned short controller_port)
|
|
|
{
|
|
{
|
|
|
|
|
+ // Initialize the prng with some randomness from the kernel
|
|
|
|
|
+ unsigned char randbuf[1024];
|
|
|
|
|
+ ifstream urand("/dev/urandom");
|
|
|
|
|
+ urand.read((char *)randbuf, sizeof(randbuf));
|
|
|
|
|
+ urand.close();
|
|
|
|
|
+ ZZ randzz = ZZFromBytes(randbuf, sizeof(randbuf));
|
|
|
|
|
+ SetSeed(randzz);
|
|
|
|
|
+
|
|
|
evthread_use_pthreads();
|
|
evthread_use_pthreads();
|
|
|
|
|
|
|
|
signal(SIGPIPE, SIG_IGN);
|
|
signal(SIGPIPE, SIG_IGN);
|