Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-07 Thread Assaf Gordon
Hello Paul, On Mon, May 07, 2018 at 12:36:43AM -0700, Paul Eggert wrote: > Assaf Gordon wrote: [...] > > It won't matter to a single user on a desktop, but imagine > > a shared server at a university, when all of a sudden a sysadmin > > might see a very very high %SYS load - with almost no way to

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-07 Thread Paul Eggert
Assaf Gordon wrote: I think that for the same reason that --with-openssl defaults to 'no' and not to 'auto' applies here. This is a good point; it's easier to understand and explain if the two options have similar defaults. I'm not sure there is significant improvement of using af_alg comp

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-06 Thread Assaf Gordon
Hello Bruno and all, On Sun, May 06, 2018 at 12:31:36PM +0200, Bruno Haible wrote: > Assaf suggested to let it turned off by default, but I prefer to turn it on > by default because I'd still suggest turning it off by default to be more conservative. Few things to consider: > * All known pas

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-06 Thread Bruno Haible
This patch adds the configure option. Assaf suggested to let it turned off by default, but I prefer to turn it on by default because * All known past bugs of this API are with empty inputs, and the gnulib code is careful to avoid this scenario. * The crypto code is in the kernel for quite

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-06 Thread Bruno Haible
Oops, I had left some unneeded module dependencies. 2018-05-06 Bruno Haible Followup to 'af_alg: New module.'. * modules/crypto/md5 (Depends-on): Remove sys_socket, sys_stat. * modules/crypto/sha1 (Depends-on): Likewise. * modules/crypto/sha256 (Depends-on): Li

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
This patch addresses the code duplication issue in the module descriptions. At the same time, it enables some of the best practices for gnulib modules. In particular, the best practice is not to write #if some_condition #include "af_alg.h" #endif but instead #include "af_alg.h" and make

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
The 4 tests that I added all fail on the empty file. Example: $ ./test-sha1 sha1_stream produced wrong result. Expected: \xda\x39\xa3\xee\x5e\x6b\x4b\x0d\x32\x55\xbf\xef\x95\x60\x18\x90\xaf\xd8\x07\x09 Got: \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00 S

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
While writing the documentation, I noticed that the function has an argument list that is hard to remember: - an input argument (stream), - an output buffer (resblock), - an input argument (alg), - the size of the output buffer. It is better to reorder the arguments so as to: 1. group th

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
Also, I get this compilation warning: af_alg.c: In function ‘afalg_stream’: af_alg.c:72:56: warning: implicit declaration of function ‘S_TYPEISTMO’ [-Wimplicit-function-declaration] && (S_ISREG (st.st_mode) || S_TYPEISSHM (&st) || S_TYPEISTMO (&st))

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
Creating a testdir produces an error: $ ./gnulib-tool --create-testdir --dir=t2 --single-configure --symlink crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 ... configure.ac:197: warning: gl_HEADER_SYS_SOCKET is m4_require'd but not m4_defun'd configure.ac:29: gl_INIT is expanded from... conf

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
Lack of documentation is addressed by this patch. 2018-05-05 Bruno Haible af_alg: Add documentation. * lib/af_alg.h: Add comments. diff --git a/lib/af_alg.h b/lib/af_alg.h index 978e21d..e9580d4 100644 --- a/lib/af_alg.h +++ b/lib/af_alg.h @@ -15,7 +15,16 @@ You should ha

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
Lack of unit tests is addressed through these patches. >From fd8f83c7b100f841f7772e9dd83a0b7e182d3b3b Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Sat, 5 May 2018 17:38:39 +0200 Subject: [PATCH 1/4] md5 tests: Add test for md5_stream. * tests/test-digest.h: New file. * tests/test-md5.c: Inc

Re: [PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-05-05 Thread Bruno Haible
Thanks for the patches. There were no further comments in a week, therefore I pushed them in your name. Still to be addressed: - Lack of documentation. - Code duplication. - Lack of unit tests. - Lack of configure option (suggested by Assaf Gordon in [1]). Bruno [1] https://lists.gnu.org

[PATCH v3 0/4] Use AF_ALG in checksum utilities

2018-04-28 Thread Matteo Croce
Let md5sum and all sha*sum utilities use Linux kernel cryptographic API via the AF_ALG address family. Speed gain depends on the CPU type: Xeon E3-1265L V2: $ truncate -s 2GB 2g.bin $ time sha1sum 2g.bin 752ef2367f479e79e4f0cded9c270c2890506ab0 2g.bin real0m4.829s user