From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40563) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHI8M-0002la-VI for qemu-devel@nongnu.org; Mon, 20 Jul 2015 16:58:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZHI8J-0001ol-EA for qemu-devel@nongnu.org; Mon, 20 Jul 2015 16:57:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:37451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZHI8J-0001oT-7X for qemu-devel@nongnu.org; Mon, 20 Jul 2015 16:57:55 -0400 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (Postfix) with ESMTPS id 130D6475481 for ; Mon, 20 Jul 2015 20:57:54 +0000 (UTC) References: <1437413322-14808-1-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <55AD60CB.1020405@redhat.com> Date: Mon, 20 Jul 2015 14:57:47 -0600 MIME-Version: 1.0 In-Reply-To: <1437413322-14808-1-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="XPivvB3DREXSThLIvU6G848fUiDrLHkRU" Subject: Re: [Qemu-devel] [PATCH] crypto: extend unit tests to cover decryption too List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Kevin Wolf , Paolo Bonzini This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --XPivvB3DREXSThLIvU6G848fUiDrLHkRU Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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. >=20 > Signed-off-by: Daniel P. Berrange > --- > tests/test-crypto-cipher.c | 20 +++++++++++++++++++- > 1 file changed, 19 insertions(+), 1 deletion(-) >=20 > @@ -266,6 +265,25 @@ static void test_cipher(const void *opaque) > =20 > g_assert_cmpstr(outtexthex, =3D=3D, data->ciphertext); > =20 > + g_free(outtexthex); > + > + if (iv) { > + g_assert(qcrypto_cipher_setiv(cipher, > + iv, niv, > + &err) =3D=3D 0); > + g_assert(err =3D=3D 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) =3D=3D 0); > + g_assert(err =3D=3D NULL); and again But that's style, not correctness, so: Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --XPivvB3DREXSThLIvU6G848fUiDrLHkRU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJVrWDLAAoJEKeha0olJ0NqnUIIAKDOGgBQhvGOgJ2AME/Mv/vd pVvFrXgny0WYxiFVaa4I4uk+P7V3xT6XJ4nB6ur2icVPZYmov7T9tUrho6KZPSEI 4SFK418pT9P+I9ax9/UKQED/Cq91rYkqAVQ1MthhFHb3hcCi/cya5Nb5tgvKV1zl FdCI7IJswJsMYcEoZ3Ggq3NgufLcgbJrCO9DwNfnYc+LSOQpLBY3SiQZgGoWA2/8 wCtji4RrDlIo99rvQEXjF33ADNwGhJjVf99w2oIekpwpiV6uGmVEfjZJcnEGwGXD GvVNf2/27h4evm0zi0vR9Q1N2qR5XSHkOt8QV/iRL2RuCzRxRXjge9YgNs/D8pU= =jw0R -----END PGP SIGNATURE----- --XPivvB3DREXSThLIvU6G848fUiDrLHkRU--