added gnutls backend and moved backend code into new files
[ircu2.10.12-pk.git] / ircd / ssl.c
1 /*
2  * IRC - Internet Relay Chat, ircd/ssl.c
3  * Copyright (C) 2015 pk910 (Philipp Kreil)
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 1, or (at your option)
8  * any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program; if not, write to the Free Software
17  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18  */
19 /** @file
20  * @brief Implementation of functions for handling ssl connections
21  * @version $Id$
22  */
23 #include "config.h"
24
25 #include "client.h"
26 #include "ssl.h"
27 #include "class.h"
28 #include "ircd.h"
29 #include "ircd_features.h"
30 #include "ircd_log.h"
31 #include "ircd_reply.h"
32 #include "list.h"
33 #include "msgq.h"
34 #include "numeric.h"
35 #include "s_conf.h"
36 #include "s_debug.h"
37 #include "send.h"
38 #include "struct.h"
39
40 /* #include <assert.h> -- Now using assert in ircd_log.h */
41 #include <string.h>
42
43 #ifndef IOV_MAX
44 #define IOV_MAX 16      /**< minimum required length of an iovec array */
45 #endif
46
47 #if defined(HAVE_GNUTLS)
48 #include "ssl.gnutls.c"
49 #elif defined(HAVE_OPENSSL)
50 #include "ssl.openssl.c"
51 #else
52 void ssl_free_connection(struct SSLConnection *connection) {}
53 void ssl_free_listener(struct SSLConnection *listener) {}
54 struct SSLListener *ssl_create_listener() { return NULL; }
55 struct SSLConnection *ssl_start_handshake_listener(struct SSLListener *listener, int fd, void *data, enum SSLDataType datatype) { return NULL; }
56 IOResult ssl_recv_decrypt(struct SSLConnection *connection, char *buf, int *len) { return IO_FAILURE; }
57 int ssl_connection_flush(struct SSLConnection *connection) { return 0; };
58 const char* ssl_get_cipher(struct SSLConnection *connection) { return NULL; }
59 #endif
60