diff options
author | markm <markm@FreeBSD.org> | 2001-03-11 16:05:43 +0000 |
---|---|---|
committer | markm <markm@FreeBSD.org> | 2001-03-11 16:05:43 +0000 |
commit | 10da32144618e3bcc873be353d69670aff7c3534 (patch) | |
tree | 6cf8481c0eae7ed5de2122e23b4dcaa84a01088b /lib/libcrypt | |
parent | 9695e56e6ca3397d424c5a2b13ce6c65379d11ba (diff) | |
download | FreeBSD-src-10da32144618e3bcc873be353d69670aff7c3534.zip FreeBSD-src-10da32144618e3bcc873be353d69670aff7c3534.tar.gz |
Add OpenBSD-style blowfish password hashing. This makes one less
gratuitous difference between us and our sister project.
This was given to me _ages_ ago. May apologies to Paul for the length
of time its taken me to commit.
Obtained from: Niels Provos <provos@physnet.uni-hamburg.de>/OpenBSD
Submitted by: Paul Herman <pherman@frenchfries.net>
Diffstat (limited to 'lib/libcrypt')
-rw-r--r-- | lib/libcrypt/Makefile | 4 | ||||
-rw-r--r-- | lib/libcrypt/crypt.3 | 18 | ||||
-rw-r--r-- | lib/libcrypt/crypt.c | 7 | ||||
-rw-r--r-- | lib/libcrypt/crypt.h | 1 |
4 files changed, 23 insertions, 7 deletions
diff --git a/lib/libcrypt/Makefile b/lib/libcrypt/Makefile index 55e76d3..a91c5eb 100644 --- a/lib/libcrypt/Makefile +++ b/lib/libcrypt/Makefile @@ -15,8 +15,8 @@ CFLAGS+= -DLIBC_SCCS -Wall .if exists(${.CURDIR}/../../secure/lib/libcrypt/crypt-des.c) && \ !defined(NOSECURE) && !defined(NOCRYPT) .PATH: ${.CURDIR}/../../secure/lib/libcrypt -SRCS+= crypt-des.c -CFLAGS+= -I${.CURDIR} -DHAS_DES +SRCS+= crypt-des.c crypt-blowfish.c blowfish.c +CFLAGS+= -I${.CURDIR} -DHAS_DES -DHAS_BLOWFISH .endif # And the auth_getval() code and support. .PATH: ${.CURDIR}/../libutil diff --git a/lib/libcrypt/crypt.3 b/lib/libcrypt/crypt.3 index b6ee8ff..facbcee 100644 --- a/lib/libcrypt/crypt.3 +++ b/lib/libcrypt/crypt.3 @@ -61,11 +61,14 @@ in the hash. Currently these include the .Tn NBS .Tn Data Encryption Standard (DES) , +.Tn MD5 and -.Tn MD5 . +.Tn Blowfish . The algorithm used will depend upon the format of the Salt (following the Modular Crypt Format (MCF)), if .Tn DES +and/or +.Tn Blowfish is installed or not, and whether .Fn crypt_set_format has been called to change the default. @@ -171,8 +174,10 @@ to 16 characters--because the length of the returned output is also limited Currently supported algorithms are: .Pp .Bl -enum -compact -offset indent -.It +.It 1 MD5 +.It 2a +Blowfish .El .Pp Other crypt formats may be easilly added. An example salt would be: @@ -207,7 +212,8 @@ Valid values are .\" .\" NOTICE: Also make sure to update this, too, as well .\" -.Ql des +.Ql des , +.Ql blf and .Ql md5 . .Pp @@ -273,6 +279,8 @@ Originally written by later additions and changes by .An Poul-Henning Kamp , .An Mark R V Murray , -.An Kris Kennaway +.An Kris Kennaway , +.An Brian Feldman , +.An Paul Herman and -.An Brian Feldman . +.An Niels Provos . diff --git a/lib/libcrypt/crypt.c b/lib/libcrypt/crypt.c index 6f2846d..0d4c881 100644 --- a/lib/libcrypt/crypt.c +++ b/lib/libcrypt/crypt.c @@ -54,6 +54,13 @@ static const struct { crypt_md5, "$1$" }, +#ifdef HAS_BLOWFISH + { + "blf", + crypt_blowfish, + "$2" + }, +#endif { NULL, NULL diff --git a/lib/libcrypt/crypt.h b/lib/libcrypt/crypt.h index 3544f89..b62bd8e 100644 --- a/lib/libcrypt/crypt.h +++ b/lib/libcrypt/crypt.h @@ -32,6 +32,7 @@ char *crypt_des(const char *pw, const char *salt); char *crypt_md5(const char *pw, const char *salt); +char *crypt_blowfish(const char *pw, const char *salt); extern void _crypt_to64(char *s, unsigned long v, int n); |