random-util: drop needless conditionalization of sys/auxv.h

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.
This commit is contained in:
Mike Yuan
2025-01-02 19:59:56 +01:00
parent aad028e187
commit 2627cd1343
2 changed files with 2 additions and 8 deletions

View 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',

View 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;