cjdns/cjdns.sysctl.patch

35 lines
1.0 KiB
Diff

diff -up ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c.sysctl ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c
--- ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c.sysctl 2019-08-06 18:33:43.271999689 -0400
+++ ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c 2019-08-06 18:34:21.804537236 -0400
@@ -20,6 +20,7 @@
#include <unistd.h>
#include <sys/syscall.h>
+#ifndef SYS_getrandom
#include <sys/sysctl.h>
static int getUUID(uint64_t output[2])
@@ -35,6 +36,7 @@ static int getUUID(uint64_t output[2])
}
return 0;
}
+#endif
static int get(struct RandomSeed* randomSeed, uint64_t output[8])
{
@@ -48,11 +50,13 @@ static int get(struct RandomSeed* random
if (ret == 64 && !Bits_isZero(output, 64)) {
return 0;
}
-#endif
+ return -1;
+#else
if (getUUID(output) || getUUID(output+2) || getUUID(output+4) || getUUID(output+6)) {
return -1;
}
return 0;
+#endif
}
struct RandomSeed* LinuxRandomUuidSysctlRandomSeed_new(struct Allocator* alloc)