summaryrefslogtreecommitdiff
path: root/lib/sha512.c
Commit message (Collapse)AuthorAgeFilesLines
* Put LGPLv2+ notices in source files where appropriate.Bruno Haible2021-06-041-7/+7
| | | | | * lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description says so.
* maint: run 'make update-copyright'Paul Eggert2020-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-12-311-1/+1
|
* maint: Run 'make update-copyright'Paul Eggert2019-01-011-1/+1
|
* maint: clarify comments about sticky EOFPádraig Brady2018-06-241-1/+3
| | | | | | | | | * lib/af_alg.c: Be more direct that we can't assume stickiness of EOF for portability reasons. * lib/md5.c: Clarify that this isn't just a glibc issue. * lib/sha1.c: Likewise. * lib/sha256.c: Likewise. * lib/sha512.c: Likewise.
* af_alg: avoid hangs when reading from streamsPádraig Brady2018-06-241-6/+6
| | | | | | | | | * lib/af_alg.c (afalg_stream): Don't assume EOF is sticky, and thus avoid doing a fread() when feof() is set. * lib/md5.c: Ensure feof() is called before fread(). * lib/sha1.c: Likewise. * lib/sha256.c: Likewise. * lib/sha512.c: Likewise.
* crypto: use byteswapPaul Eggert2018-06-171-9/+2
| | | | | | | | | | * lib/md4.c, lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: * lib/sm3.c: Include <byteswap.h>. (SWAP): Use its macros rather than reinventing the wheel. * modules/crypto/md4, modules/crypto/md5-buffer: * modules/crypto/sha1-buffer, modules/crypto/sha256-buffer: * modules/crypto/sha512-buffer, modules/crypto/sm3: (Depends-on): Add byteswap.
* crypto: omit stream ops Emacs doesn’t needPaul Eggert2018-05-211-2/+5
| | | | | | | | | | | | | | | | | * lib/md5.c (md5_stream): * lib/sha1.c (sha1_stream): * lib/sha256.c (shaxxx_stream, sha256_stream, sha224_stream): * lib/sha512.c (shaxxx_stream, sha512_stream, sha384_stream): Compile stream functions only if GL_COMPILE_CRYPTO_STREAM is defined. Emacs needs this, as it does not use the stream operations and doesn’t need all the af_alg stuff we’ve recently added. Perhaps a similar change is needed to the other crypto modules, but this patch changes only those needed for Emacs. * modules/crypto/md5-buffer, modules/crypto/sha1-buffer: * modules/crypto/sha256-buffer, modules/crypto/sha512-buffer: New modules, used by Emacs. * modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256: * modules/crypto/sha512: Rewrite to depend on the new modules.
* af_alg: Pacify --enable-gcc-warningsPaul Eggert2018-05-071-1/+1
| | | | | | | | Problem reported by Assaf Gordon in: https://lists.gnu.org/r/bug-gnulib/2018-05/msg00041.html * lib/af_alg.c (afalg_buffer): Move local decls to pacify gcc -Wjump-misses-init. * lib/sha512.c (shaxxx_stream): Now static.
* crypto/{md5,sha1,sha256,sha512}: simplifyPaul Eggert2018-05-051-96/+26
| | | | | | | | | | | | | | * lib/md5.c (md5_stream): * lib/sha1.c (sha1_stream): * lib/sha256.c (shaxxx_stream): Simplify, partly by assuming C99. * lib/sha256.c (shaxxx_stream): New function, which implements both sha256 and sha224. Simplify, partly by assuming C99. (sha256_stream, sha224_stream): Use it to avoid code duplication, removing a FIXME. * lib/sha512.c (shaxxx_stream, sha512_stream, sha384_stream): Likewise.
* af_alg: New module.Bruno Haible2018-05-051-17/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/af_alg.h: Test HAVE_* macro through '#if', not '#ifdef'. * lib/af_alg.c: Include "af_alg.h" before the other header files. * lib/md5.c: Include "af_alg.h" unconditionally. (md5_stream): Invoke afalg_stream unconditionally. * lib/sha1.c: Include "af_alg.h" unconditionally. (sha1_stream): Invoke afalg_stream unconditionally. * lib/sha256.c: Include "af_alg.h" unconditionally. (sha256_stream, sha224_stream): Invoke afalg_stream unconditionally. * lib/sha512.c: Include "af_alg.h" unconditionally. (sha512_stream, sha384_stream): Invoke afalg_stream unconditionally. * m4/af_alg.m4: Renamed from m4/linux-if-alg.m4. (gl_AF_ALG): Renamed from gl_LINUX_IF_ALG_H. * modules/crypto/af_alg: New file. * modules/crypto/md5 (Files): Remove files that are now in the 'crypto/af_alg' module. (Depends-on): Add crypto/af_alg. (configure.ac): Remove gl_LINUX_IF_ALG_H invocation. (Makefile.am): Don't mention af_alg.c here. * modules/crypto/sha1 (Files): Remove files that are now in the 'crypto/af_alg' module. (Depends-on): Add crypto/af_alg. (configure.ac): Remove gl_LINUX_IF_ALG_H invocation. (Makefile.am): Don't mention af_alg.c here. * modules/crypto/sha256 (Files): Remove files that are now in the 'crypto/af_alg' module. (Depends-on): Add crypto/af_alg. (configure.ac): Remove gl_LINUX_IF_ALG_H invocation. (Makefile.am): Don't mention af_alg.c here. * modules/crypto/sha512 (Files): Remove files that are now in the 'crypto/af_alg' module. (Depends-on): Add crypto/af_alg. (configure.ac): Remove gl_LINUX_IF_ALG_H invocation. (Makefile.am): Don't mention af_alg.c here.
* af_alg: Improve function signature.Bruno Haible2018-05-051-2/+2
| | | | | | * lib/af_alg.h (afalg_stream): Swap second and third argument. * lib/af_alg.c (afalg_stream): Likewise. * lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: Callers changed.
* sha512sum: use kernel crypto APIMatteo Croce2018-05-051-2/+30
| | | | | | Use AF_ALG for sha384 and sha512 too Signed-off-by: Matteo Croce <mcroce@redhat.com>
* maint: Add encoding marker for Emacs to non-ASCII sources.Bruno Haible2018-01-051-0/+7
| | | | | | | | | | | | | | | | | | | Similar to commit f406941a8a2ec5fbf3eacc386b9be09d6593d53b from Paul Eggert <eggert@cs.ucla.edu> 2015-09-24. To determine the file list that need the marker, I used the command: for f in `find . -type f | grep -v '^\./\.git/' | grep -v '^\./tests/'`; do if iconv -f ASCII -t ASCII < $f > /dev/null 2>&1 ; then : ; else if iconv -f UTF-8 -t UTF-8 < $f > /dev/null 2>&1 ; then if grep 'The GNU C Library is' $f > /dev/null; then :; else if grep 'coding: utf-8' $f > /dev/null; then :; else echo $f fi fi fi fi done | LC_ALL=C sort
* maint: Run 'make update-copyright'Paul Eggert2018-01-011-1/+1
|
* all: prefer https: URLsPaul Eggert2017-09-131-1/+1
|
* md5, sha1, sha256, sha512: Add comments regarding correctness.Bruno Haible2017-03-311-1/+4
| | | | | | | | | | | | * lib/md5.h (buflen): Add comments regarding range. * lib/sha1.h (buflen): Likewise. * lib/sha256.h (buflen): Likewise. * lib/sha512.h (buflen): Likewise. * lib/md5.c (md5_process_bytes): Add comment why memmove is not needed. * lib/sha1.c (sha1_process_bytes): Likewise. * lib/sha256.c (sha256_process_bytes): Likewise. * lib/sha512.c (sha512_process_bytes): Likewise. Reported by Coverity via Tim Rühsen.
* version-etc: new yearPaul Eggert2017-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* md4,md5,sha*: allow _STRING_INLINE_unaligned enable unaligned operationPádraig Brady2016-11-271-1/+1
| | | | | | | | | * lib/md4.c (md4_process_bytes): The existing define is made internal in recent versions of glibc, so also use this new public define. * lib/md5.c (md5_process_bytes): Likewise. * lib/sha1.c (sha1_process_bytes): Likewise. * lib/sha256.c (sha256_process_bytes): Likewise. * lib/sha512.c (sha512_process_bytes): Likewise.
* version-etc: new yearPaul Eggert2016-01-011-1/+1
| | | | | | | | | | * build-aux/gendocs.sh (version): * doc/gendocs_template: * doc/gendocs_template_min: * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright dates by hand in templates and the like. * all files: Run 'make update-copyright'.
* version-etc: new yearPaul Eggert2014-12-311-1/+1
| | | | | | * doc/gnulib.texi: * lib/version-etc.c (COPYRIGHT_YEAR): Update copyright date. * all files: Run 'make update-copyright'.
* maint: update copyrightEric Blake2014-01-011-1/+1
| | | | | | I ran 'make update-copyright'. Signed-off-by: Eric Blake <eblake@redhat.com>
* md5, sha1, sha256, sha512: use openssl routines if availablePádraig Brady2013-12-031-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --with-openssl the libcrypto md5, sha1, sha224, sha256, sha384, sha256 routines will be used if available, requiring apps to link @LIB_CRYPTO@ * lib/gl_openssl.h: Provide wrappers for specified openssl hash. * m4/gl-openssl.m4 (gl_CRYPTO_CHECK): New function to lookup libcrypto in the standard system location. * m4/sha1.m4: Call gl_CRYPTO_CHECK() for SHA1. * m4/sha256.m4: Likewise with SHA256. * m4/sha512.m4: Likewise with SHA512. * m4/md5.m4: Likewise with MD5. * m4/gc.m4: Ensure @LIB_CRYPTO@ set for tests. * lib/sha1.h: Include wrappers if HAVE_OPENSSL_SHA1. * lib/sha256.h: Likewise with SHA256. * lib/sha512.h: Likewise with SHA512. * lib/md5.h: Likewise with MD5. * lib/sha1.c: Exlude functionality if HAVE_OPENSSL_SHA1. * lib/sha256.c: Likewise with SHA256. * lib/sha512.c: Likewise with SHA512. * lib/md5.c: Likewise with MD5. * modules/crypto/sha1 (Link:): Add the new optional lib. (Depends-on:): Add dependency on extern-inline. * modules/crypto/sha256: Likewise. * modules/crypto/sha512: Likewise. * modules/crypto/md5: Likewise. * modules/crypto/sha1-tests: Reference the lib here too. * modules/crypto/md5-tests: Likewise. * modules/crypto/gc-des-tests: Likewise. * modules/crypto/gc-hmac-md5-tests: Likewise. * modules/crypto/gc-hmac-sha1-tests: Likewise. * modules/crypto/gc-hmac-sha256-tests: Likewise. * modules/crypto/gc-hmac-sha512-tests: Likewise. * modules/crypto/gc-md5-tests: Likewise. * modules/crypto/gc-pbkdf2-sha1-tests: Likewise. * modules/crypto/gc-sha1-tests: Likewise. * modules/crypto/gc-tests: Likewise. * modules/crypto/hmac-md5-tests: Likewise. * modules/crypto/hmac-sha1-tests: Likewise. * modules/crypto/hmac-sha256-tests: Likewise. * modules/crypto/hmac-sha512-tests: Likewise.
* maint: update all copyright year number rangesEric Blake2013-01-011-1/+1
| | | | | | Run "make update-copyright". Compare to commit 1602f0a from last year. Signed-off-by: Eric Blake <eblake@redhat.com>
* arctwo, md4, md5, sha1, sha256, sha512: no 'static inline'Paul Eggert2012-11-291-1/+1
| | | | | | | | | | | | | | | | | | * lib/arctwo.c (to_uchar): * lib/md4.c (set_uint32): * lib/md5.c (set_uint32): * lib/sha1.c (set_uint32): * lib/sha256.c (set_uint32): * lib/sha512.c (set_uint64): Now static, not static inline. This is a bit simpler, and doesn't affect performance with GCC and default optimization. * m4/arctwo.m4 (gl_ARCTWO): * m4/md4.m4 (gl_MD4): * m4/md5.m4 (gl_MD5): * m4/sha1.m4 (gl_SHA1): * m4/sha256.m4 (gl_SHA256): * m4/sha512.m4 (gl_SHA512): Do not require AC_C_INLINE.
* crypto: fix bug in large buffer handlingPaul Eggert2012-05-181-4/+5
| | | | | * lib/sha512.c (sha512_process_block): Work even if size_t is wider than 64 bits.
* crypto: fix bug in large buffer handlingPaul Eggert2012-05-181-2/+3
| | | | | | | | * lib/sha512.c (sha512_process_block): Don't assume the buffer length is less than 2**32. Here, the bug is present only in the rare case where the host does not support uint64_t; use u64size to work around the problem. * lib/u64.h (u64size): New macro.
* Spelling fixes.Paul Eggert2012-01-311-1/+1
|
* maint: update all copyright year number rangesJim Meyering2012-01-011-1/+1
| | | | Run "make update-copyright".
* crypto libraries: use stdalignPaul Eggert2011-10-271-3/+3
| | | | | | | | | | | | * lib/md4.c, lib/md5.c, lib/sha1.c, lib/sha256.c, lib/sha512.c: Include <stdalign.h> and <stdint.h>. Do not include <stddef.h>. Do not include <stdlib.h> twice, in md4.c. (UNALIGNED_P): Simplify by using alignof. Use uintptr_t, not size_t, because we are accessing a pointer's bit-pattern, not a size. * modules/crypto/gc-md4 (Depends-on): Add stdalign. * modules/crypto/gc-md5, modules/crypto/gc-sha1, modules/crypto/md4: * modules/crypto/md5, modules/crypto/sha1, modules/crypto/sha256: * modules/crypto/sha512: Likewise.
* maint: update almost all copyright ranges to include 2011Jim Meyering2011-01-011-1/+1
| | | | Run the new "make update-copyright" rule.
* update nearly all FSF copyright year lists to include 2010Jim Meyering2010-01-011-1/+1
| | | | | Use the same procedure as for 2009, outlined in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/20081
* update nearly all FSF copyright year lists to include 2009Jim Meyering2009-12-291-1/+1
| | | | | | | | | | | | | | | | | | The files named by the following are exempted: grep -v '^#' config/srclist.txt|grep -v '^$' \ | while read src dst; do test -f "$dst" && { echo "$dst"; continue; } test -d "$dst" || continue echo "$dst"/$(basename "$src") done > exempt git ls-files tests/unictype >> exempt In the remaining files, convert to all-interval notation if - there is already at least one year interval like 2000-2003 - the file is maintained by me - the file is in lib/uni*/, where that style already prevails Otherwise, use update-copyright's default.
* Use spaces for indentation, not tabs.Bruno Haible2009-12-101-115/+115
|
* digests, copy-file: increase the IO buffer size from 4KiB to 32KiBPádraig Brady2009-10-231-5/+20
| | | | | | | | | | | | | | | | | This results in a significant decrease in syscall overhead giving a 3% speedup to the digest utilities for example (when processing large files from cache). Storage is moved from the stack to the heap as some threaded environments for example can have small stacks. * lib/copy-file.c (copy_file_preserving): Use a 32KiB malloced buffer * modules/copy-file: Depend on xalloc * lib/md2.c: Likewise * lib/md4.c: Likewise * lib/md5.c: Likewise * lib/sha1.c: Likewise * lib/sha256.c: Likewise * lib/sha512.c: Likewise
* avoid unaligned access errors, e.g., on sparcJim Meyering2008-05-261-4/+8
| | | | | | | | | * lib/sha512.c (sha512_conclude_ctx): Use set_uint64 rather than direct access through a possibly-unaligned uint64* pointer. * lib/sha256.c (sha256_conclude_ctx): Use set_uint32 rather than direct access through a possibly-unaligned uint32* pointer. Prompted by this patch from Tom "spot" Callaway: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/13638
* sha512.c: fix typo in commentJim Meyering2008-05-261-1/+1
| | | | * lib/sha512.c (sha512_conclude_ctx): Length is 128-bit, not 64-bit.
* New modules: crypto/sha256, crypto/sha512 (from coreutils)Jim Meyering2008-05-111-0/+600
* modules/crypto/sha256: New file. * modules/crypto/sha512: Likewise. * lib/sha256.c: Likewise. * lib/sha256.h: Likewise. * lib/sha512.c: Likewise. * lib/sha512.h: Likewise. * lib/u64.h: Likewise. * m4/sha256.m4: Likewise. * m4/sha512.m4: Likewise. * MODULES.html.sh (Cryptographic computations (low-level)): List them.