Commit Graph

79 Commits

Author SHA1 Message Date
joerg
09d5d44150 Add SHA224 implementation to libc.
Make libcrypto use the SHA2 implementation of libc.
Bump minor versions of libc and libcrypto.
2009-05-26 08:04:11 +00:00
joerg
51fed7bd6c Add missing .Os. 2009-03-10 13:21:52 +00:00
apb
6aae635b8d According to Alexander Bluhm in tech-toolchain on 31 Jan 2009, the way
these files use __weak_alias causes build failures under OpenBSD,
because the OpenBSD __weak_alias macro expects the caller to supply a
semicolon, but the NetBSD __weak_alias macro supplies its own semicolon.

Attempt to fix this by avoiding the use of __weak_alias during a tools
build.
2009-03-06 18:15:23 +00:00
lukem
4359ce3c5f sign-compare fix 2009-02-12 05:03:47 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
dholland
052fb4c32d Fix replicated typo 2008-04-13 02:04:31 +00:00
agc
08c311c029 More cleanup after sha2.h and rmd160.h moved house 2006-10-28 13:05:42 +00:00
christos
a3fadcee99 this moved to common/lib/libc/hash 2006-10-27 21:24:35 +00:00
drochner
50ea67a5eb As discussed back in June, remove hmac_sha1 and hmac_md5 from libc, to
reduce bloat and namespace trouble. (both were never public; hmac_sha1
is moved to libcrypt now because it is used locally there)
2006-10-27 18:29:21 +00:00
christos
b24124a73d static before const. 2006-10-15 16:11:04 +00:00
christos
e9b01fa061 Make these weak as Matthias Drochner pointed out. 2006-06-23 17:15:18 +00:00
mrg
52874db1aa since we rename and provide a weak symbol for MD2Transform make it non-static. 2006-05-12 02:49:00 +00:00
dogcow
86811edb37 change #include <sys/endian.h> => #include <machine/endian.h> so that
it's (more) consistent in the tree; this, along with changing tools/compat's
autoconf detection from AC_CHECK_FUNCS to AC_CHECK_DECLS makes the vast
majority of htobe16 and friends' redefinition errors bite the dust.
Tested with -current and FreeBSD.
2006-02-09 22:03:15 +00:00
perry
fd18408b9a u_intN_t -> uintN_t 2005-12-26 19:40:14 +00:00
christos
e5548b402a Use reach-over sources from common/lib/libc 2005-12-20 19:31:47 +00:00
christos
03256c6e55 WARNS=4 2005-11-29 03:11:58 +00:00
tron
d58b6064be SHA2 support appeared in NetBSD 3.0. 2005-11-22 10:12:23 +00:00
christos
eb01b7b0b4 Rename "hash.c" to "hashhl.c" since this is included from *hl.c files.
The name "hash.c" is already used in db/hash/hash.c, and having duplicated
names, aside from it being bad style, breaks the tools/nbcompat build
because it picks the wrong hash.c file. Thanks to greg for helping debug
this.
2005-09-28 16:31:45 +00:00
christos
6db303aa6b The weak alias macros can only work before namespace.h gets included because
when the strings get expanded we gain an _ from namespace.h. So define a
macro to point to the appropriate include file for the hash function, and
include the hash function later, from the .c file we always include. This
allows us to eliminate the hack of including namespace.h twice as well as
nbtool_config.h.
2005-09-26 03:01:41 +00:00
christos
8a17871865 Add missing SHA384_Transform. XXX: Is that correct? 2005-09-26 02:59:29 +00:00
elad
da7e4f7332 Fix weak aliasing after recent changes.
Inspired by comments from christos@, xtraeme@, mlelstv@, mhitch@, mrg@,
and uwe@; all the bugs are mine.
2005-09-25 22:20:59 +00:00
elad
c7f8eb7c46 Need namespace.h here too. 2005-09-24 22:09:07 +00:00
elad
b387889f76 Put public domain MD2 implementation in libc/hash/md2. 2005-09-24 20:51:14 +00:00
elad
b0efb83c3e Use crypto/rmd160.h. 2005-09-24 19:33:52 +00:00
elad
40a18454f9 Fix NetBSD CVS tag, put all code under #ifdef HASH_ALGORITHM. 2005-09-24 19:30:06 +00:00
elad
7e426d2f8a Need namespace.h. 2005-09-24 19:25:23 +00:00
elad
e9795d9851 Add man-pages forgotten in previous commit. 2005-09-24 19:07:00 +00:00
elad
767c8fdd86 Organize hashing in libc. 2005-09-24 19:04:52 +00:00
elad
feab3b262a Use common code from hash.c. 2005-09-24 18:49:18 +00:00
elad
d4e0b307f7 Add skeleton file for helper routines that will be used by MD2, MD4, MD5,
SHA1, SHA2, and RMD160.
2005-09-24 18:47:37 +00:00
elad
4b106eec1a Use RMD160 implementation by Markus Friedl, the same one we use in the
kernel.
2005-09-24 18:43:17 +00:00
wiz
f6da81bb3a Prefer
.In foo
to
	.Fd #include <foo>
