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