Alejandro Colomar
1d6456542c
lib/csrand.c: csrand(): Use read(2) instead of fread(2)
...
We don't need the heavy stdio for getting a few bytes from
</dev/urandom>. Let's use the simpler POSIX API.
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-12-01 21:43:25 -06:00
Alejandro Colomar
47edcd3045
lib/csrand.c: Fix the lower part of the domain of csrand_uniform()
...
I accidentally broke this code during an un-optimization. We need to
start from a random value of the width of the limit, that is, 32 bits.
Thanks to Jason for pointing to his similar code in the kernel, which
made me see my mistake.
Fixes: 2a61122b5e ("Unoptimize the higher part of the domain of csrand_uniform()")
Closes: <https://github.com/shadow-maint/shadow/issues/1015 >
Reported-by: Michael Brunnbauer <https://github.com/michaelbrunnbauer >
Link: <https://git.zx2c4.com/linux-rng/tree/drivers/char/random.c#n535 >
Cc: "Jason A. Donenfeld" <Jason@zx2c4.com >
Link: <https://github.com/shadow-maint/shadow/pull/638 >
Link: <https://github.com/shadow-maint/shadow/issues/634 >
Link: <https://github.com/shadow-maint/shadow/pull/624 >
Tested-by: Michael Brunnbauer <https://github.com/michaelbrunnbauer >
Reviewed-by: Michael Brunnbauer <https://github.com/michaelbrunnbauer >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2024-06-20 21:38:58 -05:00
Alejandro Colomar
328958ca01
sizeof.h: Move sizeof()-related macros to their own header
...
Cc: Christian Göttsche <cgzones@googlemail.com >
Cc: Serge Hallyn <serge@hallyn.com >
Cc: Iker Pedrosa <ipedrosa@redhat.com >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-09-01 09:39:23 +02:00
Alejandro Colomar
093fb605f9
lib: Merge libmisc into libshadow
...
The separation was unnecessary, and caused build problems. Let's go
wild and obliterate the library. The files are moved to libshadow.
Scripted change:
$ find libmisc/ -type f \
| grep '\.[chy]$' \
| xargs mv -t lib;
Plus updating the Makefile and other references. While at it, I've
sorted the sources lists.
Link: <https://github.com/shadow-maint/shadow/pull/792 >
Reported-by: David Seifert <soap@gentoo.org >
Cc: Sam James <sam@gentoo.org >
Cc: Christian Bricart <christian@bricart.de >
Cc: Michael Vetter <jubalh@iodoru.org >
Cc: Robert Förster <Dessa@gmake.de >
[ soap tested the Gentoo package ]
Tested-by: David Seifert <soap@gentoo.org >
Acked-by: David Seifert <soap@gentoo.org >
Acked-by: Serge Hallyn <serge@hallyn.com >
Acked-by: Iker Pedrosa <ipedrosa@redhat.com >
Acked-by: <lslebodn@fedoraproject.org >
Signed-off-by: Alejandro Colomar <alx@kernel.org >
2023-08-31 08:55:26 +02:00