[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH] crypto: extend unit tests to cover decryption t
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH] crypto: extend unit tests to cover decryption too |
Date: |
Mon, 20 Jul 2015 14:57:47 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 07/20/2015 11:28 AM, Daniel P. Berrange wrote:
> The current unit test only verify the encryption API, which
grammatical mismatch; you want either:
tests only verify
test only verifies
> resulted in us missing a recently introduced bug in the
> decryption API from commit d3462e3. It was fortunately
> later discovered & fixed by commit bd0959 thanks to the
Is a 6-byte SHA going to stay unambiguous long enough? git defaults to
7-byte to reduce chances of collisions by 16.
> QEMU I/O tests for qcow2 encryption, but we should really
> detect this directly in the crypto unit tests.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> tests/test-crypto-cipher.c | 20 +++++++++++++++++++-
> 1 file changed, 19 insertions(+), 1 deletion(-)
>
> @@ -266,6 +265,25 @@ static void test_cipher(const void *opaque)
>
> g_assert_cmpstr(outtexthex, ==, data->ciphertext);
>
> + g_free(outtexthex);
> +
> + if (iv) {
> + g_assert(qcrypto_cipher_setiv(cipher,
> + iv, niv,
> + &err) == 0);
> + g_assert(err == NULL);
g_assert(qcrypto_cipher_setiv(cipher, iv, niv, &error_abort);
saves you a call to g_assert().
> + }
> + g_assert(qcrypto_cipher_decrypt(cipher,
> + ciphertext,
> + outtext,
> + nplaintext,
> + &err) == 0);
> + g_assert(err == NULL);
and again
But that's style, not correctness, 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