| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
| |
|
|
|
|
|
| |
* lib/**.{h,c,gperf}: Use LGPLv2+ notice whenever the module description
says so.
|
| |
|
| |
|
|
|
|
|
| |
* lib/*.[hc]: Fix typos in comments.
* pygnulib/*.py: Fix typos in error messages and comments.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
* lib/af_alg.c (afalg_stream): Recover from crypto failures if the
input stream is seekable, by repositioning the stream back to
where it was, possibly by just calling sendfile with an offset
arg. This lets us return -EAFNOSUPPORT instead of -EIO in some
cases, which lets our callers try again with user-mode code.
* modules/crypto/af_alg (Depends-on): Depend on fseeko and ftello
instead of on fflush and lseek.
|
|
|
|
|
| |
* lib/af_alg.h (afalg_buffer): New declaration.
* lib/af_alg.c (afalg_buffer): New function.
|
|
|
|
|
| |
* lib/af_alg.h (afalg_stream): Mark fallback declaration as inline.
* m4/af_alg.m4 (gl_AF_ALG): Require AC_C_INLINE.
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/af_alg.c (afalg_stream): Before sendfile, invoke fflush. Don't
assume that the stream is positioned at position 0.
* lib/af_alg.h (afalg_stream): Mention restriction regarding the state
of the stream.
* lib/md5.h (md5_stream): Likewise.
* lib/sha1.h (sha1_stream): Likewise.
* lib/sha256.h (sha256_stream, sha224_stream): Likewise.
* lib/sha512.h (sha512_stream, sha384_stream): Likewise.
* modules/crypto/af_alg (Depends-on): Add fflush, lseek.
|
|
|
|
|
|
|
|
|
| |
Suggested by Assaf Gordon <assafgordon@gmail.com>.
* m4/af_alg.m4 (gl_AF_ALG): Add AC_ARG_WITH invocation. Define C macro
USE_LINUX_CRYPTO_API.
* lib/af_alg.h: Test USE_LINUX_CRYPTO_API, not HAVE_LINUX_IF_ALG_H.
* lib/af_alg.c: Likewise.
|
|
|
|
| |
* lib/af_alg.h: Use imperatives and tighten up wording.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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.
|
|
|
|
|
|
| |
* 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.
|
|
|
|
| |
* lib/af_alg.h: Add comments.
|
|
Linux supports accessing kernel crypto API via AF_ALG since
version 2.6.38. Coreutils uses libcrypto when available and fallbacks to
generic C implementation of various hashing functions.
Add a generic afalg_stream() function which uses AF_ALG to calculate the
hash of a stream and use sendfile() when possible (regular file with size
less or equal than 0x7ffff000 (2,147,479,552) bytes, AKA MAX_RW_COUNT).
Use afalg_stream() only in sha1sum for now, but other hashes are possible.
The speed gain really depends on the CPU type, on systems which doesn't use
libcrypto ranges from ~10% to 320%.
This is a test on a Intel(R) Xeon(R) CPU E3-1265L V2 and Debian stretch:
$ truncate -s 2GB 2g.bin
$ time sha1sum 2g.bin
752ef2367f479e79e4f0cded9c270c2890506ab0 2g.bin
real 0m4.829s
user 0m4.437s
sys 0m0.391s
$ time ./sha1sum-afalg 2g.bin
752ef2367f479e79e4f0cded9c270c2890506ab0 2g.bin
real 0m3.164s
user 0m0.000s
sys 0m3.162s
Signed-off-by: Matteo Croce <mcroce@redhat.com>
|