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>
This commit is contained in:
Daniel P. Berrangé 2020-10-08 17:41:21 +01:00
parent 1685983133
commit 295736cfc8

View File

@ -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)