qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 6/6] crypto: support more hash algorithms for pb


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH 6/6] crypto: support more hash algorithms for pbkdf
Date: Fri, 9 Sep 2016 10:31:22 +0100
User-agent: Mutt/1.7.0 (2016-08-17)

On Thu, Sep 08, 2016 at 12:57:38PM -0500, Eric Blake wrote:
> On 09/08/2016 11:27 AM, Daniel P. Berrange wrote:
> > Currently pbkdf is only supported with SHA1 and SHA256. Expand
> > this to support all algorithms known to QEMU.
> > 
> > Signed-off-by: Daniel P. Berrange <address@hidden>
> > ---
> >  crypto/pbkdf-gcrypt.c     | 12 +++++++++-
> >  crypto/pbkdf-nettle.c     | 61 
> > ++++++++++++++++++++++++++++++++++++++++-------
> >  tests/test-crypto-pbkdf.c | 53 +++++++++++++++++++++++++++++++++++++++-
> >  3 files changed, 115 insertions(+), 11 deletions(-)
> > 
> 
> >  
> >      if (hash >= G_N_ELEMENTS(hash_map) ||
> >          hash_map[hash] == GCRY_MD_NONE) {
> > -        error_setg(errp, "Unexpected hash algorithm %d", hash);
> > +        error_setg_errno(errp, ENOSYS,
> > +                         "PBKDF does not support hash algorithm %s",
> > +                         QCryptoHashAlgorithm_lookup[hash]);
> 
> Can this access beyond bounds if hash > G_N_ELEMENTS(hash_map)?

I'm relying on fact that 'hash' came from QAPIs string -> enum
convertor - nothing in QEMU lets users provide raw integer enum
values - so will be guaranteed to be a valid enum value.

> > +++ b/crypto/pbkdf-nettle.c
> 
> >  
> >      default:
> >          error_setg_errno(errp, ENOSYS,
> > -                         "PBKDF does not support hash algorithm %d", hash);
> > +                         "PBKDF does not support hash algorithm %s",
> > +                         QCryptoHashAlgorithm_lookup[hash]);
> 
> and again


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 :|



reply via email to

[Prev in Thread] Current Thread [Next in Thread]