From 78ada6aa822d06d17462b9ac3606fa9bb1ad27b4 Mon Sep 17 00:00:00 2001 From: Tomas Halman Date: Jan 20 2023 12:08:08 +0000 Subject: Extend hash tests of blowfish and yescrypt New password hashes are available and used in various distributions. This patch add tests for blowfish and yescrypt --- diff --git a/tests/pwhash_test b/tests/pwhash_test index ff89d60..525885e 100755 --- a/tests/pwhash_test +++ b/tests/pwhash_test @@ -78,6 +78,22 @@ if [ "x${pw#\$6\$}" = "x$pw" ]; then fi cp "${LIBUSER_CONF}_" "$LIBUSER_CONF" +echo 'crypt_style = blowfish' >> "$LIBUSER_CONF" +pw=$(workdir="$workdir" $VALGRIND $PYTHON "$srcdir"/pwhash.py) +if [ "x${pw#\$2b\$}" = "x$pw" ]; then + echo "Invalid BLOWFISH hash" >&2 + exit 1 +fi + +cp "${LIBUSER_CONF}_" "$LIBUSER_CONF" +echo 'crypt_style = yescrypt' >> "$LIBUSER_CONF" +pw=$(workdir="$workdir" $VALGRIND $PYTHON "$srcdir"/pwhash.py) +if [ "x${pw#\$y\$}" = "x$pw" ]; then + echo "Invalid YESCRYPT hash" >&2 + exit 1 +fi + +cp "${LIBUSER_CONF}_" "$LIBUSER_CONF" cat >> "$LIBUSER_CONF" <<\EOF crypt_style = sha256 hash_rounds_min = 4242