[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/4] sha1sum: use AF_ALG when available
From: |
Bernhard Voelker |
Subject: |
Re: [PATCH v2 1/4] sha1sum: use AF_ALG when available |
Date: |
Wed, 25 Apr 2018 19:41:29 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/25/2018 01:26 PM, Matteo Croce wrote:
> +#define BLOCKSIZE 32768
Did you try different buffer sizes?
In coreutils, we have a little script to determine the optimal BLOCKSIZE
- which is 128*1024 since 2014:
https://git.sv.gnu.org/cgit/coreutils.git/tree/src/ioblksize.h?id=22424dde74d0
> +#ifdef AF_ALG
> + int ret;
> +
> + ret = afalg_stream(stream, resblock, "sha1", SHA1_DIGEST_SIZE);
> + if (!ret)
> + return 0;
> +
> + if (ret == -EIO)
> + return 1;
> +#endif
afalg_stream also returns other errors, namely EAFNOSUPPORT and EINVAL,
which should be handled as well, right?
Thanks & have a nice day,
Berny