I'm very pleased to announce the release of our new website and documentation using the new toolchain with Hugo and AsciiDoctor. To get more information about the new toolchain please read the FreeBSD Documentation Project Primer[1], Hugo docs[2] and AsciiDoctor docs[3]. Acknowledgment: Benedict Reuschling <bcr@> Glen Barber <gjb@> Hiroki Sato <hrs@> Li-Wen Hsu <lwhsu@> Sean Chittenden <seanc@> The FreeBSD Foundation [1] https://docs.FreeBSD.org/en/books/fdp-primer/ [2] https://gohugo.io/documentation/ [3] https://docs.asciidoctor.org/home/ Approved by: doceng, core
49 lines
1.7 KiB
Diff
49 lines
1.7 KiB
Diff
Index: lib/libcrypt/crypt.c
|
|
===================================================================
|
|
--- lib/libcrypt/crypt.c (revision 273303)
|
|
+++ lib/libcrypt/crypt.c (working copy)
|
|
@@ -37,8 +37,13 @@ __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;
|
|
@@ -45,10 +50,6 @@ static const struct crypt_format {
|
|
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" },
|
|
@@ -55,6 +56,7 @@ static const struct crypt_format {
|
|
#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"
|