2 * QEMU crypto TLS anonymous credential support
4 * Copyright (c) 2015 Red Hat, Inc.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 #ifndef QCRYPTO_TLSCRED_ANON_H__
22 #define QCRYPTO_TLSCRED_ANON_H__
24 #include "crypto/tlscreds.h"
26 #define TYPE_QCRYPTO_TLS_CREDS_ANON "tls-creds-anon"
27 #define QCRYPTO_TLS_CREDS_ANON(obj) \
28 OBJECT_CHECK(QCryptoTLSCredsAnon, (obj), TYPE_QCRYPTO_TLS_CREDS_ANON)
31 typedef struct QCryptoTLSCredsAnon QCryptoTLSCredsAnon
;
32 typedef struct QCryptoTLSCredsAnonClass QCryptoTLSCredsAnonClass
;
35 * QCryptoTLSCredsAnon:
37 * The QCryptoTLSCredsAnon object provides a representation
38 * of anonymous credentials used perform a TLS handshake.
39 * This is primarily provided for backwards compatibility and
40 * its use is discouraged as it has poor security characteristics
41 * due to lacking MITM attack protection amongst other problems.
43 * This is a user creatable object, which can be instantiated
44 * via object_new_propv():
47 * <title>Creating anonymous TLS credential objects in code</title>
51 * obj = object_new_propv(TYPE_QCRYPTO_TLS_CREDS_ANON,
54 * "endpoint", "server",
55 * "dir", "/path/x509/cert/dir",
56 * "verify-peer", "yes",
64 * <title>Creating anonymous TLS credential objects via QMP</title>
67 * "execute": "object-add", "arguments": {
69 * "qom-type": "tls-creds-anon",
71 * "endpoint": "server",
72 * "dir": "/path/to/x509/cert/dir",
73 * "verify-peer": false
84 * <title>Creating anonymous TLS credential objects via CLI</title>
86 * qemu-system-x86_64 -object tls-creds-anon,id=tlscreds0,\
87 * endpoint=server,verify-peer=off,\
88 * dir=/path/to/x509/certdir/
95 struct QCryptoTLSCredsAnon
{
96 QCryptoTLSCreds parent_obj
;
99 gnutls_anon_server_credentials_t server
;
100 gnutls_anon_client_credentials_t client
;
106 struct QCryptoTLSCredsAnonClass
{
107 QCryptoTLSCredsClass parent_class
;
111 #endif /* QCRYPTO_TLSCRED_H__ */