Commit Graph

103 Commits

Author SHA1 Message Date
gutteridge d7516a336c cksum.c: don't fault if the hash algorithm is fed invalid data
Addresses PR bin/56897 from RVP, who provided the patch.
2022-06-25 02:22:42 +00:00
rillig 258cdd6711 cksum: remove trailing whitespace 2021-08-25 23:03:01 +00:00
rillig c38c408edf cksum: fix lint warning about wrong call to isspace 2021-08-25 22:59:57 +00:00
cheusov 0dc4923bc1 cksum: use POSIX type uint32_t instead of u_int32_t 2021-03-18 18:12:35 +00:00
martin c2f04161f7 Explicitly cast the number of bytes passed to crc_buf() to size_t, as
we made sure it is positive already.
Fixes the build.
2020-04-27 07:30:54 +00:00
riastradh 6211b6d5e0 Speed up cksum word-by-word with a 15 KB table generated dynamically.
(Really we could generate the main table dynamically too.)

From anonymous.
2020-04-27 03:26:09 +00:00
christos cd7f626ab2 bump date 2019-12-15 04:50:28 +00:00
christos a7f52e3116 PR/54768: elo: Missing cksum(1) convenience links (and docs) for new sha2
functions.
2019-12-15 03:55:56 +00:00
wiz 01869ca4d2 Remove workaround for ancient HTML generation code. 2017-07-03 21:28:48 +00:00
christos ff53269704 fix some error handling. 2015-06-16 22:54:10 +00:00
uebayasi 5a220e24e9 Fix build. 2014-10-29 18:09:35 +00:00
wiz c11d7d47ce New sentence, new line. 2014-08-31 07:23:53 +00:00
christos 94162e221a PR/49134: Kamil Rytarowski: Add -q flag. 2014-08-31 07:05:33 +00:00
christos 6e28978d84 fix unused variable warnings 2013-10-18 20:47:06 +00:00
njoly d1f2d0ccef Remove unknown \*(tN and \*(sP macros.
ok wiz.
2013-03-28 22:54:25 +00:00
riastradh 360ba4cb54 Omit outdated cryptographic claims as noted in PR 44160.
Interested readers can follow the references or read Wikipedia; this
is the wrong place to explain cryptographic hash functions and give
security advice.
2012-06-25 02:32:12 +00:00
joerg a696160afc static + __dead 2011-08-29 14:12:29 +00:00
joerg b6d28c7f9d Use plain \* not \\*. Fix trailing whitespace 2010-05-14 01:57:21 +00:00
lukem c1ceae17f0 Enable WARNS=4 by default for usr.bin, except for:
awk  bdes  checknr  compile_et  error  gss  hxtool  kgetcred  kinit
	klist  ldd  less  lex  locale  login  m4  man  menuc  mk_cmds
	mklocale  msgc  openssl  rpcgen  rpcinfo  sdiff  spell  ssh
	string2key  telnet  tn3270  verify_krb5_conf  xlint
2009-04-14 22:15:16 +00:00
joerg 7ffbcccbf3 Don't use macros for the synopsis. Improve markup to break argument
groups together by not splitting opening and closing macro over lines.
2009-03-13 10:51:56 +00:00
lukem 0a0b8d1a16 Clean up the usage display to match reality.
Allow 'sum' to take '-a algorithm', so that its usage matches 'cksum'.
Per discussion with Igor Sobrado resulting from PR 39658.
2009-01-02 09:42:51 +00:00
christos 8225aca082 fix 64 bit time_t 2008-12-29 00:51:29 +00:00
lukem a1e399536b WARNS=4 2008-10-08 03:55:18 +00:00
lukem e9415a55f8 use a const struct hash pointer 2008-10-08 03:55:05 +00:00
lukem 98e5374ccb Remove the \n and tabs from the __COPYRIGHT() strings.
Tweak to use a consistent format.
2008-07-21 14:19:20 +00:00
hubertf 48b31403c5 Remove duplicate #includes
From Slava Semushin <slava.semushin@gmail.com>, via private mail
2007-01-17 00:21:43 +00:00
christos 11c53ad61c kill crypto/rmd160.h and crypto/sha2.h, and instead make symlinks to
/usr/include from /usr/include/sys. This makes all the one way hash
header handling identical.
2006-10-30 20:22:53 +00:00
christos 2541a5f2fe use c99 initializer. 2006-10-22 16:14:07 +00:00
elad d4d70cef20 PR/34584: Geoff C. Wing: cksum not closing filescriptors after finishing
processing files.
Applied patch, thanks!
2006-09-22 22:35:57 +00:00
dsl 75469d03e1 Separate out the CRC functions in a manner that actually makes them useful
for other program binaries.
Fixes build of 'config' where I added code (commented out) to use the CRC
function - but didn't comment out the #include :-(
2006-09-04 20:01:10 +00:00
wiz 127e5ecbd6 Bump date for previous. 2006-09-02 23:27:45 +00:00
elad 0b20a6d87c mention we support sha2, pointed out by dieter roelants
okay hubertf
2006-08-25 10:40:25 +00:00
hubertf 97c6c066c2 Be more liberal about whitespaces when verifying checksums.
This allows checking md5/sha1 shecksums generates on Linux, which
add more whitespace.

Based on patch by Jukka Salmi (j+nbsd at 2006 dot salmi dot ch)
2006-05-07 12:22:55 +00:00
elad 00556c3786 remove -1, -2, -4, -5, -6, -m. 2006-05-05 22:07:22 +00:00
wiz 61152e3f56 Document more explicitly that -c takes an optional file argument. 2006-04-24 22:00:43 +00:00
hubertf 0b4add3077 Allow reading the checksum list from stdin if no file is given with -c.
This allows verifying the checksums e.g. after downloading a NetBSD
release:
		cat BSDSUM CKSUM MD5 SHA512 SYSVSUM | cksum -c
2006-04-24 21:07:43 +00:00
hubertf 1e8e9dee9c Try guessing hash types. Prefix output with hash type,
the output format was inspired by Linux & OpenBSD.

This now allows doing something like:

miyu% ( md4 *.c ; md5 *.c ; sha1 *.c ) > /tmp/x
miyu% md5 -c /tmp/x
miyu% cksum -c /tmp/x
miyu% echo $?
0
miyu% date >test.c
miyu% cksum -c /tmp/x
(MD4) test.c: FAILED
(MD5) test.c: FAILED
(SHA1) test.c: FAILED
miyu% echo $?
1
2006-04-24 19:41:41 +00:00
wiz f255a1f958 A fix for HTML output; punctuation nits. 2006-04-23 17:45:04 +00:00
hubertf 944a4820a3 Document -w, too. 2006-04-23 16:48:02 +00:00
hubertf f9e91b57ed Add a switch "-c file" to verify a list of checksums generated by the
cksum program and stored in file against files on disk.  E.g. first
run "md5 *.tgz >MD5" to generate a list of MD5 checksums in MD5, then
use the following command to verify them use "md5 -c MD5"

Inspired by Linux' md5sum,
called for by Jukka Salmi <j+nbsd@2006.salmi.ch>on netbsd-help@,
reviewed by rui@.
2006-04-23 16:40:16 +00:00
elad ba1244744f sync usage(). 2006-01-15 16:50:05 +00:00
elad a375b7cdb7 Use crypto/rmd160.h. 2005-09-24 22:40:32 +00:00
wiz 3025498c62 Use correct macro. From YOMURA Masanori in private mail. 2005-09-11 23:11:48 +00:00
wiz 775247d100 Punctuation nits. 2005-09-10 22:14:52 +00:00
elad 6383828527 Avoid defining max. hash length ugliness simply by passing NULL for the
buffer to the File routines.

Noted by pooka@.
2005-09-02 17:39:23 +00:00
elad 871155c6cf Forgot +1 for NUL termination. 2005-09-02 16:52:34 +00:00
elad 50b96d774b Use MAXHASHLEN to indicate largest possible hash.
Fixes buffer overflow found by xtraeme@.
2005-09-02 16:52:03 +00:00
tron a73f6299d6 Fix host tool build which got broken when SHA2 support was added. 2005-08-25 09:51:23 +00:00
elad 3722a15dc3 Add support for SHA2 in cksum. 2005-08-24 19:59:08 +00:00
elad eee731374f Fix some lint warnings. 2005-08-24 19:44:45 +00:00