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 <berra...@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)? > +++ 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 -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature