summaryrefslogtreecommitdiffstats
path: root/tests/unit
diff options
context:
space:
mode:
authorDaniel P. Berrangé2020-10-08 18:41:21 +0200
committerDaniel P. Berrangé2021-07-14 15:15:52 +0200
commit295736cfc82ae9019cd647ef012a71f4e277e864 (patch)
treef1f0a45f3ef3b4040f7c66c960a8298038ed048b /tests/unit
parentcrypto: remove obsolete crypto test condition (diff)
downloadqemu-295736cfc82ae9019cd647ef012a71f4e277e864.tar.gz
qemu-295736cfc82ae9019cd647ef012a71f4e277e864.tar.xz
qemu-295736cfc82ae9019cd647ef012a71f4e277e864.zip
crypto: skip essiv ivgen tests if AES+ECB isn't available
Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'tests/unit')
-rw-r--r--tests/unit/test-crypto-ivgen.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/tests/unit/test-crypto-ivgen.c b/tests/unit/test-crypto-ivgen.c
index f581e6aba7..29630ed348 100644
--- a/tests/unit/test-crypto-ivgen.c
+++ b/tests/unit/test-crypto-ivgen.c
@@ -136,8 +136,15 @@ struct QCryptoIVGenTestData {
static void test_ivgen(const void *opaque)
{
const struct QCryptoIVGenTestData *data = opaque;
- uint8_t *iv = g_new0(uint8_t, data->niv);
- QCryptoIVGen *ivgen = qcrypto_ivgen_new(
+ g_autofree uint8_t *iv = g_new0(uint8_t, data->niv);
+ g_autoptr(QCryptoIVGen) ivgen = NULL;
+
+ if (!qcrypto_cipher_supports(data->cipheralg,
+ QCRYPTO_CIPHER_MODE_ECB)) {
+ return;
+ }
+
+ ivgen = qcrypto_ivgen_new(
data->ivalg,
data->cipheralg,
data->hashalg,
@@ -152,9 +159,6 @@ static void test_ivgen(const void *opaque)
&error_abort);
g_assert(memcmp(iv, data->iv, data->niv) == 0);
-
- qcrypto_ivgen_free(ivgen);
- g_free(iv);
}
int main(int argc, char **argv)