[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] crypto: fix handling of iv generator hash defau
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] crypto: fix handling of iv generator hash defaults |
Date: |
Wed, 1 Jun 2016 09:56:37 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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 <address@hidden>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> 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 <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature