From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:35183) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBh22-0005Gp-1R for qemu-devel@nongnu.org; Wed, 23 Dec 2015 05:52:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aBh1y-0000rS-A9 for qemu-devel@nongnu.org; Wed, 23 Dec 2015 05:52:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:42633) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aBh1y-0000rE-51 for qemu-devel@nongnu.org; Wed, 23 Dec 2015 05:52:30 -0500 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 8D3B814CAB5 for ; Wed, 23 Dec 2015 10:52:29 +0000 (UTC) Date: Wed, 23 Dec 2015 10:52:26 +0000 From: "Daniel P. Berrange" Message-ID: <20151223105226.GF20028@redhat.com> References: <1450714014-16849-1-git-send-email-berrange@redhat.com> <1450714014-16849-3-git-send-email-berrange@redhat.com> <56782752.3040303@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <56782752.3040303@redhat.com> Subject: Re: [Qemu-devel] [PATCH 2/6] crypto: add ability to query hash digest len Reply-To: "Daniel P. Berrange" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eric Blake Cc: qemu-devel@nongnu.org, Markus Armbruster On Mon, Dec 21, 2015 at 09:22:42AM -0700, Eric Blake wrote: > 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 > > --- > > 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. Ok, I've changed that. > Reviewed-by: Eric Blake Regards, Daniel -- |: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :| |: http://libvirt.org -o- http://virt-manager.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: http://entangle-photo.org -o- http://live.gnome.org/gtk-vnc :|