summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config.h5
-rw-r--r--mkpasswd.c19
2 files changed, 22 insertions, 2 deletions
diff --git a/config.h b/config.h
index 16524e3..19224f8 100644
--- a/config.h
+++ b/config.h
@@ -40,6 +40,7 @@
#if defined __APPLE__ && defined __MACH__
# define HAVE_GETOPT_LONG
# define HAVE_GETADDRINFO
+# define HAVE_BSDICRYPT
#endif
#if defined __GLIBC__
@@ -58,6 +59,10 @@
# define HAVE_BCRYPT
#endif
+#if defined OpenBSD || defined __FreeBSD__ || defined __NetBSD__
+# define HAVE_BSDICRYPT
+#endif
+
/* Unknown versions of Solaris */
#if defined __SVR4 && defined __sun
# define HAVE_SHA_CRYPT
diff --git a/mkpasswd.c b/mkpasswd.c
index 78bef2d..b2a4b95 100644
--- a/mkpasswd.c
+++ b/mkpasswd.c
@@ -81,6 +81,13 @@ struct crypt_method {
const char *desc; /* long description for the methods list */
};
+/* XCRYPT_VERSION_NUM is defined in crypt.h from libxcrypt */
+#if defined XCRYPT_VERSION_NUM
+# define HAVE_SHA_CRYPT
+# define HAVE_BCRYPT
+# define HAVE_BSDICRYPT
+#endif
+
static const struct crypt_method methods[] = {
/* method prefix minlen, maxlen rounds description */
#ifdef CRYPT_GENSALT_IMPLEMENTS_DEFAULT_PREFIX
@@ -89,6 +96,10 @@ static const struct crypt_method methods[] = {
/* compatibility aliases for mkpasswd versions < 5.4.0 */
{ "des", "", 2, 2, 0, NULL },
{ "md5", "$1$", 8, 8, 0, NULL },
+#if defined XCRYPT_VERSION_NUM
+ { "yescrypt", "$y$", 0, 0, 0, "Yescrypt" },
+ { "scrypt", "$7$", 0, 0, 0, "scrypt" },
+#endif
#ifdef HAVE_BCRYPT_OBSOLETE
/* http://marc.info/?l=openbsd-misc&m=139320023202696 */
{ "bf", "$2a$", 22, 22, 2, "bcrypt" },
@@ -105,13 +116,17 @@ static const struct crypt_method methods[] = {
{ "sha-256", "$5$", 8, 16, 1, NULL },
{ "sha-512", "$6$", 8, 16, 1, NULL },
#endif
-#if defined __SVR4 && defined __sun
+#if (defined __SVR4 && defined __sun) || defined XCRYPT_VERSION_NUM
{ "sunmd5", "$md5$", 8, 8, 1, "SunMD5" },
#endif
{ "md5crypt", "$1$", 8, 8, 0, "MD5" },
+#ifdef HAVE_BSDICRYPT
+ { "bsdicrypt", "_", 0, 0, 0,
+ N_("BSDI extended DES-based crypt(3)") },
+#endif
{ "descrypt", "", 2, 2, 0,
N_("standard 56 bit DES-based crypt(3)") },
-#if defined FreeBSD
+#if defined FreeBSD || defined XCRYPT_VERSION_NUM
{ "nt", "$3$", 0, 0, 0, "NT-Hash" },
#endif
/* http://www.crypticide.com/dropsafe/article/1389 */