Commit graph

32 commits

Author SHA1 Message Date
Warner Losh a2f733abcf lib: Automated cleanup of cdefs and other formatting
Apply the following automated changes to try to eliminate
no-longer-needed sys/cdefs.h includes as well as now-empty
blank lines in a row.

Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/
Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/
Remove /\n+#if.*\n#endif.*\n+/
Remove /^#if.*\n#endif.*\n/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/
Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/

Sponsored by:		Netflix
2023-11-26 22:23:59 -07:00
Warner Losh 1d386b48a5 Remove $FreeBSD$: one-line .c pattern
Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
2023-08-16 11:54:42 -06:00
Mark Johnston 2531686329 Revert r334090.
It causes the 32bit compat build of libmd to fail with:

libmd/rmd160c.c:86:9: error: 'ripemd160_block' macro redefined
#define ripemd160_block ripemd160_block_x86
        ^
libmd/ripemd.h:122:9: note: previous definition is here
#define ripemd160_block         _libmd_ripemd160_block
2018-05-23 17:01:28 +00:00
Eitan Adler 272b99f722 libmd: build with WARNS=1
- build with WARNS=1. This works without any changes
- remove two unused variables noticed at WARNS=2
2018-05-23 11:20:16 +00:00
Conrad Meyer ee9f155f8f libmd: Remove trailing whitespace from mdXhl.c
No functional change.

Reported by:	me, in a CR from three years ago today
Sponsored by:	Dell EMC Isilon
2018-04-17 17:23:47 +00:00
Pedro F. Giffuni 62cf53fdac SPDX: some uses of the RSA-MD license. 2017-12-13 16:30:39 +00:00
Ed Maste de13c2427d libmd: introduce functions that operate on an fd instead of filename
Reviewed by:	allanjude, cem
MFC after:	2 months
Sponsored by:	The FreeBSD Foundation
Differential Revision:	https://reviews.freebsd.org/D8264
2016-10-17 13:47:22 +00:00
Jonathan T. Looney 492e9ee5a9 Improvements to the MDXFileChunk() template function:
- Remove unneeded fstat()/lseek() calls.
- Return NULL and set errno to EINVAL on negative length.
- Fix small style problems and expand variable names.

After this change, it is possible to use this code for some irregular
files. For example, 'md5 /dev/md0' should now succeed.

Differential Revision:	https://reviews.freebsd.org/D4748
Suggested by:	bde
Reviewed by:	bde, allanjude, delphij
2016-01-14 21:08:23 +00:00
Jonathan T. Looney 8d03d93fb7 Fix a file descriptor leak in mdXhl.c (which is used by numerous hashing
algorithms.

CID:	1305669,1305611,1305663,1305603,1305584,1305639,1346865,1305601
Differential Revision:	https://reviews.freebsd.org/D4732
Reviewed by:	allanjude, delphij
MFC after:	2 weeks
Sponsored by:	Juniper Networks
2015-12-30 18:04:50 +00:00
John-Mark Gurney 7b7254e71f increase buffer size to significantly increase performance...
see:
https://docs.freebsd.org/cgi/mid.cgi?20150513080342.GE37063@funkthat.com

for benchmarks...
2015-07-09 16:13:05 +00:00
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 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
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
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
Poul-Henning Kamp aaead0dfe9 Modernize my email address. 2002-03-25 13:52:45 +00:00
Matthew Dillon 5d946b40c3 add __FBSDID()s to libmd 2001-09-30 21:56:22 +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
Peter Wemm 7f3dea244c $Id$ -> $FreeBSD$ 1999-08-28 00:22:10 +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
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
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
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 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
Poul-Henning Kamp 05f65b296e Change this to do what it should have done from the start.
Add argument for buffer for output.
Fix manuals.
1995-07-12 09:13:49 +00:00
Rodney W. Grimes 6c06b4e2aa Remove trailing whitespace. 1995-05-30 05:51:47 +00:00
Garrett Wollman 003d29986d No sense in copying the hex[] array in each call to MDXEnd(), it's a
constant.  (There probably ought to be a single libc version of it.)
1995-04-27 16:05:51 +00:00
Poul-Henning Kamp 6c20486de4 Clean a bunch of -Wall warnings. 1995-02-24 08:51:34 +00:00
Poul-Henning Kamp 4385de1699 Added "const" to the arguments here and there. 1994-11-07 20:48:35 +00:00
Poul-Henning Kamp c9502b535e Reviewed by: phk
Imported libmd.  This library contains MD2, MD4 and MD5.
These three boggers pop up all over the place all of the time, so I 
decided we needed a library with them.  In general they are used for
security checks, so if you use them you want to link them static.
1994-07-24 03:29:56 +00:00