aboutsummaryrefslogtreecommitdiff
path: root/sbin/md5
Commit message (Collapse)AuthorAgeFilesLines
* Update Makefile.depend filesSimon J. Gerraty2024-10-142-0/+11
| | | | | | | After building packages we have a number of new and updated Makefile.depend files Reviewed by: stevek
* md5: Consistently use item count as the first argument to callocJohn Baldwin2024-07-191-1/+1
| | | | | | Reported by: GCC 14 -Wcalloc-transposed-args Reviewed by: rlibby Differential Revision: https://reviews.freebsd.org/D46009
* Remove residual blank line at start of MakefileWarner Losh2024-07-152-2/+0
| | | | | | | This is a residual of the $FreeBSD$ removal. MFC After: 3 days (though I'll just run the command on the branches) Sponsored by: Netflix
* md5.1: Fix the GNU mode example when using a digest fileGordon Bergling2024-03-121-2/+2
| | | | | | | | | | | | | | | The last example in the manpage md5(1) wants to demonstrate GNU mode (md5sum), but uses BSD mode (md5) instead. In GNU mode, the -c option does not compare against a hash string passed as parameter. Instead, it expects a digest file, as created under the name digest for /boot/loader.conf in the example above. PR: 276560 Reviewed by: mhorne, des MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D44098
* Revert "md5.1: Fix an example"Gordon Bergling2024-03-061-2/+2
| | | | This reverts commit 865baeaf1abeb14327ad6a4a1f8ce722e242ff73.
* md5.1: Fix an exampleStefan Schlosser2024-02-281-2/+2
| | | | | | | | | | | | | | | The last example in the manpage md5(1) wants to demonstrate GNU mode (md5sum), but uses BSD mode (md5) instead: In GNU mode, the -c option does not compare against a hash string passed as parameter. Instead, it expects a digest file, as created under the name digest for /boot/loader.conf in the example above. PR: 276560 Reviewed by: mhorne MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D44098
* md5: Untabify declarations.Dag-Erling Smørgrav2024-02-201-19/+19
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: imp, allanjude, markj Differential Revision: https://reviews.freebsd.org/D43991
* md5: Fix GNU check mode.Dag-Erling Smørgrav2024-02-201-16/+20
| | | | | | | | Fixes: 9b20849bc5f1b500f2de7aeca77f0e6556069bbb MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: imp, allanjude, markj Differential Revision: https://reviews.freebsd.org/D43990
* md5: Fix Perl mode long options.Dag-Erling Smørgrav2024-02-201-1/+2
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: imp, allanjude, markj Differential Revision: https://reviews.freebsd.org/D43989
* md5: Add test case for GNU input modes.Dag-Erling Smørgrav2024-02-201-0/+23
| | | | | | | MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D43988
* md5: Clean up input stream rights.Dag-Erling Smørgrav2024-02-161-9/+1
| | | | | | | | | Keep it simple, caph_limit_stdio() and fileargs_fopen() already take care of everything for us. MFC after: 1 week Reviewed by: markj, jhb, emaste Differential Revision: https://reviews.freebsd.org/D43897
* md5: Ignore files in string and passthrough mode.Dag-Erling Smørgrav2024-02-163-1/+5
| | | | | | MFC after: 1 week Reviewed by: allanjude, markj Differential Revision: https://reviews.freebsd.org/D43871
* md5: Accept "-" as alias for stdin.Dag-Erling Smørgrav2024-02-163-4/+25
| | | | | | | | | | (based on a patch by jhb) MFC after: 1 week PR: 276915 Reported by: Hannes Hauswedell <h2+fbsdports@fsfe.org> Reviewed by: allanjude, markj, jhb, emaste Differential Revision: https://reviews.freebsd.org/D43870
* md5: Enter capability mode earlierRicardo Branco2024-01-162-28/+38
| | | | | | Reviewed by: markj MFC after: 1 month Pull Request: https://github.com/freebsd/freebsd-src/pull/988
* sbin: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | 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
* sbin: Remove ancient SCCS tags.Warner Losh2023-11-271-1/+0
| | | | | | | | Remove ancient SCCS tags from the tree, automated scripting, with two minor fixup to keep things compiling. All the common forms in the tree were removed with a perl script. Sponsored by: Netflix
* Remove $FreeBSD$: one-line nroff patternWarner Losh2023-08-161-1/+0
| | | | Remove /^\.\\"\s*\$FreeBSD\$$\n/
* Remove $FreeBSD$: one-line sh patternWarner Losh2023-08-164-4/+0
| | | | Remove /^\s*#[#!]?\s*\$FreeBSD\$.*$\n/
* Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* md5: extend capabilitesMariusz Zaborski2023-08-071-1/+1
| | | | | | | | | | | | | In 4849767cb16a4, we did a large refactor of the md5(1) source code. One of them is that instead of reading data using read(2) syscall, we are using binary stream input (fread(3)). fread(3) requires additional Capsicum capabilities: sha256 CAP operation requires CAP_FSTAT, descriptor holds CAP_READ sha256 RET fstat -1 errno 93 Capabilities insufficient Reviewed by: des Differential Revision: https://reviews.freebsd.org/D41348
* md5: Add missing <errno.h>.Dag-Erling Smørgrav2023-05-111-0/+1
| | | | | | Sponsored by: Klara, Inc. Reviewed by: yuripv Differential Revision: https://reviews.freebsd.org/D40051
* md5: Add missing references to sha384.Dag-Erling Smørgrav2023-05-101-3/+4
| | | | | | | Fixes: 4849767cb16a Sponsored by: Klara, Inc. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D40032
* md5: Don't increment a bool.Dag-Erling Smørgrav2023-05-101-3/+3
| | | | | | | | Fixes: 4849767cb16a MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D40020
* md5: Include <osreldate.h> for __FreeBSD_version.Dag-Erling Smørgrav2023-05-101-0/+1
| | | | | | | | | | It is usually provided by <sys/param.h>, but not when bootstrapping. Fixes: 4849767cb16a MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: yuripv, kevans Differential Revision: https://reviews.freebsd.org/D40018
* md5: Fix input error check.Dag-Erling Smørgrav2023-05-101-2/+2
| | | | | | | | Fixes: 4849767cb16a MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: tsoome, kevans, lwhsu Differential Revision: https://reviews.freebsd.org/D40017
* md5: Improve compatibility.Dag-Erling Smørgrav2023-05-0875-747/+1061
| | | | | | | | | | | | * Overhaul the GNU compatibility mode to more closely emulate what the GNU tools do. * Add a Perl compatibility mode which emulates the shasum tool that ships with Perl. This is currently not installed. * Overhaul the tests. Sponsored by: Klara, Inc. Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D39446
* md5 Makefile.depend.hostSimon J. Gerraty2023-05-041-0/+12
|
* Update/fix Makefile.depend for userlandSimon J. Gerraty2023-04-191-1/+1
|
* md5: fix *sum -c with missing filesKyle Evans2023-02-137-1/+93
| | | | | | | | | | | | | | If we fail to open one of the files in the file listing, we still need to advance `rec` along with `argv` so that the checksum we're checking against lines up with the file we're hashing. Tests added both for the -c flag, as well as the -b and -t modes of the *sum programs. PR: 267722 Reviewed by: emaste (earlier version) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D37374
* md5/tests: extend md5 testStefan Eßer2023-02-061-2/+2
| | | | | | | | | | The testloop function is called with various parameters, but those were ignored in the coreutils-c-test script. This was an oversight and is fixed by passing the option to all invocations of the hash functions in this test script. Reported by: des MFC after: 3 days
* libmd / md5: Add SHA-512/224.Dag-Erling Smørgrav2023-02-067-9/+59
| | | | | | | | | | | While there, remove .Tn from man pages. Also remove an obsolete comment about the 80386. MFC after: 1 week Sponsored by: Klara, Inc. Reviewed by: kevans, allanjude Differential Revision: https://reviews.freebsd.org/D38373
* sbin/md5.c: fix -q -c for BSD style versionsStefan Eßer2022-07-262-4/+9
| | | | | | | | | | | | | | | | | | | The BSD style commands (with names not ending in "sum") ignored the -c options and the passed digest value when invoked with -q. The man page stated that -q causes only the calculated digest to be printed, but did not consider the case of both the -q and -c being used in combination. Since there is no warning that -c will be ignored when the -q option is used, users night (and did) expect that the exit code would reflect the matching of the calculated digest and the argument passed with -c. This update implements and documents this expected behavior. PR: 265461 Reported by: Dmitrij <bugs.freebsd@1fff.net> MFC after: 2 weeks
* update external URLsWolfram Schneider2022-02-051-3/+3
|
* md5(1): Fix a typo in the manual pageGordon Bergling2021-08-141-1/+1
| | | | | | - s/compatibilty/compatibility/ MFC after: 5 days
* md5: Improve compatibility with coreutils and format fixStefan Eßer2021-06-292-10/+25
| | | | | | | | | | | | | | | | | | | | The previous changes that added support for the coreutils -c option modified the output generated by passing -r to match that of the coreutils versions. The difference is that coreutils separates the hash from the file name by two blanks " " (or a blank followed by an asterisk " *" with the -b option denoting). While most scripts or users will not notice the difference, it might be considered a violation of POLA and this commit reverts the change for the non-sum programs. These will print a single blank " " as the separator, as they die before the previous commit. In order to still generate output that is identical to that of the coreutils programs, this commit generates the " " or " *" separator used by them for the -sum versions, depending on the presence of the -b option. MFC after: 3 days
* md5: Fix cross-build after c2870e576bd2Jessica Clarke2021-06-251-0/+1
| | | | | On macOS and Linux the current set of headers do not end up pulling in sys/param.h, causing MAXPATHLEN to not be defined and the build to fail.
* sbin/md5: re-enable testsStefan Eßer2021-06-251-4/+4
| | | | | | | | | | The directory for the tests was missing in BSD.tests.dist, causing build failures in "make distribute". Li-Wen Hsu fixed this issue in commit cb194afef50dc, allowing me to re-enable installation of the tests. MFC after: 3 days
* sbin/md5: disable tests due to build failuresStefan Eßer2021-06-251-4/+4
| | | | | | | | | | | | Testing with buildworld/installworld had succeeded, but it appears that a path is not correctly set for the distribute target in the tests directory. Commenting out HAS_TESTS should make the build succeed again and give time to resolve the "make distribute" issue. The tests have been locally run to verify that the recent changes to add a coreutils compatible -c option does not lead to any regressions.
* sbin/md5: fix test case to not write outside temp directoryStefan Eßer2021-06-251-2/+2
| | | | | | | | The bsd-p-test did create files 1.out .. 8.out in the test directory. This has been fixed and the temporary output files are now written to the temporary directory. MFC after: 3 days
* sbin/md5: improve compatibility with coreutils -c optionStefan Eßer2021-06-254-34/+209
| | | | | | | | | | | | | | | | | | | | The -c option expects a digest file in either BSD or coreutils format. The output for matched and mismatched files is identical to that of the coreutils version. The review of these changes included test cases that have already been committed for the functionality that existed before. Another test script is added to cover the coreutils compatible extension implemented by this patch. This commit contains a tests/Makefile that has been cleaned up compared to the review version, using an implicit rule to apply the TESTBASE path at build time (and the scripts have been renamed to have an extension of .SH instead of .sh to trigger this rule). Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D30812
* sbin/md5: add testsStefan Eßer2021-06-2565-0/+448
| | | | | | | | | | While the correctness of the supported hash algorithms can be tested with the built-in self-test feature, these test cases are meant to detect changes in the output format. A follow-up commit will improve the compatibility with the coreutils versions of the hash programs, and these tests should detect any unintended side-effects of such a change on existing functionality.
* sbin/md5: add md5sum to synopsis in the man-pageStefan Eßer2021-06-191-1/+6
| | | | | When invoked with "sum" following the hash name, the -c option takes a file argument, not a string argument.
* md5: portability fix -- include stdbool.h explicitlyWarner Losh2021-05-201-0/+1
| | | | | | | | | stdbool.h needs to be included to use type bool variables. Due to namespace pollution, this gets brought in on FreeBSD, but not on other systems. Include it explicilty. Noticed by: arichards@ Sponsored by: Netflix
* md5: Create md5sum, etc compatible programsWarner Losh2021-05-193-11/+88
| | | | | | | | | | | | | | | On Linux, there's a similar set of programs to ours, but that end in the letters 'sum'. These act basically like FreeBSD versions run with the -r option. Add code so that when the program ends in 'sum' you get the linux -r behavior. This is enough to make most things that use sha*sum work correctly (the -c / --check options, as well as the long args are not implemented). When running with the -sum programs, ignore -t instead of running internal speed tests and make -c an error. Reviewed by: sef, and kp and allanjude (earlier version) Relnotes: yes Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D30309
* md5: return non-zero if built-in tests (-x) failEd Maste2020-07-231-2/+4
| | | | | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=363457
* md5(1): fix -c flag to work with input on stdinAllan Jude2020-06-191-49/+52
| | | | | | | | | | | | | | | Previously, the -p and -c flags were ignored when reading from stdin Additionally, -s and -c can be used together now. PR: 247295 Reviewed by: kevans MFC after: 2 weeks Relnotes: yes Sponsored by: Klara Inc. Differential Revision: https://reviews.freebsd.org/D25362 Notes: svn path=/head/; revision=362412
* md5(1): Add EXAMPLES sectionFernando Apesteguía2020-06-191-1/+43
| | | | | | | | | | Add EXAMLES covering -c, -s and -r Approved by: bcr@, 0mp@ Differential Revision: https://reviews.freebsd.org/D25278 Notes: svn path=/head/; revision=362365
* md5(1): fix style in man pageFernando Apesteguía2020-06-151-29/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a bunch of style problems reported by mandoc(1) and igor: mandoc: ./md5.1:19:71: STYLE: no blank before trailing delimiter: Nm ... rmd160, mandoc: ./md5.1:20:23: STYLE: no blank before trailing delimiter: Nm ... skein512, mandoc: ./md5.1:33:2: STYLE: useless macro: Tn mandoc: ./md5.1:33:2: STYLE: useless macro: Tn mandoc: ./md5.1:33:2: STYLE: useless macro: Tn mandoc: ./md5.1:33:2: STYLE: useless macro: Tn mandoc: ./md5.1:35:2: STYLE: useless macro: Tn mandoc: ./md5.1:42:2: STYLE: useless macro: Tn mandoc: ./md5.1:45:2: STYLE: useless macro: Tn mandoc: ./md5.1:47:2: STYLE: useless macro: Tn mandoc: ./md5.1:56:2: STYLE: useless macro: Tn mandoc: ./md5.1:58:2: STYLE: useless macro: Tn mandoc: ./md5.1:61:2: STYLE: useless macro: Tn mandoc: ./md5.1:66:2: STYLE: useless macro: Tn mandoc: ./md5.1:68:2: STYLE: useless macro: Tn mandoc: ./md5.1:104:24: STYLE: no blank before trailing delimiter: Nm skein512, mandoc: ./md5.1:117:6: STYLE: referenced manual not found: Xr sha224 3 igor: md5.1:46:no comma after "i.e.":either algorithm, [i.e.] to find an input that produces a specific Approved by: bcr@ Differential Revision: https://reviews.freebsd.org/D25277 Notes: svn path=/head/; revision=362191
* Close filedescriptors when done with them.Poul-Henning Kamp2019-04-191-1/+3
| | | | Notes: svn path=/head/; revision=346369
* capsicum: use a new capsicum helpers in toolsMariusz Zaborski2018-11-041-2/+2
| | | | | | | Use caph_{rights,ioctls,fcntls}_limit to simplify the code. Notes: svn path=/head/; revision=340138