From: Daniel P. Berrangé Date: Thu, 16 Oct 2025 18:32:39 +0000 (+0100) Subject: crypto: remove duplication loading x509 CA cert X-Git-Tag: v10.2.0-rc1~24^2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb8a0b0bfc816fd26ba62d7cae22db890fdb5203;p=thirdparty%2Fqemu.git crypto: remove duplication loading x509 CA cert The CA cert is mandatory in both client and server scenarios. Reviewed-by: Marc-André Lureau Signed-off-by: Daniel P. Berrangé --- diff --git a/crypto/tlscredsx509.c b/crypto/tlscredsx509.c index 7271b549ee..dd28faf872 100644 --- a/crypto/tlscredsx509.c +++ b/crypto/tlscredsx509.c @@ -578,11 +578,14 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds, trace_qcrypto_tls_creds_x509_load(creds, creds->parent_obj.dir); + if (qcrypto_tls_creds_get_path(&creds->parent_obj, + QCRYPTO_TLS_CREDS_X509_CA_CERT, + true, &cacert, errp) < 0) { + return -1; + } + if (isServer) { if (qcrypto_tls_creds_get_path(&creds->parent_obj, - QCRYPTO_TLS_CREDS_X509_CA_CERT, - true, &cacert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CA_CRL, false, &cacrl, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj, @@ -598,9 +601,6 @@ qcrypto_tls_creds_x509_load(QCryptoTLSCredsX509 *creds, } } else { if (qcrypto_tls_creds_get_path(&creds->parent_obj, - QCRYPTO_TLS_CREDS_X509_CA_CERT, - true, &cacert, errp) < 0 || - qcrypto_tls_creds_get_path(&creds->parent_obj, QCRYPTO_TLS_CREDS_X509_CLIENT_CERT, false, &cert, errp) < 0 || qcrypto_tls_creds_get_path(&creds->parent_obj,