diff options
author | Daniel P. Berrangé | 2020-10-08 18:41:21 +0200 |
---|---|---|
committer | Daniel P. Berrangé | 2021-07-14 15:15:52 +0200 |
commit | 295736cfc82ae9019cd647ef012a71f4e277e864 (patch) | |
tree | f1f0a45f3ef3b4040f7c66c960a8298038ed048b /tests/unit | |
parent | crypto: remove obsolete crypto test condition (diff) | |
download | qemu-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.c | 14 |
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) |