All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Eric Blake <eblake@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 6/6] crypto: support more hash algorithms for pbkdf
Date: Fri, 9 Sep 2016 10:31:22 +0100	[thread overview]
Message-ID: <20160909093122.GC25802@redhat.com> (raw)
In-Reply-To: <b662e689-d1ec-2b02-e690-838e4c1baa08@redhat.com>

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 <berrange@redhat.com>
> > ---
> >  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	other threads:[~2016-09-09  9:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-08 16:27 [Qemu-devel] [PATCH 0/6] crypto: misc tweaks & improvements to pbkdf code Daniel P. Berrange
2016-09-08 16:27 ` [Qemu-devel] [PATCH 1/6] crypto: make PBKDF iterations configurable for LUKS format Daniel P. Berrange
2016-09-08 17:44   ` Eric Blake
2016-09-09  9:32     ` Daniel P. Berrange
2016-09-08 16:27 ` [Qemu-devel] [PATCH 2/6] crypto: clear out buffer after timing pbkdf algorithm Daniel P. Berrange
2016-09-08 17:47   ` Eric Blake
2016-09-09  9:35     ` Daniel P. Berrange
2016-09-08 16:27 ` [Qemu-devel] [PATCH 3/6] crypto: use correct derived key size when timing pbkdf Daniel P. Berrange
2016-09-08 17:51   ` Eric Blake
2016-09-08 16:27 ` [Qemu-devel] [PATCH 4/6] crypto: remove bogus /= 2 for pbkdf iterations Daniel P. Berrange
2016-09-08 17:52   ` Eric Blake
2016-09-08 16:27 ` [Qemu-devel] [PATCH 5/6] crypto: increase default pbkdf2 time for luks to 2 seconds Daniel P. Berrange
2016-09-08 17:53   ` Eric Blake
2016-09-08 16:27 ` [Qemu-devel] [PATCH 6/6] crypto: support more hash algorithms for pbkdf Daniel P. Berrange
2016-09-08 17:57   ` Eric Blake
2016-09-09  9:31     ` Daniel P. Berrange [this message]
2016-09-08 19:48 ` [Qemu-devel] [PATCH 0/6] crypto: misc tweaks & improvements to pbkdf code no-reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160909093122.GC25802@redhat.com \
    --to=berrange@redhat.com \
    --cc=eblake@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.