Commit Graph

171 Commits

Author SHA1 Message Date
Thomas Quinot
2dd0a89c26 Unbreak MIPS build following rev. 282726
Introduce further adjustments to the renaming of libmd
symbols: make sure that we do not generate dangling weak
aliases, as this causes build failures on MIPS.

Tested by:	sbruno
2015-05-11 16:45:33 +00:00
Thomas Quinot
55b130956d Unbreak build following rev. 282726
(Makefile.inc1): add dependency of xinstall on libmd to
avoid failure of parallel bootstrap.

(lib/libmd/*.h): do not redefine symbols if already
defined as macros (libcrypt uses the same sources internally,
redefining symbols with a prefix of its own).

Fixes build failures caused by previous change to libmd.

Reported by: ian
Pointy hat to: thomas
2015-05-10 21:21:52 +00:00
Thomas Quinot
9d8b66868a Ensure libmd symbols do not clash with libcrypto
Add a prefix to all symbols in libmd to avoid incompatibilites
with same-named, but not binary compatible, symbols from libcrypto.

Also introduce Weak aliases to avoid the need to rebuild dependent
binaries and a major version bump.

PR:		199119
Differential Revision:	D2216
Reviewed by:	roberto, delphij
MFC after:	2 weeks
2015-05-10 13:21:36 +00:00
Enji Cooper
6eec0f2bda Avoid an infinite loop by ensuring that the amount of bytes read is greater
than 0 in MDXFileChunk when calculating the checksum

This edgecase can be triggered if the file is truncated while the checksum
is being calculated (i.e. the EOF is reached)

Differential Revision: https://reviews.freebsd.org/D2351 (patch by darius)
PR: 196694
Reviewed by: delphij, ngie
Submitted by: Daniel O'Connor <darius@dons.net.au>
Sponsored by: EMC / Isilon Storage Division
2015-04-24 11:03:47 +00:00
Ed Maste
294246bb7d Revert r274772: it is not valid on MIPS
Reported by:	sbruno
2014-11-25 03:50:31 +00:00
Ed Maste
688fd61ae8 Use canonical __PIC__ flag
It is automatically set when -fPIC is passed to the compiler.

Reviewed by:	dim, kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D1179
2014-11-21 02:05:48 +00:00
Simon J. Gerraty
ee7b0571c2 Merge head from 7/28 2014-08-19 06:50:54 +00:00
Baptiste Daroussin
2b7af31cf5 use .Mt to mark up email addresses consistently (part3)
PR:		191174
Submitted by:	Franco Fichtner  <franco at lastsummer.de>
2014-06-23 08:23:05 +00:00
Simon J. Gerraty
fae50821ae Updated dependencies 2014-05-16 14:09:51 +00:00
Simon J. Gerraty
76b28ad6ab Updated dependencies 2014-05-10 05:16:28 +00:00
Simon J. Gerraty
3b8f084595 Merge head 2014-04-28 07:50:45 +00:00
Glen Barber
9180554666 Dereference nonexistent md2(3) manual.
MFC after:	3 days
Sponsored by:	The FreeBSD Foundation
2014-03-28 04:19:06 +00:00
John-Mark Gurney
8083f14fc2 replace the kernel's version w/ cperciva's implementation... In all
my tests, it is faster ~20%, even on an old IXP425 533MHz it is ~45%
faster...  This is partly due to loop unrolling, so the code size does
significantly increase...  I do plan on committing a version that
rolls up the loops again for smaller code size for embedded systems
where size is more important than absolute performance (it'll save ~6k
code)...

The kernel implementation is now shared w/ userland's libcrypt and
libmd...

We drop support for sha256 from sha2.c, so now sha2.c only contains
sha384 and sha512...

Reviewed by:	secteam@
2014-03-16 01:43:23 +00:00
John-Mark Gurney
fd9e2c6a4a use a real uint64_t instead of writing code to emulate one..
I verified w/ a:
dd if=/dev/zero bs=1m count=5000 | sha256
a33351fafd00e4c4bcdee2a1c5d019026500f8cdfeaf91a9b8dbbb2619429659

Reviewed by:	cperciva
MFC after:	1 week
2014-01-11 20:49:22 +00:00
Simon J. Gerraty
7cf3a1c6b2 Updated dependencies 2013-03-11 17:21:52 +00:00
Simon J. Gerraty
f5f7c05209 Updated dependencies 2013-02-16 01:23:54 +00:00
Simon J. Gerraty
7cd2dcf076 Updated/new Makefile.depend 2012-11-08 21:24:17 +00:00
Marcel Moolenaar
7750ad47a9 Sync FreeBSD's bmake branch with Juniper's internal bmake branch.
Requested by: Simon Gerraty <sjg@juniper.net>
2012-08-22 19:25:57 +00:00
David E. O'Brien
9b9c301802 Remove the RFC 1319 MD2 Message-Digest Algorithm routines from libmd.
1. The licensing terms for the MD2 routines from RFC is not under a BSD-like
   license.  Instead it is only granted for non-commercial Internet
   Privacy-Enhanced Mail.
2. MD2 is quite deprecated as it is no longer considered a cryptographically
   strong algorithm.

Discussed with:	so (cperciva), core
2012-04-28 02:48:51 +00:00
Colin Percival
02d98cd4da Rewrite HISTORY: The SHA256 code first appeared in 6.0, and the SHA512
code in 9.0; neither existed in FreeBSD 4.0.
2011-06-27 02:10:10 +00:00
Mark Murray
3b50f6bf83 Add SHA512 (Actually, this is Colin Percival's code for SHA256, with
relevant constants changed).

While I'm here clean up the tests and Makefile.

PR:		misc/124164
Submitted by:	KIMURA Yasuhiro < yasu utahime org >
MFC after:	1 month
2011-04-09 13:56:29 +00:00
Dimitry Andric
152e60f2fe Fix some leftover binaries and shared libraries in the system that still
have an executable stack, due to linking in hand-assembled .S or .s
files, that have no .GNU-stack sections:

RWX --- ---  /lib/libcrypto.so.6
RWX --- ---  /lib/libmd.so.5
RWX --- ---  /lib/libz.so.6
RWX --- ---  /lib/libzpool.so.2
RWX --- ---  /usr/lib/liblzma.so.5

These were found using scanelf, from the sysutils/pax-utils port.

Reviewed by:	kib
2011-02-15 22:03:09 +00:00
Ed Schouten
daaf575910 Build lib/ with WARNS=6 by default.
Similar to libexec/, do the same with lib/. Make WARNS=6 the norm and
lower it when needed.

I'm setting WARNS?=0 for secure/. It seems secure/ includes the
Makefile.inc provided by lib/. I'm not going to touch that directory.
Most of the code there is contributed anyway.
2010-01-02 09:58:07 +00:00
Poul-Henning Kamp
2eecaf226b Remove reference to no longer existing document.
Spotted by:	Bjoern Voigt <bjoern@cs.tu-berlin.de>
2009-01-09 11:45:13 +00:00
Poul-Henning Kamp
8372089626 Make the "test" target test the compiled version, instead of the
installed version of the md library.
2008-12-02 19:49:41 +00:00
Colin Percival
23f6784297 Use unsigned comparisons. Prior to this commit, SHA1_Update and
RIPEMD160_Update were broken when all of the following conditions
applied:
(1) The platform is i386.
(2) The program calling *_Update is statically linked to libmd.
(3) The buffer provided to *_Update is aligned modulo 4 bytes.
(4) The buffer extends beyond 2GB.

Due to the design of this code, SHA1_Update and RIPEMD160_Update will
still be broken if conditions (1)-(3) apply AND the buffer extends
beyond 4GB (i.e., there is an integer overflow in computing "data + len").
Since this remaining bug simply replaces SIGSEGV with a bogus hash (and
non-broken programs should never provide such operands) I don't consider
it to be a serious problem.

MFC After:      1 week
PR:             kern/102795
2007-05-14 05:00:37 +00:00
Poul-Henning Kamp
25a14196dd Fix an 11 year old mistake: Let the hash functions take a void* instead
of unsigned char* argument.
2006-01-17 15:35:57 +00:00
Ruslan Ermilov
110e1704d3 -mdoc sweep. 2005-11-17 13:00:00 +00:00
Pawel Jakub Dawidek
febd1f4df1 Correct type.
OK'ed by:	cperciva
2005-09-14 10:42:51 +00:00
Ruslan Ermilov
2d641ab1ec Removed redundnt empty line.
Approved by:	re (blanket)
2005-06-16 21:53:41 +00:00
Ruslan Ermilov
48856b0042 Markup fixes.
Approved by:	re
2005-06-16 19:01:07 +00:00
Colin Percival
186c183c23 In light of the recent 2^69 operation collision-finding attack on SHA1,
add support for SHA256.

Tested on:	i386, sparc64
Tested using:	NIST test vectors, built-in tests
X-MFC-after:	5.4-RELEASE
2005-03-09 19:23:04 +00:00
Colin Percival
c7981eaee3 The third parameter to SHA_Update and SHA1_Update is a "size_t", not a
"unsigned int".
2005-03-09 16:22:21 +00:00
Ruslan Ermilov
423ac68026 Expand contractions. 2005-02-15 09:27:00 +00:00
Ruslan Ermilov
0227791b40 Expand *n't contractions. 2005-02-13 22:25:33 +00:00
Ruslan Ermilov
24a0682c64 Sort sections. 2005-01-20 09:17:07 +00:00
Ruslan Ermilov
30950a21e1 Eliminate double whitespace. 2004-07-03 22:30:10 +00:00
Bruce Evans
5c3a55dea7 Backed out rev.1.6 and subsequent copying of it (bogus addition of
-static to CFLAGS).  It just turned rev.1.5 into an obfuscated no-op.
As explained in the log for rev.1.5, testing should be done in the
host environment but there is a problem in cross-compilation environments.
As not explained in the log for rev.1.6, there was apparently a practical
problem with cross-compiling (makeworld should have set -static in
LDFLAGS but apparently didn't).  Cross-compilation was especially
complicated because the relevant programs are test programs that were
run at beforeinstall time -- dynamic libraries might or might not exist
depending on the build options.  The complications became moot in
rev.1.8 when beforeinstall was renamed "test".
2004-02-26 07:44:37 +00:00
Hiten Pandya
dc2af37d96 Assorted mdoc(7) fixes:
- fix hard sentence breaks
	- sprinkle a few .Vt's where neccessary
	- remove incorrect use of `\-'
	- proper quoting using .Dq, instead of manual ``...''

Approved by:	des@ (mentor)
Reviewed by:	ru@
2003-10-09 23:06:06 +00:00
David E. O'Brien
4f4a104ee8 style.Makefile(5) 2003-08-18 15:25:39 +00:00
Gordon Tetlow
41d8423f71 Stage 3 of dynamic root support. Make all the libraries needed to run
binaries in /bin and /sbin installed in /lib. Only the versioned files
reside in /lib, the .so symlink continues to live /usr/lib so the
toolchain doesn't need to be modified.
2003-08-17 08:28:46 +00:00
Mark Murray
f2017a1921 Rename local variables to not mask global names of same name. This
fixes lots of lint(1) warnings.
2003-06-05 13:17:32 +00:00
Philippe Charnier
0552350ecc The .Fn function 2003-03-24 16:02:05 +00:00
Peter Wemm
66422f5b7a Initiate deorbit burn for the i386-only a.out related support. Moves are
under way to move the remnants of the a.out toolchain to ports.  As the
comment in src/Makefile said, this stuff is deprecated and one should not
expect this to remain beyond 4.0-REL.  It has already lasted WAY beyond
that.

Notable exceptions:
gcc - I have not touched the a.out generation stuff there.
ldd/ldconfig - still have some code to interface with a.out rtld.
old as/ld/etc - I have not removed these yet, pending their move to ports.
some includes - necessary for ldd/ldconfig for now.

Tested on: i386 (extensively), alpha
2002-09-17 01:49:00 +00:00
Poul-Henning Kamp
c64685aa58 Get this file closer to style(9). 2002-09-08 15:10:04 +00:00
Bruce A. Mah
2ca720053b Fix a bug where calling MD5File(3) with a zero-length file generated an
error, due to an uninitialized variable.

Reviewed by:	phk, archie
2002-09-06 19:51:58 +00:00
Maxime Henrion
f6a3055159 Add missing const's. 2002-06-24 13:52:26 +00:00
Poul-Henning Kamp
af03a3cbd6 Improve the handling of Encode and Decode operations in MD5.
Use memcpy for all little-endian architectures, sys/kern/md5c.c indicates
this should be safe for all currently supported LE archs.

Change the Encode and Decode functions for other archs to use le32toh()
and htole32() functions instead of explicit byte shuffling.

On sparc64 this gives md5(1) about 8% speed increase.
2002-06-22 12:54:11 +00:00
Ruslan Ermilov
11c456c0be Don't build manuals at inappropriate time.
Collapse generation of md[245].3 manpages.
2002-04-10 17:01:55 +00:00
Poul-Henning Kamp
42c159fe38 Modernize my email address. 2002-03-25 14:12:49 +00:00
Poul-Henning Kamp
aaead0dfe9 Modernize my email address. 2002-03-25 13:52:45 +00:00
David E. O'Brien
69160b1eb7 Remove __P() usage. 2002-03-21 23:54:04 +00:00
David E. O'Brien
be04b6d190 Remove 'register' keyword. 2002-03-21 23:39:28 +00:00
Ruslan Ermilov
32eef9aeb1 mdoc(7) police: Use the new .In macro for #include statements. 2001-10-01 16:09:29 +00:00
Matthew Dillon
5d946b40c3 add __FBSDID()s to libmd 2001-09-30 21:56:22 +00:00
Ruslan Ermilov
c4d9468ea0 mdoc(7) police:
Avoid using parenthesis enclosure macros (.Pq and .Po/.Pc) with plain text.
Not only this slows down the mdoc(7) processing significantly, but it also
has an undesired (in this case) effect of disabling hyphenation within the
entire enclosed block.
2001-08-07 15:48:51 +00:00
Dima Dorfman
7ebcc426ef Remove whitespace at EOL. 2001-07-15 07:53:42 +00:00
Ruslan Ermilov
a307d59838 mdoc(7) police: removed HISTORY info from the .Os call. 2001-07-10 13:41:46 +00:00
Ruslan Ermilov
7e5d6de0bf mdoc(7) police: use proper markup for function arguments. 2001-04-04 10:23:27 +00:00
Ruslan Ermilov
4a558355e5 MAN[1-9] -> MAN. 2001-03-27 17:27:19 +00:00
Poul-Henning Kamp
8a24546c85 Add a new entrypoint to the hashes in libmd:
char *
  FooFileChunk(const char *filename, char *buf, off_t offset, off_t length)
Which only hashes part of a file.
Implement FooFile() in terms of this function.

Submitted by:	roam
2001-03-17 10:00:50 +00:00
Ruslan Ermilov
ed40311694 mdoc(7) police: removed history info from the .Os FreeBSD call. 2000-12-14 11:52:05 +00:00
Alexey Zelkin
9452ceeb84 Introduce .Lb macro to libmd manpages 2000-04-22 16:11:30 +00:00
Rodney W. Grimes
d05257b0f2 Replace beforeinstall target with new variables used by .mk system.
Reviewed by:	marcel, and make world
2000-01-14 07:57:47 +00:00
Peter Wemm
c447342094 Change #ifdef KERNEL to #ifdef _KERNEL in the public headers. "KERNEL"
is an application space macro and the applications are supposed to be free
to use it as they please (but cannot).  This is consistant with the other
BSD's who made this change quite some time ago.  More commits to come.
1999-12-29 05:07:58 +00:00
Peter Wemm
7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +00:00
Andrey A. Chernov
5365c4e788 add more MLINKS 1999-03-02 22:53:24 +00:00
Garrett Wollman
303dec3b53 Don't even attempt to build the assembly-language versions of RIPEMD160
and SHA-1 when OBJFORMAT is not ELF.  Add a warning to the man page
about how SHA-1 uses bswapl, which will trap on 80386es (and the kernel
should, but doesn't currently, emulate).
1999-03-01 02:39:45 +00:00
Chuck Robey
719f9de58d fix for incorrect specification of alignment (it worked for the elf
build, but broke while doing the aout legacy build).  Now using
.p2align instead of .align.  Fixes broken buildworld.

Submitted by:	John Polstra
Reviewed by:	John Polstra
1999-02-28 18:55:39 +00:00
Matt Jacob
a5f6fb0686 No, this isn't what I submitted. Seems like the patch I sent
was ignored and an incorrect hand edit was used instead.
1999-02-27 02:45:31 +00:00
Garrett Wollman
617f28f744 Fixes for Alpha.
Submitted by:	mjacob
1999-02-26 20:06:46 +00:00
Garrett Wollman
7c0b1b7add Don't build the assembly for shared linkage, PIC isn't implemented. 1999-02-26 18:43:01 +00:00
Garrett Wollman
d00ed29992 Add Eric Young's RIPEMD160 implementation as well, in case SHA-1
should prove weak.  Also fix a few problems with the SHA-1 build.
1999-02-26 18:41:47 +00:00
Garrett Wollman
c177a86b92 Fix bug in MDx test suite.
Add Eric Young's SHA-[01] implementations.
1999-02-26 04:25:01 +00:00
Garrett Wollman
48ee93d6f3 Add a note about the insecurity of MD4 and potential vulnerability of
MD5 to similar attacks.
1999-02-11 20:31:49 +00:00
John Polstra
d3b89ae3a4 Build libmd shared for a.out too. Required for some PAM modules. 1998-11-12 04:08:10 +00:00
Warner Losh
c0f3e0b9b0 $@ -> ${.TARGET} 1998-09-11 05:42:37 +00:00
John Birrell
8deb7ff0b0 BINFORMAT -> OBJFORMAT ready for E-day. 1998-08-30 01:57:55 +00:00
Poul-Henning Kamp
c6bcf724da Split the padding out into a separate function.
Synchronize the kernel and libmd versions of md5c.c

PR:		misc/6127
Reviewed by:	phk
Submitted by:	Ari Suutari <ari@suutari.iki.fi>
1998-03-27 10:23:00 +00:00
Bruce Evans
c8151f7b9b Don't use the beforedepend target. It was a no-op here except for
helping bsd.dep.mk break `make -jN depend'.
1998-03-19 15:27:08 +00:00
Philippe Charnier
a5941fc2aa .Sh AUTHOR -> .Sh AUTHORS. Use .An/.Aq 1998-03-19 07:34:22 +00:00
Peter Wemm
1840bd1444 If not building a.out, still build a pic version of libmd. This allows
things like libskey.so to be dynamically self contained.

Things like md5(1) where speed is critical should still link with libmd.a,
but for things like login, where it's a once-off call if skey is used, it's
not worth the hassle.
1997-09-05 11:49:43 +00:00
Joerg Wunsch
f778764443 Make the MD* header files C++-aware. Also, string arguments are supposed
to be of type `const char *'.

PR:		3291
Submitted by:	dima@tejblum.dnttm.rssi.ru (Dmitrij Tejblum)
1997-08-25 05:24:31 +00:00
Bruce Evans
09589ca82e FIxed arg types (mostly missing consts) in synopsis. 1997-03-19 00:52:58 +00:00
Peter Wemm
7e546392b5 Revert $FreeBSD$ to $Id$ 1997-02-22 15:12:41 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Poul-Henning Kamp
76516938fa Just pick up the real thing from <sys/md5.h> 1996-12-22 10:32:17 +00:00
Poul-Henning Kamp
15cfc283d8 Make this compile in the kernel too, major cosmetic cleanup. 1996-12-22 10:27:25 +00:00
Bruce Evans
1ab6205ce1 Moved #include of <sys/types.h> earlier so that this compiles when
<stdio.h> doesn't (bogusly) include <sys/types.h>.

Cleaned up #includes.
1996-10-25 06:48:29 +00:00
Poul-Henning Kamp
52377df350 Add #include <sys/types> 1996-10-22 16:28:56 +00:00
Poul-Henning Kamp
40060a90b9 close bin/1648 libmd not 64bit safe.
if something fails to compile now, you need to add #include <sys/types.h>

Partially Submitted by:	Jason Thorpe <thorpej@nas.nasa.gov>
1996-10-22 16:27:47 +00:00
Garrett Wollman
04422105e3 Use -mdoc macros properly.
Translate from Danglish into English.
Refer to the alogrithms as ``RSA Data Security MDX message digest'' as
required by the license.
1996-10-09 21:00:48 +00:00
Peter Wemm
62217f350b cmp -s || install -c ==> install -C, use a .for loop 1996-08-30 01:53:09 +00:00
Mike Pritchard
6c65d95969 Some minor man page cleanup. 1996-08-23 20:52:53 +00:00
Poul-Henning Kamp
8bc66d9bd2 Fix a memory leak in MD[245]End()
Submitted by:	Ikuo Nakagawa <ikuo@isl.intec.co.jp>
PR:	misc/1424
1996-07-24 20:55:38 +00:00
John Polstra
228a10153e Correct two errors in the manual page. 1996-05-28 18:57:31 +00:00
Poul-Henning Kamp
c896bf9116 Don't install mdX.3, it's the template used to build the other pages. 1996-02-09 22:44:44 +00:00
Poul-Henning Kamp
5dc3e051ab Bill was a little to fast here... 1996-02-09 20:57:53 +00:00
Mike Pritchard
6fad16fd59 Add some missing MLINKS, correct some cross references, correct some
file locations and some minor formatting/style problems.
1996-02-09 16:20:10 +00:00
Mike Pritchard
c211e812bb Added some missing MLINKS for section 3 man pages.
Also corrected a few minor formatting errors, file location and cross
references in some of the section 3 man pages.

This shuts up a lot of the output from "manck" for section 3.
1996-02-09 00:45:45 +00:00