]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
random-util: drop needless conditionalization of sys/auxv.h
authorMike Yuan <me@yhndnzj.com>
Thu, 2 Jan 2025 18:59:56 +0000 (19:59 +0100)
committerMike Yuan <me@yhndnzj.com>
Thu, 2 Jan 2025 19:34:21 +0000 (20:34 +0100)
We assume its existence in basic/build-path.c, shared/userdb.c,
and coredump/coredump.c already, for which nothing has been reported
so far. So this seems safe to drop.

meson.build
src/basic/random-util.c

index 6b81203168b3d740c4a8a1e3d6090771585d0fce..d9fb8fb61304d032b5ac345b36044d5625dfed9b 100644 (file)
@@ -773,7 +773,6 @@ endif
 foreach header : ['crypt.h',
                   'linux/ioprio.h',
                   'linux/time_types.h',
-                  'sys/auxv.h',
                   'sys/sdt.h',
                   'threads.h',
                   'valgrind/memcheck.h',
index 4069b290d55caa7dc2c3b863178de12dde994011..0b767a85009c9793af54d44815d68f8a265c33bb 100644 (file)
@@ -8,13 +8,10 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/auxv.h>
 #include <sys/ioctl.h>
 #include <sys/time.h>
 
-#if HAVE_SYS_AUXV_H
-#  include <sys/auxv.h>
-#endif
-
 #include "alloc-util.h"
 #include "env-util.h"
 #include "errno-util.h"
@@ -31,7 +28,7 @@
 #include "sha256.h"
 #include "time-util.h"
 
-/* This is a "best effort" kind of thing, but has no real security value.  So, this should only be used by
+/* This is a "best effort" kind of thing, but has no real security value. So, this should only be used by
  * random_bytes(), which is not meant for crypto. This could be made better, but we're *not* trying to roll a
  * userspace prng here, or even have forward secrecy, but rather just do the shortest thing that is at least
  * better than libc rand(). */
@@ -53,9 +50,7 @@ static void fallback_random_bytes(void *p, size_t n) {
                 .tid = gettid(),
         };
 
-#if HAVE_SYS_AUXV_H
         memcpy(state.auxval, ULONG_TO_PTR(getauxval(AT_RANDOM)), sizeof(state.auxval));
-#endif
 
         while (n > 0) {
                 struct sha256_ctx ctx;