summaryrefslogtreecommitdiffstats
path: root/crypto
diff options
context:
space:
mode:
authorPhilippe Mathieu-Daudé2021-06-28 18:09:08 +0200
committerDaniel P. Berrangé2021-06-29 19:29:43 +0200
commite9ac68083f26759b85ef0d871ca2bbe897218f64 (patch)
tree66ba17cb12d9def54882b30c9c2c1748dcf40fff /crypto
parentMerge remote-tracking branch 'remotes/rth-gitlab/tags/pull-axp-20210628' into... (diff)
downloadqemu-e9ac68083f26759b85ef0d871ca2bbe897218f64.tar.gz
qemu-e9ac68083f26759b85ef0d871ca2bbe897218f64.tar.xz
qemu-e9ac68083f26759b85ef0d871ca2bbe897218f64.zip
crypto/tlscreds: Introduce qcrypto_tls_creds_check_endpoint() helper
Introduce the qcrypto_tls_creds_check_endpoint() helper to access QCryptoTLSCreds internal 'endpoint' field. Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Diffstat (limited to 'crypto')
-rw-r--r--crypto/tlscreds.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/crypto/tlscreds.c b/crypto/tlscreds.c
index b68735f06f..084ce0d51a 100644
--- a/crypto/tlscreds.c
+++ b/crypto/tlscreds.c
@@ -20,6 +20,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
+#include "qapi-types-crypto.h"
#include "qemu/module.h"
#include "tlscredspriv.h"
#include "trace.h"
@@ -259,6 +260,17 @@ qcrypto_tls_creds_finalize(Object *obj)
g_free(creds->priority);
}
+bool qcrypto_tls_creds_check_endpoint(QCryptoTLSCreds *creds,
+ QCryptoTLSCredsEndpoint endpoint,
+ Error **errp)
+{
+ if (creds->endpoint != endpoint) {
+ error_setg(errp, "Expected TLS credentials for a %s endpoint",
+ QCryptoTLSCredsEndpoint_str(endpoint));
+ return false;
+ }
+ return true;
+}
static const TypeInfo qcrypto_tls_creds_info = {
.parent = TYPE_OBJECT,