Much simpler way to remove sysctl calls.
This commit is contained in:
parent
28fdfdad15
commit
3a21741977
@ -635,6 +635,9 @@ fi
|
|||||||
%{_bindir}/graphStats
|
%{_bindir}/graphStats
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Aug 06 2019 Stuart Gathman <stuart@gathman.org> - 20.3-6
|
||||||
|
- Much simpler solution to removing sysctl calls :-)
|
||||||
|
|
||||||
* Sat Aug 03 2019 Stuart Gathman <stuart@gathman.org> - 20.3-5
|
* Sat Aug 03 2019 Stuart Gathman <stuart@gathman.org> - 20.3-5
|
||||||
- Remove deprecated sysctl() call in getUUID (read from /proc/.../random/uuid)
|
- Remove deprecated sysctl() call in getUUID (read from /proc/.../random/uuid)
|
||||||
- Patch a local copy of ronn to stop calling util.puts/util.debug
|
- Patch a local copy of ronn to stop calling util.puts/util.debug
|
||||||
|
@ -1,49 +1,11 @@
|
|||||||
diff -up ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c.sysctl ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c
|
diff -up ./crypto/random/seed/SystemRandomSeed.c.sysctl ./crypto/random/seed/SystemRandomSeed.c
|
||||||
--- ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c.sysctl 2019-05-02 04:02:32.000000000 -0400
|
--- ./crypto/random/seed/SystemRandomSeed.c.sysctl 2019-08-06 12:28:23.084611733 -0400
|
||||||
+++ ./crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.c 2019-07-31 15:43:45.626839153 -0400
|
+++ ./crypto/random/seed/SystemRandomSeed.c 2019-08-06 12:28:36.864803551 -0400
|
||||||
@@ -19,20 +19,39 @@
|
@@ -19,7 +19,6 @@
|
||||||
#include "util/Hex.h"
|
#include "crypto/random/seed/RtlGenRandomSeed.h"
|
||||||
|
#include "crypto/random/seed/BsdKernArndSysctlRandomSeed.h"
|
||||||
#include <unistd.h>
|
#include "crypto/random/seed/DevUrandomRandomSeed.h"
|
||||||
-#include <sys/syscall.h>
|
-#include "crypto/random/seed/LinuxRandomUuidSysctlRandomSeed.h"
|
||||||
-#include <sys/sysctl.h>
|
#include "crypto/random/seed/ProcSysKernelRandomUuidRandomSeed.h"
|
||||||
+#include <fcntl.h>
|
#include "crypto/random/seed/GetEntropyRandomSeed.h"
|
||||||
|
#include "crypto/random/seed/SystemRandomSeed.h"
|
||||||
static int getUUID(uint64_t output[2])
|
|
||||||
{
|
|
||||||
- int mib[] = { CTL_KERN, KERN_RANDOM, RANDOM_UUID };
|
|
||||||
- size_t sixteen = 16;
|
|
||||||
-
|
|
||||||
+ uint8_t uuid[40];
|
|
||||||
Bits_memset(output, 0, 16);
|
|
||||||
- if (sysctl(mib, 3, output, &sixteen, NULL, 0)
|
|
||||||
+ int fd = open("/proc/sys/kernel/random/uuid",O_RDONLY);
|
|
||||||
+ if (fd < 0)
|
|
||||||
+ {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ int rc = read(fd,uuid,36);
|
|
||||||
+ close(fd);
|
|
||||||
+ if (rc < 32)
|
|
||||||
+ {
|
|
||||||
+ return -1;
|
|
||||||
+ }
|
|
||||||
+ uuid[rc] = 0;
|
|
||||||
+ /* strip '-' */
|
|
||||||
+ int i,j = 0;
|
|
||||||
+ for (i = 0; uuid[i] != 0; ++i) {
|
|
||||||
+ if (uuid[i] != '-')
|
|
||||||
+ {
|
|
||||||
+ uuid[j++] = uuid[i];
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ uuid[j] = 0;
|
|
||||||
+ if (Hex_decode((uint8_t*) output, 16, uuid, j) != 16
|
|
||||||
|| Bits_isZero(output, 16))
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
+
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user