Commit Graph

88 Commits

Author SHA1 Message Date
drochner ccdea5df98 -fix maximum length of salt (missing prefix, rounding error)
-clip number of rounds at 31 -- this is log2 of the real number,
 and anything larger would break exponentation
-catch possible atoi() error where log2(rounds) is parsed in the
 salt prefix
-zero crypto state on exit
from Open/FreeBSD
2011-05-16 10:45:56 +00:00
drochner 9c09925b41 fix ipad/opad buffer length (was one too much), just for sanity 2011-05-16 10:39:12 +00:00
drochner e7c5804ca9 rearrange variable usage to kill __UNCONST
reviewed by sjg
2011-05-09 19:15:28 +00:00
perry 591534100f ANSI function prototypes 2009-05-01 00:28:17 +00:00
perry b34e9d9fea de-__P 2009-05-01 00:20:08 +00:00
lukem a06595c27b fix -Wsign-compare issues 2009-01-18 12:14:16 +00:00
christos 46edb91e9f bump shared libraries. 2009-01-11 03:07:47 +00:00
gmcgarry 3c9a95916d Wrap compiler-specific flags with HAVE_GCC and HAVE_PCC as necessary. Add a few flags for PCC. 2008-08-29 00:02:21 +00:00
gmcgarry 686556951e Add test for HAVE_PCC with HAVE_GCC which turn off compiler warning flags. 2008-07-12 12:29:42 +00:00
hubertf 55ac93d329 Remove more duplicate #includes, and a few spurious whitespaces at EOL
From Slava Semushin <slava.semushin@gmail.com>
2007-01-17 23:24:22 +00:00
freza 782d524f80 Constify prtab() argument, fixes MKDEBUGLIB build. 2006-11-25 17:55:48 +00:00
drochner 65b9988ba4 gently add some "const", and avoid some casts
compiles with WARNS=4 now (on i386 and alpha)
2006-10-27 19:39:11 +00:00
drochner d16ceb033e As discussed back in June, move the implementation of hmac_sha1 here
because this is not a public function and crypt-sha1.c is the only
place where it is used (It must have been that way formerly, because
there was a stale prototype in crypt.h all the time.)
Being here, do some RCSID and prototype cleanup, and add as much "const"
as needed to compile these files with WARNS=3.
2006-10-27 18:22:56 +00:00
mlelstv 999ac788ac don't segfault on NULL pointer if number of rounds is
not specified in passwd.conf.
2006-10-24 22:49:19 +00:00
mrg aadd7d4847 sprinkle some -fno-strict-aliasing and -Wno-pointer-sign with GCC4. 2006-05-11 23:16:28 +00:00
christos a0d45c2607 Need stdio.h if debug. 2006-04-08 23:24:44 +00:00
perry 4e11af46bc Remove leading __ from __(const|inline|signed|volatile) -- it is obsolete. 2005-12-24 21:11:15 +00:00
hubertf 105b456cb7 Mention pwhash(1) in a few places,
suggested in PR 31125 by Stefan Schumacher.
2005-09-05 03:37:14 +00:00
drochner 27a681b048 salt is in the second argument 2005-08-16 10:10:16 +00:00
christos d1ac9947b2 fix compile issue. 2005-01-12 05:27:48 +00:00
christos d205f30a4b fix compile issue and de-lint 2005-01-12 05:27:35 +00:00
christos 3131ddcccc - change the gensalt functions to take an optional string instead of
the number of rounds.
- make pw_gensalt() more generic, so that it does not depend in libutil.
2005-01-12 03:32:52 +00:00
christos 6252af1a9f sprinkle ARGSUSED and include "crypt.h" 2005-01-11 23:21:31 +00:00
christos b181dae89f only get the rounds if we have them. 2005-01-11 23:02:30 +00:00
christos 7724b89cd5 add local prototype for old salt function 2005-01-11 23:02:16 +00:00
christos 8cfd209e8e Add pw_gensalt, which was taken from pwd_gensalt. This now is used in 3
places, so it might as well be part of libcrypt.
2005-01-11 22:41:07 +00:00
christos 21356b2c66 use the standard __UNCONST 2005-01-11 22:40:22 +00:00
christos 0fc4f2b291 - remove local UNCONST
- add new __gensalt functions
2005-01-11 22:40:00 +00:00
christos 2c53ed1484 Write __gensalt_blowfish function that does not use static storage and
can return an error. Make the old bcrypt_gensalt() function use that.
XXX: should gc bcrypt_gensalt(). What uses it?
2005-01-11 22:39:21 +00:00
sjg 3a0c68edfd Add support for SHA1 hashed passwords.
The algorithm used is essentially PBKDF1 from RFC 2898 but using
hmac_sha1 rather than SHA1 directly (suggested by smb@research.att.com).

 * The format of the encrypted password is:
 * $<tag>$<iterations>$<salt>$<digest>
 *
 * where:
 *      <tag>           is "sha1"
 *      <iterations>    is an unsigned int identifying how many rounds
 *                      have been applied to <digest>.  The number
 *                      should vary slightly for each password to make
 *                      it harder to generate a dictionary of
 *                      pre-computed hashes.  See crypt_sha1_iterations.
 *      <salt>          up to 64 bytes of random data, 8 bytes is
 *                      currently considered more than enough.
 *      <digest>        the hashed password.

