From db836cfc04da8b5e2f4a4fa65f9b72062277eff0 Mon Sep 17 00:00:00 2001 From: ngie Date: Mon, 18 Aug 2014 17:35:39 +0000 Subject: Add LIBCRYPT to DPADD, remove LDFLAGS from LDADD, and sort the Makefile variables This fixes "make checkdpadd" Phabric: D620 Approved by: jmmv (mentor) PR: 192729 MFC after: 5 days --- lib/libcrypt/tests/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/libcrypt') diff --git a/lib/libcrypt/tests/Makefile b/lib/libcrypt/tests/Makefile index 2a0f1fb..20993e2 100644 --- a/lib/libcrypt/tests/Makefile +++ b/lib/libcrypt/tests/Makefile @@ -7,6 +7,7 @@ TESTSDIR= ${TESTSBASE}/lib/libcrypt ATF_TESTS_C= crypt_tests CFLAGS+= -I${.CURDIR:H} -LDADD+= -L${.OBJDIR:H} -lcrypt +DPADD+= ${LIBCRYPT} +LDADD+= -lcrypt .include -- cgit v1.1 From 23d266ef7602d0fb648b92d80a23f0ba8fd190c9 Mon Sep 17 00:00:00 2001 From: des Date: Thu, 9 Oct 2014 16:45:11 +0000 Subject: Change the hardcoded default back from SHA512 to DES. PR: 192277 MFC after: 3 days --- lib/libcrypt/crypt.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'lib/libcrypt') diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index c3ca4c2..623809e 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -37,24 +37,26 @@ __FBSDID("$FreeBSD$"); #include "crypt.h" /* - * List of supported crypt(3) formats. The first element in the list will - * be the default. + * List of supported crypt(3) formats. + * + * The default algorithm is the last entry in the list (second-to-last + * array element since the last is a sentinel). The reason for placing + * the default last rather than first is that DES needs to be at the + * bottom for the algorithm guessing logic in crypt(3) to work correctly, + * and it needs to be the default for backward compatibility. */ static const struct crypt_format { const char *const name; char *(*const func)(const char *, const char *); const char *const magic; } crypt_formats[] = { - /* default format */ - { "sha512", crypt_sha512, "$6$" }, - - /* other supported formats */ { "md5", crypt_md5, "$1$" }, #ifdef HAS_BLOWFISH { "blf", crypt_blowfish, "$2" }, #endif { "nth", crypt_nthash, "$3$" }, { "sha256", crypt_sha256, "$5$" }, + { "sha512", crypt_sha512, "$6$" }, #ifdef HAS_DES { "des", crypt_des, "_" }, #endif @@ -63,7 +65,8 @@ static const struct crypt_format { { NULL, NULL, NULL } }; -static const struct crypt_format *crypt_format = &crypt_formats[0]; +static const struct crypt_format *crypt_format = + &crypt_formats[(sizeof crypt_formats / sizeof *crypt_formats) - 2]; #define DES_SALT_ALPHABET \ "./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz" -- cgit v1.1