From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38159) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB3EW-0003Qm-Ba for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:22:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aB3ET-0002rx-06 for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:22:48 -0500 Received: from mx1.redhat.com ([209.132.183.28]:49482) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aB3ES-0002qv-CA for qemu-devel@nongnu.org; Mon, 21 Dec 2015 11:22:44 -0500 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (Postfix) with ESMTPS id E20FB1392D for ; Mon, 21 Dec 2015 16:22:43 +0000 (UTC) References: <1450714014-16849-1-git-send-email-berrange@redhat.com> <1450714014-16849-3-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <56782752.3040303@redhat.com> Date: Mon, 21 Dec 2015 09:22:42 -0700 MIME-Version: 1.0 In-Reply-To: <1450714014-16849-3-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="G3KQGGHa0ViDNu1QvUPO1hJoNG4GFjp16" Subject: Re: [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest len List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Markus Armbruster This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --G3KQGGHa0ViDNu1QvUPO1hJoNG4GFjp16 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Daniel P. Berrange > --- > crypto/hash.c | 15 +++++++++++++++ > include/crypto/hash.h | 11 +++++++++++ > tests/test-crypto-hash.c | 5 +++++ > 3 files changed, 31 insertions(+) >=20 > +++ b/tests/test-crypto-hash.c > @@ -163,6 +163,11 @@ static void test_hash_digest(void) > for (i =3D 0; i < G_N_ELEMENTS(expected_outputs) ; i++) { > int ret; > char *digest; > + size_t digestsize; > + > + digestsize =3D qcrypto_hash_digest_len(i); > + > + g_assert((digestsize * 2) =3D=3D strlen(expected_outputs[i]));= g_assert_cmpint() might be better here. But that's minor. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --G3KQGGHa0ViDNu1QvUPO1hJoNG4GFjp16 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWeCdSAAoJEKeha0olJ0Nq/E0H/2RzQo1CszbDDWzZbTKMOAGX jXiJlTnJRqiuMjct4Y0qsfOH0l05sbRzAyLecKZfyRDB2O29fFwdrsWgNj6HJznp QV1a31DyjsoZdH1utqV2CrTQ8W6jxHLP0xl9awyW77Lqi+MNEeMjyoaFZxMo5h+a 93009ITayIr04qaOl+DtZLdSfnaOG1q6yROh5aVzj5tr1U76xk0oPu9LbZZo3xDs GYTfueVi5coiVZyF6BaYeMnP8XwsJXXQxwzVUhH/q1y7xi7oRmcUtXw4lUgThOK0 9eYgoU2vDcm8ZrAn+SkXLcFQ9F1ab7ZPPvizEg9nkiy5Gi+hyxCbTlDOhHP1hd4= =AJat -----END PGP SIGNATURE----- --G3KQGGHa0ViDNu1QvUPO1hJoNG4GFjp16--