1
0
mirror of https://github.com/systemd/systemd synced 2026-04-11 17:44:58 +02:00

Compare commits

..

No commits in common. "04b457d8ef9c93be3b2048c6f545cdbcf1b893a1" and "4b7b73c7140b3c923064c6bf27a30b0e88a72f7a" have entirely different histories.

3 changed files with 9 additions and 18 deletions

View File

@ -231,14 +231,6 @@ evdev:name:Asus Laptop extra buttons:dmi:bvn*:bvr*:bd*:svnASUS*:pn*:*
evdev:input:b0003v0B05p1869* evdev:input:b0003v0B05p1869*
KEYBOARD_KEY_ff31007c=f20 # Remap micmute to f20 KEYBOARD_KEY_ff31007c=f20 # Remap micmute to f20
# Asus TF103C misses the home button in its PNP0C40 GPIO resources
# causing the volume-button mappings to be off by one, correct this
evdev:name:gpio-keys:phys:gpio-keys/input0:ev:3:dmi:*:svnASUSTeKCOMPUTERINC.:pnTF103C*:*
KEYBOARD_KEY_1=volumeup
evdev:name:gpio-keys:phys:gpio-keys/input0:ev:100003:dmi:*:svnASUSTeKCOMPUTERINC.:pnTF103C*:*
KEYBOARD_KEY_0=volumedown
########################################################### ###########################################################
# BenQ # BenQ
########################################################### ###########################################################

View File

@ -78,8 +78,7 @@ static inline int missing_memfd_create(const char *name, unsigned int flags) {
/* ======================================================================= */ /* ======================================================================= */
#if !HAVE_GETRANDOM #if !HAVE_GETRANDOM
/* glibc says getrandom() returns ssize_t */ static inline int missing_getrandom(void *buffer, size_t count, unsigned flags) {
static inline ssize_t missing_getrandom(void *buffer, size_t count, unsigned flags) {
# ifdef __NR_getrandom # ifdef __NR_getrandom
return syscall(__NR_getrandom, buffer, count, flags); return syscall(__NR_getrandom, buffer, count, flags);
# else # else

View File

@ -161,6 +161,7 @@ int genuine_random_bytes(void *p, size_t n, RandomFlags flags) {
static int have_syscall = -1; static int have_syscall = -1;
_cleanup_close_ int fd = -1; _cleanup_close_ int fd = -1;
bool got_some = false; bool got_some = false;
int r;
/* Gathers some high-quality randomness from the kernel (or potentially mid-quality randomness from /* Gathers some high-quality randomness from the kernel (or potentially mid-quality randomness from
* the CPU if the RANDOM_ALLOW_RDRAND flag is set). This call won't block, unless the RANDOM_BLOCK * the CPU if the RANDOM_ALLOW_RDRAND flag is set). This call won't block, unless the RANDOM_BLOCK
@ -219,19 +220,18 @@ int genuine_random_bytes(void *p, size_t n, RandomFlags flags) {
if (have_syscall != 0 && !HAS_FEATURE_MEMORY_SANITIZER) { if (have_syscall != 0 && !HAS_FEATURE_MEMORY_SANITIZER) {
for (;;) { for (;;) {
ssize_t l; r = getrandom(p, n,
l = getrandom(p, n,
(FLAGS_SET(flags, RANDOM_BLOCK) ? 0 : GRND_NONBLOCK) | (FLAGS_SET(flags, RANDOM_BLOCK) ? 0 : GRND_NONBLOCK) |
(FLAGS_SET(flags, RANDOM_ALLOW_INSECURE) ? GRND_INSECURE : 0)); (FLAGS_SET(flags, RANDOM_ALLOW_INSECURE) ? GRND_INSECURE : 0));
if (l > 0) { if (r > 0) {
have_syscall = true; have_syscall = true;
if ((size_t) l == n) if ((size_t) r == n)
return 0; /* Yay, success! */ return 0; /* Yay, success! */
assert((size_t) l < n); assert((size_t) r < n);
p = (uint8_t*) p + l; p = (uint8_t*) p + r;
n -= l; n -= r;
if (FLAGS_SET(flags, RANDOM_EXTEND_WITH_PSEUDO)) { if (FLAGS_SET(flags, RANDOM_EXTEND_WITH_PSEUDO)) {
/* Fill in the remaining bytes using pseudo-random values */ /* Fill in the remaining bytes using pseudo-random values */
@ -248,7 +248,7 @@ int genuine_random_bytes(void *p, size_t n, RandomFlags flags) {
/* Fill in the rest with /dev/urandom */ /* Fill in the rest with /dev/urandom */
break; break;
} else if (l == 0) { } else if (r == 0) {
have_syscall = true; have_syscall = true;
return -EIO; return -EIO;