[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/22] crypto: skip essiv ivgen tests if AES+ECB isn't available
From: |
Daniel P . Berrangé |
Subject: |
[PULL 03/22] crypto: skip essiv ivgen tests if AES+ECB isn't available |
Date: |
Mon, 12 Jul 2021 14:02:04 +0100 |
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/unit/test-crypto-ivgen.c | 14 +++++++++-----
1 file 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)
--
2.31.1
- [PULL 00/22] Crypto and more patches, Daniel P . Berrangé, 2021/07/12
- [PULL 01/22] crypto: remove conditional around 3DES crypto test cases, Daniel P . Berrangé, 2021/07/12
- [PULL 02/22] crypto: remove obsolete crypto test condition, Daniel P . Berrangé, 2021/07/12
- [PULL 03/22] crypto: skip essiv ivgen tests if AES+ECB isn't available,
Daniel P . Berrangé <=
- [PULL 04/22] crypto: use &error_fatal in crypto tests, Daniel P . Berrangé, 2021/07/12
- [PULL 05/22] crypto: fix gcrypt min version 1.8 regression, Daniel P . Berrangé, 2021/07/12
- [PULL 06/22] crypto: drop gcrypt thread initialization code, Daniel P . Berrangé, 2021/07/12
- [PULL 07/22] crypto: drop custom XTS support in gcrypt driver, Daniel P . Berrangé, 2021/07/12
- [PULL 08/22] crypto: add crypto tests for single block DES-ECB and DES-CBC, Daniel P . Berrangé, 2021/07/12
- [PULL 09/22] crypto: delete built-in DES implementation, Daniel P . Berrangé, 2021/07/12
- [PULL 10/22] crypto: delete built-in XTS cipher mode support, Daniel P . Berrangé, 2021/07/12
- [PULL 11/22] crypto: replace 'des-rfb' cipher with 'des', Daniel P . Berrangé, 2021/07/12
- [PULL 12/22] crypto: flip priority of backends to prefer gcrypt, Daniel P . Berrangé, 2021/07/12
- [PULL 13/22] crypto: introduce build system for gnutls crypto backend, Daniel P . Berrangé, 2021/07/12