Mark up NULL with .Dv.
Use \*[Am], \*[Lt] for HTML output.
Add missing commas in enumerations.
2005-09-10 22:06:45 +00:00
elad
6a616765e1 Include namespace.h to make this build in nbcompat. 2005-08-26 15:58:17 +00:00
tron
90e36a4775 Fix lint warnings. 2005-08-24 12:08:45 +00:00
elad
7d818e4714 Compile SHA2 again. 2005-08-23 17:49:50 +00:00
elad
d3e7b0bab8 We don't have SHA{256,384,512}_Pad, but we do have _Transform. 2005-08-23 17:49:27 +00:00
elad
ec1aee0b10 Add helper routines (end, filechunk, file, data) for SHA2. 2005-08-23 16:20:01 +00:00
elad
39ce11e146 Pass lint and make this compile.
Also change bcopy, bzero -> memcpy, memset.
2005-08-20 20:52:52 +00:00
elad
3dbf8d11de Not running lint on kernel code fooled me into thinking this was safe.
Don't compile SHA2 code until I resolve warnings.
2005-08-20 18:57:50 +00:00
elad
866f37de4e Add SHA2 hashing routines to userland.
At the moment there's only code for the init/transform/update/final
routines.

Man-page from OpenBSD.
2005-08-20 16:14:34 +00:00
lukem
88c3eadbfa Add missing __RCSID() 2005-06-12 05:21:25 +00:00
kleink
fd5cb0acea A little libc namespace housekeeping exercise:
* Make vfprintf_unlocked() an internal function, c.f. __svfscanf_unlocked().
* Add internal names for arc4random(), endnetpath(), fhstatvfs(),
  fstatvfs(), mkstemp(), shquote(), statvfs(), taddr2uaddr(), uaddr2taddr(),
  uuid_create_nil(), uuid_is_nil(), and wcwidth().
* Include namespace.h where supposed to.
2005-02-09 21:35:46 +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
lukem
171d653219 Overhaul how `build.sh tools' are used:
*	Rename "config.h" to "nbtool_config.h" and
	HAVE_CONFIG_H to HAVE_NBTOOL_CONFIG_H.
	This makes in more obvious in the source when we're using
	tools/compat/config.h versus "standard autoconf" config.h

    *	Consistently move the inclusion of nbtool_config.h to before
    	<sys/cdefs.h> so that the former can provide __RCSID() (et al),
    	and there's no need to protect those macros any more.

These changes should make it easier to "tool-ify" a program by adding:
	#if HAVE_NBTOOL_CONFIG_H
	#include "nbtool_config.h"
	#endif
to the top of the source files (for the general case).
2003-10-27 00:12:41 +00:00
martin
4df9d6555a Bring back previous sparc64 hack, but only #ifdef old gcc.
This is used when building libnbcompat for host tools - why it is included
when building on NetBSD is beyound me.
2003-09-21 17:15:36 +00:00
martin
55acdca8c5 No more sparc64 compiler workarounds 2003-09-19 16:30:31 +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
867416748b VAX, not vax. Igor Sobrado in PR 19678. 2003-03-30 21:01:58 +00:00
wiz
3225ede1d3 New sentence, new line. From Robert Elz. 2002-10-01 17:02:56 +00:00
bjh21
3eb7aa7171 In userland, use <sha1.h>, not <sys/sha1.h>. 2002-03-31 14:17:19 +00:00