[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest le
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest len |
Date: |
Mon, 21 Dec 2015 09:22:42 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
On 12/21/2015 09:06 AM, Daniel P. Berrange wrote:
> Add a qcrypto_hash_digest_len() method which allows querying of
> the raw digest size for a given hash algorithm.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> crypto/hash.c | 15 +++++++++++++++
> include/crypto/hash.h | 11 +++++++++++
> tests/test-crypto-hash.c | 5 +++++
> 3 files changed, 31 insertions(+)
>
> +++ b/tests/test-crypto-hash.c
> @@ -163,6 +163,11 @@ static void test_hash_digest(void)
> for (i = 0; i < G_N_ELEMENTS(expected_outputs) ; i++) {
> int ret;
> char *digest;
> + size_t digestsize;
> +
> + digestsize = qcrypto_hash_digest_len(i);
> +
> + g_assert((digestsize * 2) == strlen(expected_outputs[i]));
g_assert_cmpint() might be better here. But that's minor.
Reviewed-by: Eric Blake <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH 0/6] Misc enhancements to crypto APIs, Daniel P. Berrange, 2015/12/21
- [Qemu-devel] [PATCH 1/6] crypto: add ability to query the cipher key, block & IV lens, Daniel P. Berrange, 2015/12/21
- [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest len, Daniel P. Berrange, 2015/12/21
- Re: [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest len,
Eric Blake <=
- [Qemu-devel] [PATCH 4/6] crypto: move QCryptoCipherAlgorithm/Mode enum definitions into QAPI, Daniel P. Berrange, 2015/12/21
- [Qemu-devel] [PATCH 5/6] crypto: ensure qapi/crypto.json is listed in qapi-modules, Daniel P. Berrange, 2015/12/21
- [Qemu-devel] [PATCH 6/6] crypto: fix transposed arguments in cipher error message, Daniel P. Berrange, 2015/12/21
- [Qemu-devel] [PATCH 3/6] crypto: move QCryptoHashAlgorithm enum definition into QAPI, Daniel P. Berrange, 2015/12/21