summaryrefslogtreecommitdiff
path: root/lib/libmd
Commit message (Collapse)AuthorAgeFilesLines
* Fix a few mandoc issuesGordon Bergling2020-10-096-10/+10
| | | | | | | | | | - skipping paragraph macro: Pp after Sh - sections out of conventional order: Sh EXAMPLES - whitespace at end of input line - normalizing date format Notes: svn path=/head/; revision=366583
* libmd: add dependency workaround for r366344Ed Maste2020-10-021-0/+4
| | | | | | | | | | | | | | | | | | | | | | | r366344 fixed and reenabled the assembly optimized skein implementation, but skein_block objects were not being rebuilt in no-clean builds. This resulted in failing no-clean builds. SKEIN_USE_ASM controls which routines come from C vs assembly, and with no explicit dependency r366344's change to SKEIN_USE_ASM did not cause skein_block.{o,pico} to be rebuilt. Add a dependency on this Makefile for the skein_block objects. This dependency is broader in scope than absolutely required (that is, the skein_block objects will now be rebuilt on any change to this Makefile). There are ways this could be addressed, but it is probably not worth the additional effort or testing time to pursue them. PR: 248221 Reported by: kevans, Jeremy Faulkner Discussed with: kevans Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=366362
* libmd: fix assembly optimized skein implementationEd Maste2020-10-011-6/+6
| | | | | | | | | | | | | The assembly implementation incorrectly used logical AND instead of bitwise AND. Fix, and re-enable in libmd. Submitted by: Yang Zhong <yzhong@freebsdfoundation.org> Reviewed by: cem (earlier) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D26614 Notes: svn path=/head/; revision=366344
* libmd: temporarily disable optimized assembly skein1024 implementationEd Maste2020-07-231-6/+6
| | | | | | | | | | | | It is apparently broken when assembled by contemporary GNU as as well as Clang IAS (which is used in the default configuration). PR: 248221 Reported by: pizzamig Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=363454
* Remove warning that is no longer accurate after r361853Alex Richardson2020-07-151-2/+0
| | | | | | | | | | We now build the skein assembly with clangs integrated assembler. Reviewed By: emaste Differential Revision: https://reviews.freebsd.org/D25664 Notes: svn path=/head/; revision=363229
* Rename skein_block_asm.s to .S and assemble using Clang IASEd Maste2020-06-061-7/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Comparing the object files produced by GNU as 2.17.50 and Clang IAS shows many immaterial changes in strtab etc., and one material change in .text: 1bac: 4c 8b 4f 18 mov 0x18(%rdi),%r9 1bb0: eb 0e jmp 1bc0 <Skein1024_block_loop> - 1bb2: 66 66 2e 0f 1f 84 00 data16 nopw %cs:0x0(%rax,%rax,1) - 1bb9: 00 00 00 00 - 1bbd: 0f 1f 00 nopl (%rax) + 1bb2: 66 2e 0f 1f 84 00 00 nopw %cs:0x0(%rax,%rax,1) + 1bb9: 00 00 00 + 1bbc: 0f 1f 40 00 nopl 0x0(%rax) 0000000000001bc0 <Skein1024_block_loop>: Skein1024_block_loop(): 1bc0: 4c 8b 47 10 mov 0x10(%rdi),%r8 1bc4: 4c 03 85 c0 00 00 00 add 0xc0(%rbp),%r8 That is, GNU as and Clang's integrated assembler use different multi- byte NOPs for alignment (GNU as emits an 11 byte NOP + a 3 byte NOP, while Clang IAS emits a 10 byte NOP + a 4 byte NOP). Dependency cleanup hacks are not required, because we do not create .depend files from GNU as. Reviewed by: allanjude, arichardson, cem, tsoome Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8434 Notes: svn path=/head/; revision=361853
* Also pass SKEIN_USE_ASM to the assembler, via AFLAGSEd Maste2020-06-051-1/+1
| | | | Notes: svn path=/head/; revision=361845
* Apply C SKEIN_LOOP setting only to skein_block.cEd Maste2020-06-051-1/+1
| | | | | | | | Otherwise if assembling skein_block_asm.s with Clang's integrated assembler we can pass conflicting SKEIN_LOOP settings (via CFLAGS and ACFLAGS). Notes: svn path=/head/; revision=361840
* ANSIfy and KNF function arg definitions in libmd/md4.cEd Maste2020-04-031-23/+14
| | | | | | | Reported by: bde, in 2017 Notes: svn path=/head/; revision=359615
* Update Makefile.depend filesSimon J. Gerraty2019-12-111-1/+0
| | | | | | | | | | | | | Update a bunch of Makefile.depend files as a result of adding Makefile.depend.options files Reviewed by: bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22494 Notes: svn path=/head/; revision=355617
* pkgbase: Put a lot of binaries and lib in FreeBSD-runtimeEmmanuel Vadot2019-09-051-1/+1
| | | | | | | | | | | | All of them are needed to be able to boot to single user and be able to repair a existing FreeBSD installation so put them directly into FreeBSD-runtime. Reviewed by: bapt, gjb Differential Revision: https://reviews.freebsd.org/D21503 Notes: svn path=/head/; revision=351855
* sha.3: clarify admonition against use in NEW signature schemesAllan Jude2019-06-051-1/+1
| | | | | | | Reported by: cem, cperciva (grammar) Notes: svn path=/head/; revision=348699
* Add admonitions against using MD5 and SHA1 to the API man pagesAllan Jude2019-05-212-6/+10
| | | | Notes: svn path=/head/; revision=348073
* Add missing errors section to md[2-5], ripemd160, sha*, and skein* manpagesAllan Jude2019-05-216-4/+124
| | | | | | | | | | | PR: 148987 Submitted by: Dan Lukes <dan@obluda.cz> (original version) MFC after: 1 week Sponsored by: Klara Systems Event: Waterloo Hackathon 2019 Notes: svn path=/head/; revision=348072
* r338270 had the side effect of no longer installing libmd.so into /lib.Sean Bruno2018-08-261-1/+2
| | | | | | | | | | | | | | | | | | For users who have a seperate zfs mount of /usr or /usr/lib, this will cause dynamic loading failures when attempting to execute zfs mount on bootup. E.g. the system won't boot. Including <src.opts.mk> sets SHLIBDIR, so SHLIBDIR?= has no effect. The other lib/ Makefiles solve this problem by moving the SHLIBDIR assignment to before .include <src.opts.mk>. Submitted by: jilles Reviewed by: allanjude Approved by: re (rgrimes) Differential Revision: https://reviews.freebsd.org/D16910 Notes: svn path=/head/; revision=338330
* Don't build skein_block_asm.s if we don't have an as binaryAlex Richardson2018-08-231-0/+6
| | | | | | | | | | | | | This fixes building libmd on MacOS/Linux. The real fix is probably to build it as a .S file with $CC instead. It might also be better to just compile the C file in userspace since the compiler can the use SSE/AVX. Reviewed By: emaste, brooks Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D16844 Notes: svn path=/head/; revision=338270
* Allow bootstrapping libmd on MacOSAlex Richardson2018-08-201-0/+8
| | | | | | | | | | | | The assembly files use directives that only work for ELF targets so skip them when bootstrapping on MacOS. Reviewed By: imp Approved By: jhb (mentor) Differential Revision: https://reviews.freebsd.org/D14247 Notes: svn path=/head/; revision=338097
* libmd: Always erase context in _Final method, and when doingXin LI2018-07-2011-25/+31
| | | | | | | | | | | | | it, consistently use explicit_bzero(). Update manual pages to match the behavior. Reviewed by: pfg, allanjude, jmg MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D16316 Notes: svn path=/head/; revision=336539
* Integrate SHA2-224 with userspace componentsConrad Meyer2018-07-093-8/+64
| | | | | | | | | | | | | The double compilation of the kernel sources in libmd and libcrypt is baffling, but add yet another define hack to prevent duplicate symbols. Add documentation and SHA2-224 test cases to libmd. Integrate with the md5(1) command, document, and add more test cases; self-tests pass. Notes: svn path=/head/; revision=336126
* Revert r334090.Mark Johnston2018-05-232-2/+3
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=334105
* libmd: build with WARNS=1Eitan Adler2018-05-232-3/+2
| | | | | | | | - build with WARNS=1. This works without any changes - remove two unused variables noticed at WARNS=2 Notes: svn path=/head/; revision=334090
* libmd: Remove trailing whitespace from mdXhl.cConrad Meyer2018-04-171-2/+2
| | | | | | | | | | No functional change. Reported by: me, in a CR from three years ago today Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=332655
* Fix formatting errors that resulted in apropos(1) output looking weird.Edward Tomasz Napierala2018-03-171-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=331094
* SPDX: some uses of the RSA-MD license.Pedro F. Giffuni2017-12-136-6/+22
| | | | Notes: svn path=/head/; revision=326828
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2017-10-311-1/+0
| | | | | | | Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=325188
* Increase loop unrolling for skein hashesAllan Jude2017-07-011-0/+4
| | | | | | | | | | | | | | | This patch was inspired by an opposite change made to shrink the code for the boot loader. On my i7-4770, it increases the skein1024 speed from 470 to 550 MB/s Reviewed by: sbruno MFC after: 1 month Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D7824 Notes: svn path=/head/; revision=320554
* ANSIfy md5 functionsToomas Soome2017-06-051-14/+5
| | | | | | | | | | Update the function declarations. Reviewed by: dim Differential Revision: https://reviews.freebsd.org/D11055 Notes: svn path=/head/; revision=319601
* Fix bootstrapping libmd on older systems after r314709.Bryan Drewery2017-03-061-0/+7
| | | | | | | | | | | | | | | | | | This follows another fix to bootstrap libmd after r313404. The MD5FileChunk prototype is needed to build libmd, but it is only reliably in the src tree's sys/md5.h header. Rather than polluting the legacy build with this header for the entire build, just symlink it in here for now as is done in the elftoolchain build. Libmd is already referencing other src tree headers by its used of CFLAGS+= ${SRCTOP}/sys/crypto/sha2. This, and other uses of CFLAGS+= ${SRCTOP}/sys..., may later change to be in the legacy mechanism. Reported by: bde, ian, sjg Tested by: ian Notes: svn path=/head/; revision=314794
* Use SRCTOP-relative paths to other directories instead of .CURDIR-relative onesEnji Cooper2017-01-201-4/+4
| | | | | | | | | | This simplifies pathing in make/displayed output MFC after: 3 weeks Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=312496
* Fix C++ includability of crypto headers with static array sizesAlan Somers2016-10-181-8/+0
| | | | | | | | | | | | | | | | | | | | C99 allows array function parameters to use the static keyword for their sizes. This tells the compiler that the parameter will have at least the specified size, and calling code will fail to compile if that guarantee is not met. However, this syntax is not legal in C++. This commit reverts r300824, which worked around the problem for sys/sys/md5.h only, and introduces a new macro: min_size(). min_size(x) can be used in headers as a static array size, but will still compile in C++ mode. Reviewed by: cem, ed MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D8277 Notes: svn path=/head/; revision=307584
* libmd: introduce functions that operate on an fd instead of filenameEd Maste2016-10-175-10/+64
| | | | | | | | | | Reviewed by: allanjude, cem MFC after: 2 months Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D8264 Notes: svn path=/head/; revision=307521
* libmd: strip local absolute symbols (to link with lld)Ed Maste2016-07-211-0/+1
| | | | | | | | | | | | | Old versions of gas produce an invalid section index. That is ignored by old versions of ld, but prevents a link with lld. Submitted by: Rafael Ávila de Espíndola (earlier version) Reviewed by: allanjude Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D6789 Notes: svn path=/head/; revision=303158
* Import the skein hashing algorithm, based on the threefish block cipherAllan Jude2016-05-298-15/+409
| | | | | | | | | | | | | | | | Connect it to userland (libmd, libcrypt, sbin/md5) and kernel (crypto.ko) Support for skein as a ZFS checksum algorithm was introduced in r289422 but is disconnected because FreeBSD lacked a Skein implementation. A further commit will enable it in ZFS. Reviewed by: cem Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D6166 Notes: svn path=/head/; revision=300921
* Implement SHA-512 truncated (224 and 256 bits)Allan Jude2016-05-283-10/+76
| | | | | | | | | | | | | | | | | | | | | | This implements SHA-512/256, which generates a 256 bit hash by calculating the SHA-512 then truncating the result. A different initial value is used, making the result different from the first 256 bits of the SHA-512 of the same input. SHA-512 is ~50% faster than SHA-256 on 64bit platforms, so the result is a faster 256 bit hash. The main goal of this implementation is to enable support for this faster hashing algorithm in ZFS. The feature was introduced into ZFS in r289422, but is disconnected because SHA-512/256 support was missing. A further commit will enable it in ZFS. This is the follow on to r292782 Reviewed by: cem Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D6061 Notes: svn path=/head/; revision=300903
* libmd: Work around C++'s inability to understand CConrad Meyer2016-05-271-0/+8
| | | | | | | Reported by: antoine@ (x265) Notes: svn path=/head/; revision=300824
* MFHGlen Barber2016-03-021-24/+0
|\ | | | | | | | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=296318
| * DIRDEPS_BUILD: Regenerate without local dependencies.Bryan Drewery2016-02-241-24/+0
| | | | | | | | | | | | | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=295989
* | First pass through library packaging.Glen Barber2016-02-041-0/+1
|/ | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/projects/release-pkg/; revision=295278
* Improvements to the MDXFileChunk() template function:Jonathan T. Looney2016-01-141-29/+31
| | | | | | | | | | | | | | | | - 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 Notes: svn path=/head/; revision=294037
* DIRDEPS_BUILD: Update dependencies.Bryan Drewery2016-01-071-0/+3
| | | | | | | Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=293345
* Fix a file descriptor leak in mdXhl.c (which is used by numerous hashingJonathan T. Looney2015-12-301-4/+9
| | | | | | | | | | | | | 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 Notes: svn path=/head/; revision=292955
* Replace sys/crypto/sha2/sha2.c with lib/libmd/sha512c.cAllan Jude2015-12-275-423/+77
| | | | | | | | | | | | | | | | | | | | | cperciva's libmd implementation is 5-30% faster The same was done for SHA256 previously in r263218 cperciva's implementation was lacking SHA-384 which I implemented, validated against OpenSSL and the NIST documentation Extend sbin/md5 to create sha384(1) Chase dependancies on sys/crypto/sha2/sha2.{c,h} and replace them with sha512{c.c,.h} Reviewed by: cperciva, des, delphij Approved by: secteam, bapt (mentor) MFC after: 2 weeks Sponsored by: ScaleEngine Inc. Differential Revision: https://reviews.freebsd.org/D3929 Notes: svn path=/head/; revision=292782
* META MODE: Remove unneeded libmd.host dependency for xinstall.host.Bryan Drewery2015-11-251-32/+0
| | | | | | | | | This is chasing r291026. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291322
* META MODE: Fix 'make bootstrap-tools'.Bryan Drewery2015-11-251-3/+0
| | | | | | | | | | | | | | | | | | The main problem was bitrot after elftoolchain being swapped in for the GNU toolchain. This also reworks how the list of 'host allowed' libraries is determined to only allow INTERNALLIBs, which is needed for libelftc to come in. For usr.bin/readelf use the same hack, as libelf and libdward, to bring in the needed sys/ headers for host builds. This has not yet been a problem due to readelf not being built as a host tool in buildworld. This is possible in the meta build though when building the toolchain. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291321
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.Bryan Drewery2015-11-251-1/+0
| | | | | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division Notes: svn path=/head/; revision=291307
* Add new include path for sha256.hCraig Rodrigues2015-07-121-1/+2
| | | | | | | | | This fixes the bootstrap build on FreeBSD 10. Submitted by: andrew Notes: svn path=/head/; revision=285417
* Complete the move that was started w/ r263218.. For some reason IJohn-Mark Gurney2015-07-112-394/+0
| | | | | | | | | | didn't delete the files, so that means we need to bring the changes in r282726 to the correct files.. make tinderbox completed with this patch... Notes: svn path=/head/; revision=285366
* increase buffer size to significantly increase performance...John-Mark Gurney2015-07-091-1/+1
| | | | | | | | | | see: https://docs.freebsd.org/cgi/mid.cgi?20150513080342.GE37063@funkthat.com for benchmarks... Notes: svn path=/head/; revision=285324
* new dependsSimon J. Gerraty2015-06-162-0/+4
| | | | Notes: svn path=/head/; revision=284481
* Revert r284417 it is not necessary anymoreBaptiste Daroussin2015-06-151-1/+1
| | | | Notes: svn path=/head/; revision=284421