From: "Daniel P. Berrangé" <berrange@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Daniel P. Berrangé" <berrange@redhat.com>,
"Eric Blake" <eblake@redhat.com>
Subject: [PATCH v3 3/7] crypto: validate an error is reported in test expected fails
Date: Mon, 20 Oct 2025 15:12:33 +0100 [thread overview]
Message-ID: <20251020141237.2621796-4-berrange@redhat.com> (raw)
In-Reply-To: <20251020141237.2621796-1-berrange@redhat.com>
There was a bug where TLS x509 credentials validation failed
to fill out the Error object. Validate this in the failure
scenarios.
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
---
tests/unit/test-crypto-tlscredsx509.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tests/unit/test-crypto-tlscredsx509.c b/tests/unit/test-crypto-tlscredsx509.c
index a7ea5f422d..85f51aee1b 100644
--- a/tests/unit/test-crypto-tlscredsx509.c
+++ b/tests/unit/test-crypto-tlscredsx509.c
@@ -73,6 +73,7 @@ static void test_tls_creds(const void *opaque)
struct QCryptoTLSCredsTestData *data =
(struct QCryptoTLSCredsTestData *)opaque;
QCryptoTLSCreds *creds;
+ Error *err = NULL;
#define CERT_DIR "tests/test-crypto-tlscredsx509-certs/"
g_mkdir_with_parents(CERT_DIR, 0700);
@@ -111,10 +112,12 @@ static void test_tls_creds(const void *opaque)
QCRYPTO_TLS_CREDS_ENDPOINT_SERVER :
QCRYPTO_TLS_CREDS_ENDPOINT_CLIENT),
CERT_DIR,
- data->expectFail ? NULL : &error_abort);
+ data->expectFail ? &err : &error_abort);
if (data->expectFail) {
g_assert(creds == NULL);
+ g_assert(err != NULL);
+ error_free(err);
} else {
g_assert(creds != NULL);
}
--
2.50.1
next prev parent reply other threads:[~2025-10-20 14:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-20 14:12 [PATCH v3 0/7] crypto: misc fixes and improvements to cert handling Daniel P. Berrangé
2025-10-20 14:12 ` [PATCH v3 1/7] crypto: only verify CA certs in chain of trust Daniel P. Berrangé
2025-10-20 14:12 ` [PATCH v3 2/7] crypto: remove extraneous pointer usage in gnutls certs Daniel P. Berrangé
2025-10-20 14:12 ` Daniel P. Berrangé [this message]
2025-10-20 19:40 ` [PATCH v3 3/7] crypto: validate an error is reported in test expected fails Eric Blake
2025-10-20 20:14 ` Philippe Mathieu-Daudé
2025-10-20 14:12 ` [PATCH v3 4/7] crypto: fix error reporting in cert chain checks Daniel P. Berrangé
2025-10-20 19:50 ` Eric Blake
2025-10-20 14:12 ` [PATCH v3 5/7] crypto: allow client/server cert chains Daniel P. Berrangé
2025-10-20 14:12 ` [PATCH v3 6/7] crypto: stop requiring "key encipherment" usage in x509 certs Daniel P. Berrangé
2025-10-20 14:12 ` [PATCH v3 7/7] crypto: switch to newer gnutls API for distinguished name Daniel P. Berrangé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251020141237.2621796-4-berrange@redhat.com \
--to=berrange@redhat.com \
--cc=eblake@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.