[PATCH 0/5] simplify and improve crypt_make_salt()
Rasmus Villemoes
rasmus.villemoes at prevas.dk
Mon Apr 15 12:56:23 UTC 2024
Currently, crypt_make_salt() can only return 2^28 different salt
strings. There are some low-hanging fruits allowing us to reduce the
code size, and even with patch 5 which obviously by itself increases
the footprint, the combined result of these patches is
function old new delta
crypt_make_salt 104 95 -9
i64c 41 24 -17
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-26) Total: -26 bytes
while making sure (in the normal case where /dev/urandom is available)
that the salt string is completely random, and that we are not in any
case doing worse than what the current code does.
Rasmus Villemoes (5):
pw_encrypt.c: make i64c() slightly smaller
crypt_make_salt: cleanup leftover comments
crypt_make_salt(): simplify and improve
crypt_make_salt(): fixup odd calling convention
crypt_make_salt(): try to use actual random bytes for salt generation
include/libbb.h | 11 ++---------
libbb/pw_encrypt.c | 27 +++++++++++----------------
networking/httpd.c | 2 +-
3 files changed, 14 insertions(+), 26 deletions(-)
--
2.40.1.1.g1c60b9335d
More information about the busybox
mailing list