On 06/01/2016 09:49 AM, Daniel P. Berrange wrote: > When opening an existing LUKS volume, if the iv generator is > essiv, then the iv hash algorithm is mandatory to provide. We > must report an error if it is omitted in the cipher mode spec, > not silently default to hash 0 (md5). If the iv generator is > not essiv, then we explicitly ignore any iv hash algorithm, > rather than report an error, for compatibility with dm-crypt. > > When creating a new LUKS volume, if the iv generator is essiv > and no iv hsah algorithm is provided, we should default to > using the sha256 hash. > > Reported-by: Paolo Bonzini <pbonz...@redhat.com> > Signed-off-by: Daniel P. Berrange <berra...@redhat.com> > --- > crypto/block-luks.c | 21 ++++ > tests/qemu-iotests/149 | 12 +++ > tests/qemu-iotests/149.out | 240 > +++++++++++++++++++++++++++++++++++++++++++++ > 3 files changed, 273 insertions(+) >
> @@ -904,6 +916,15 @@ qcrypto_block_luks_create(QCryptoBlock *block, > if (!luks_opts.has_hash_alg) { > luks_opts.hash_alg = QCRYPTO_HASH_ALG_SHA256; > } > + if (luks_opts.ivgen_alg == QCRYPTO_IVGEN_ALG_ESSIV) { > + if (!luks_opts.has_ivgen_hash_alg) { > + luks_opts.ivgen_hash_alg = QCRYPTO_HASH_ALG_SHA256; > + luks_opts.has_ivgen_hash_alg = true; > + } > + } > + /* Note we're allowing ivgen_has_alg to be set even for s/has_/hash_/ Simple fix, so: Reviewed-by: Eric Blake <ebl...@redhat.com> -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature