Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-07 Thread Daniel P. Berrange
On Wed, Jul 06, 2016 at 08:53:56AM -0600, Eric Blake wrote: > On 07/06/2016 05:58 AM, Alberto Garcia wrote: > > On Tue 05 Jul 2016 12:49:59 PM CEST, "Daniel P. Berrange" > > wrote: > > > >> GLib >= 2.16 provides GChecksum API which is good enough > >> for md5, sha1, sha256 and sha512. Use this a

Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-07 Thread Alberto Garcia
On Tue 05 Jul 2016 12:49:59 PM CEST, "Daniel P. Berrange" wrote: > +cs = g_checksum_new(qcrypto_hash_alg_map[alg]); > + > +for (i = 0; i < niov; i++) { > +g_checksum_update(cs, iov[i].iov_base, iov[i].iov_len); > +} Not too important, but you could do this after checking the

Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-06 Thread Eric Blake
On 07/06/2016 05:58 AM, Alberto Garcia wrote: > On Tue 05 Jul 2016 12:49:59 PM CEST, "Daniel P. Berrange" > wrote: > >> GLib >= 2.16 provides GChecksum API which is good enough >> for md5, sha1, sha256 and sha512. Use this as a final >> fallback if neither nettle or gcrypt are available. This >>

Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-06 Thread Alberto Garcia
On Tue 05 Jul 2016 12:49:59 PM CEST, "Daniel P. Berrange" wrote: > GLib >= 2.16 provides GChecksum API which is good enough > for md5, sha1, sha256 and sha512. Use this as a final > fallback if neither nettle or gcrypt are available. This > lets us remove the stub hash impl, and so callers can >

Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-05 Thread Daniel P. Berrange
On Tue, Jul 05, 2016 at 09:03:26AM -0600, Eric Blake wrote: > On 07/05/2016 04:49 AM, Daniel P. Berrange wrote: > > GLib >= 2.16 provides GChecksum API which is good enough > > for md5, sha1, sha256 and sha512. Use this as a final > > fallback if neither nettle or gcrypt are available. This > > let

Re: [Qemu-devel] [PATCH v1 1/2] crypto: use glib as fallback for hash algorithm

2016-07-05 Thread Eric Blake
On 07/05/2016 04:49 AM, Daniel P. Berrange wrote: > GLib >= 2.16 provides GChecksum API which is good enough > for md5, sha1, sha256 and sha512. Use this as a final > fallback if neither nettle or gcrypt are available. This > lets us remove the stub hash impl, and so callers can > be sure those 4 a