]> git.ipfire.org Git - thirdparty/shadow.git/commit
libmisc: fix default value in SHA_get_salt_rounds() 400/head
authorMike Gilbert <floppym@gentoo.org>
Sat, 14 Aug 2021 17:24:34 +0000 (13:24 -0400)
committerMike Gilbert <floppym@gentoo.org>
Sat, 14 Aug 2021 17:43:26 +0000 (13:43 -0400)
commit234e8fa7b134d1ebabfdad980a3ae5b63c046c62
treec4ea39a8c3fffba7045eeece776f785916817e1d
parentc4539fc4f9e23874ce1cdd7265fb28d5a44e49eb
libmisc: fix default value in SHA_get_salt_rounds()

If SHA_CRYPT_MIN_ROUNDS and SHA_CRYPT_MAX_ROUNDS are both unspecified,
use SHA_ROUNDS_DEFAULT.

Previously, the code fell through, calling shadow_random(-1, -1). This
ultimately set rounds = (unsigned long) -1, which ends up being a very
large number! This then got capped to SHA_ROUNDS_MAX later in the
function.

The new behavior matches BCRYPT_get_salt_rounds().

Bug: https://bugs.gentoo.org/808195
Fixes: https://github.com/shadow-maint/shadow/issues/393
libmisc/salt.c