Adam Tkac | b10489b | 2010-04-23 14:16:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2004 Red Hat Inc. |
| 3 | * Copyright (C) 2005 Martin Koegler |
| 4 | * Copyright (C) 2010 TigerVNC Team |
| 5 | * |
| 6 | * This is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; either version 2 of the License, or |
| 9 | * (at your option) any later version. |
| 10 | * |
| 11 | * This software 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 |
| 14 | * GNU General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with this software; if not, write to the Free Software |
| 18 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
| 19 | * USA. |
| 20 | */ |
| 21 | |
| 22 | #ifdef HAVE_CONFIG_H |
| 23 | #include <config.h> |
| 24 | #endif |
| 25 | |
Adam Tkac | 4395823 | 2010-07-21 09:06:59 +0000 | [diff] [blame^] | 26 | #ifndef HAVE_GNUTLS |
| 27 | #error "This source should not be compiled without HAVE_GNUTLS defined" |
| 28 | #endif |
Adam Tkac | b10489b | 2010-04-23 14:16:04 +0000 | [diff] [blame] | 29 | |
| 30 | #include <rfb/CSecurityTLS.h> |
| 31 | |
Adam Tkac | b10489b | 2010-04-23 14:16:04 +0000 | [diff] [blame] | 32 | using namespace rfb; |
| 33 | |
| 34 | CSecurityTLS::CSecurityTLS() : anon_cred(0) |
| 35 | { |
| 36 | } |
| 37 | |
| 38 | CSecurityTLS::~CSecurityTLS() |
| 39 | { |
| 40 | shutdown(); |
| 41 | if (anon_cred) |
| 42 | gnutls_anon_free_client_credentials (anon_cred); |
| 43 | } |
| 44 | |
| 45 | |
| 46 | void CSecurityTLS::freeResources() |
| 47 | { |
| 48 | if (anon_cred) |
| 49 | gnutls_anon_free_client_credentials(anon_cred); |
| 50 | anon_cred=0; |
| 51 | } |
| 52 | |
| 53 | void CSecurityTLS::setParam(gnutls_session session) |
| 54 | { |
| 55 | int kx_priority[] = { GNUTLS_KX_ANON_DH, 0 }; |
| 56 | gnutls_kx_set_priority(session, kx_priority); |
| 57 | |
| 58 | gnutls_anon_allocate_client_credentials(&anon_cred); |
| 59 | gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred); |
| 60 | } |
| 61 | |
| 62 | void CSecurityTLS::checkSession(gnutls_session session) |
| 63 | { |
| 64 | |
| 65 | } |
| 66 | |