root / vnc-tls.h @ a8a358bf
History | View | Annotate | Download (2.2 kB)
1 | 274b6fcc | aliguori | /*
|
---|---|---|---|
2 | 274b6fcc | aliguori | * QEMU VNC display driver. TLS helpers
|
3 | 274b6fcc | aliguori | *
|
4 | 274b6fcc | aliguori | * Copyright (C) 2006 Anthony Liguori <anthony@codemonkey.ws>
|
5 | 274b6fcc | aliguori | * Copyright (C) 2006 Fabrice Bellard
|
6 | 274b6fcc | aliguori | * Copyright (C) 2009 Red Hat, Inc
|
7 | 274b6fcc | aliguori | *
|
8 | 274b6fcc | aliguori | * Permission is hereby granted, free of charge, to any person obtaining a copy
|
9 | 274b6fcc | aliguori | * of this software and associated documentation files (the "Software"), to deal
|
10 | 274b6fcc | aliguori | * in the Software without restriction, including without limitation the rights
|
11 | 274b6fcc | aliguori | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
12 | 274b6fcc | aliguori | * copies of the Software, and to permit persons to whom the Software is
|
13 | 274b6fcc | aliguori | * furnished to do so, subject to the following conditions:
|
14 | 274b6fcc | aliguori | *
|
15 | 274b6fcc | aliguori | * The above copyright notice and this permission notice shall be included in
|
16 | 274b6fcc | aliguori | * all copies or substantial portions of the Software.
|
17 | 274b6fcc | aliguori | *
|
18 | 274b6fcc | aliguori | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
19 | 274b6fcc | aliguori | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
20 | 274b6fcc | aliguori | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
21 | 274b6fcc | aliguori | * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
22 | 274b6fcc | aliguori | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
23 | 274b6fcc | aliguori | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
24 | 274b6fcc | aliguori | * THE SOFTWARE.
|
25 | 274b6fcc | aliguori | */
|
26 | 274b6fcc | aliguori | |
27 | 274b6fcc | aliguori | |
28 | 274b6fcc | aliguori | #ifndef __QEMU_VNC_TLS_H__
|
29 | 274b6fcc | aliguori | #define __QEMU_VNC_TLS_H__
|
30 | 274b6fcc | aliguori | |
31 | 274b6fcc | aliguori | #include <gnutls/gnutls.h> |
32 | 274b6fcc | aliguori | #include <gnutls/x509.h> |
33 | 274b6fcc | aliguori | |
34 | 274b6fcc | aliguori | #include "acl.h" |
35 | 274b6fcc | aliguori | |
36 | 274b6fcc | aliguori | enum {
|
37 | 274b6fcc | aliguori | VNC_WIREMODE_CLEAR, |
38 | 274b6fcc | aliguori | VNC_WIREMODE_TLS, |
39 | 274b6fcc | aliguori | }; |
40 | 274b6fcc | aliguori | |
41 | 274b6fcc | aliguori | typedef struct VncDisplayTLS VncDisplayTLS; |
42 | 274b6fcc | aliguori | typedef struct VncStateTLS VncStateTLS; |
43 | 274b6fcc | aliguori | |
44 | 274b6fcc | aliguori | /* Server state */
|
45 | 274b6fcc | aliguori | struct VncDisplayTLS {
|
46 | 274b6fcc | aliguori | int x509verify; /* Non-zero if server requests & validates client cert */ |
47 | 274b6fcc | aliguori | qemu_acl *acl; |
48 | 274b6fcc | aliguori | |
49 | 274b6fcc | aliguori | /* Paths to x509 certs/keys */
|
50 | 274b6fcc | aliguori | char *x509cacert;
|
51 | 274b6fcc | aliguori | char *x509cacrl;
|
52 | 274b6fcc | aliguori | char *x509cert;
|
53 | 274b6fcc | aliguori | char *x509key;
|
54 | 274b6fcc | aliguori | }; |
55 | 274b6fcc | aliguori | |
56 | 274b6fcc | aliguori | /* Per client state */
|
57 | 274b6fcc | aliguori | struct VncStateTLS {
|
58 | 274b6fcc | aliguori | /* Whether data is being TLS encrypted yet */
|
59 | 274b6fcc | aliguori | int wiremode;
|
60 | 274b6fcc | aliguori | gnutls_session_t session; |
61 | 274b6fcc | aliguori | |
62 | 274b6fcc | aliguori | /* Client's Distinguished Name from the x509 cert */
|
63 | 274b6fcc | aliguori | char *dname;
|
64 | 274b6fcc | aliguori | }; |
65 | 274b6fcc | aliguori | |
66 | 274b6fcc | aliguori | int vnc_tls_client_setup(VncState *vs, int x509Creds); |
67 | 274b6fcc | aliguori | void vnc_tls_client_cleanup(VncState *vs);
|
68 | 274b6fcc | aliguori | |
69 | 274b6fcc | aliguori | int vnc_tls_validate_certificate(VncState *vs);
|
70 | 274b6fcc | aliguori | |
71 | 274b6fcc | aliguori | int vnc_tls_set_x509_creds_dir(VncDisplay *vd,
|
72 | 274b6fcc | aliguori | const char *path); |
73 | 274b6fcc | aliguori | |
74 | 274b6fcc | aliguori | |
75 | 274b6fcc | aliguori | #endif /* __QEMU_VNC_TLS_H__ */ |