hmac.c implementes HMAC as defined in RFC 2104 and includes a unit
test for both hmac_sha1 and hmac_sha1 using a selection of the Known
Answer Tests from RFC 2202.

It is worth noting that to be FIPS compliant the hmac key (password)
should be 10-20 chars.
2004-07-02 00:05:23 +00:00
uebayasi 12db5f3635 Remove a superfluous .sp in the SEE ALSO section. 2004-06-10 13:53:48 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
jdolecek d7d75e0646 make the read-only arrays const 2003-08-06 08:44:22 +00:00
jdolecek 9caa6d5440 make itoa64[] const 2003-08-06 08:37:19 +00:00
jdolecek b91cb5be6c add __RCSID() 2003-08-06 08:34:32 +00:00
itojun fcfc71fca0 use strlcat 2003-07-14 12:37:13 +00:00
thorpej 90099f5fe1 hrink the Blowfish routines down to only what we need for __bcrypt(),
and don't export any of the Blowfish functionality outside bcrypt.c.
2003-04-17 00:31:04 +00:00
thorpej d1bb0be3e8 If libcrypto is defined, use the MD5 routines from libcrypto, rather
than from libc.
2003-04-17 00:29:43 +00:00
wiz 472351e13d Use
.In header.h
instead of
.Fd #include \*[Lt]header.h\*[Gt]
Much easier to read and write, and supported by groff for ages.
Okayed by ross.
2003-04-16 13:34:34 +00:00
wiz 4f92a4853d New sentence, new line. From Robert Elz. 2002-10-01 19:38:46 +00:00
lukem ec5dbc56b8 Explicitly move setting of NOxxx and USE_SHLIBDIR to the top of the
Makefile (before including <bsd.own.mk>)
2002-08-19 14:55:14 +00:00
itojun caecca980a crank minor for bcrypt support 2002-05-24 04:07:05 +00:00
itojun c89c003ed2 support bcrypt password. can be chosen by "blowfish" keyword in passwd.conf.
from openbsd
2002-05-24 04:02:47 +00:00
wiz 0a2f7411a3 Change Nd argument to 'password encryption', since it does not only provide
DES support. Noted by Jeremy C. Reed.
2002-04-17 18:17:58 +00:00
wiz a6876a2a4e Punctuation nits. 2002-02-20 11:56:13 +00:00
ross 814f296b77 Generate <>& symbolically. 2002-02-07 07:00:09 +00:00
wiz 854cba8fda Whitespace nits, drop unnecessary .Pps. 2002-01-15 02:40:05 +00:00
lukem efcc9a4c9d * Add user-controlled mk.conf variables
- SHLIBDIR	Location to install shared libraries if ${USE_SHLIBDIR}
			is "yes".  Defaults to "/usr/lib".

	- USE_SHLIBDIR	If "yes", install shared libraries in ${SHLIBDIR}
			instead of ${LIBDIR}.  Defaults to "no".
			Sets ${_LIBSODIR} to the appropriate value.
			This may be set by individual Makefiles as well.

	- SHLINKDIR	Location of shared linker.  Defaults to "/usr/libexec".
			If != "/usr/libexec", change the dynamic-linker
			encoded in shared programs

* Set USE_SHLIBDIR for libraries used by /bin and /sbin:
	libc libcrypt libcrypto libedit libipsec libkvm libm libmi387
	libtermcap libutil libz

* If ${_LIBSODIR} != ${LIBDIR}, add symlinks from ${LIBDIR}/${LIB}.so*
  to ${_LIBSODIR}/${LIB}.so* for compatibility.

* Always install /sbin/init statically (for now)


The net effect of these changes depends on how the variables are set:

  1.)	If nothing is set or changed, there is no change from the
	current behaviour:
		- Static /bin, /sbin, and bits of /usr/*
		- Dynamic rest
		- Shared linker is /usr/libexec/ld*so

  2.)	If the following make variables are set:
		LDSTATIC=
		SHLINKDIR=/lib
		SHLIBDIR=/lib
	Then the behaviour becomes:
		- Dynamic tools
		- .so libraries used by /bin and /sbin are installed to /lib,
		  with symlinks from /usr/lib/lib*so to -> /lib/lib*so
		  where appropriate
		- Shared linker is /lib/ld*so

  3.)	As per 2.), but add the following variable:
		USE_SHLIBDIR=yes
	This forces all .so's to be instaleld in /lib (with compat
	symlinks), not just those tagged by their Makefiles to be.
	Again, compat symlinks are installed
2001-12-28 01:32:37 +00:00
ad e5afda7b98 Ensure that the salt is always terminated properly with '$'. Makes Cyrus'
pwcheck (which either modifies the buffer or was passing bad password
strings) happy. Noted by Cillian Sharkey <cns@redbrick.dcu.ie>.
2001-09-10 12:33:25 +00:00
wiz ddb7e7aa53 Four casts for lint. 2001-03-01 14:37:35 +00:00