[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 03/18] crypto: skip essiv ivgen tests if AES+ECB isn't available
From: |
Daniel P . Berrangé |
Subject: |
[PATCH 03/18] crypto: skip essiv ivgen tests if AES+ECB isn't available |
Date: |
Tue, 6 Jul 2021 10:59:09 +0100 |
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
- [PATCH 00/18] crypto: misc cleanup and introduce gnutls backend driver, Daniel P . Berrangé, 2021/07/06
- [PATCH 01/18] crypto: remove conditional around 3DES crypto test cases, Daniel P . Berrangé, 2021/07/06
- [PATCH 02/18] crypto: remove obsolete crypto test condition, Daniel P . Berrangé, 2021/07/06
- [PATCH 05/18] crypto: fix gcrypt min version 1.8 regression, Daniel P . Berrangé, 2021/07/06
- [PATCH 03/18] crypto: skip essiv ivgen tests if AES+ECB isn't available,
Daniel P . Berrangé <=
- [PATCH 09/18] crypto: delete built-in DES implementation, Daniel P . Berrangé, 2021/07/06
- [PATCH 06/18] crypto: drop gcrypt thread initialization code, Daniel P . Berrangé, 2021/07/06
- [PATCH 08/18] crypto: add crypto tests for single block DES-ECB and DES-CBC, Daniel P . Berrangé, 2021/07/06
- [PATCH 07/18] crypto: drop custom XTS support in gcrypt driver, Daniel P . Berrangé, 2021/07/06