]> jfr.im git - irc/rqf/shadowircd.git/blame - libratbox/src/nossl.c
Removal of ancient SVN ID's part one
[irc/rqf/shadowircd.git] / libratbox / src / nossl.c
CommitLineData
b57f37fb
WP
1/*
2 * libratbox: a library used by ircd-ratbox and other things
3 * nossl.c: ssl stub code
4 *
5 * Copyright (C) 2007-2008 ircd-ratbox development team
6 * Copyright (C) 2007-2008 Aaron Sethman <androsyn@ratbox.org>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
21 * USA
22 *
b57f37fb
WP
23 */
24
25
26#include <libratbox_config.h>
27#include <ratbox_lib.h>
af6f5d47 28#if !defined(HAVE_OPENSSL) && !defined(HAVE_GNUTLS)
b57f37fb 29
4414eb3c
VY
30#include "arc4random.h"
31
b57f37fb
WP
32#include <commio-int.h>
33#include <commio-ssl.h>
34
94b4fbf9 35int
b57f37fb
WP
36rb_setup_ssl_server(const char *cert, const char *keyfile, const char *dhfile)
37{
38 errno = ENOSYS;
39 return 0;
40}
41
42int
43rb_init_ssl(void)
44{
45 errno = ENOSYS;
46 return -1;
47
48}
49
50int
51rb_ssl_listen(rb_fde_t *F, int backlog)
52{
53 errno = ENOSYS;
54 return -1;
55}
56
4414eb3c
VY
57static void
58rb_stir_arc4random(void *unused)
59{
60 arc4random_stir();
61}
4414eb3c 62
94b4fbf9
VY
63
64int
65rb_init_prng(const char *path, prng_seed_t seed_type)
b57f37fb 66{
4414eb3c
VY
67 /* xxx this ignores the parameters above */
68 arc4random_stir();
69 rb_event_addish("rb_stir_arc4random", rb_stir_arc4random, NULL, 300);
70 return 1;
b57f37fb
WP
71}
72
73int
74rb_get_random(void *buf, size_t length)
75{
4414eb3c 76 uint32_t rnd = 0, i;
94b4fbf9
VY
77 uint8_t *xbuf = buf;
78 for(i = 0; i < length; i++)
4414eb3c
VY
79 {
80 if(i % 4 == 0)
81 rnd = arc4random();
82 xbuf[i] = rnd;
83 rnd >>= 8;
84 }
85 return 1;
86}
87
88int
89rb_get_pseudo_random(void *buf, size_t length)
90{
94b4fbf9 91 return rb_get_random(buf, length);
b57f37fb
WP
92}
93
4414eb3c 94
b57f37fb
WP
95const char *
96rb_get_ssl_strerror(rb_fde_t *F)
97{
98 static const char *nosupport = "SSL/TLS not supported";
99 return nosupport;
100}
101
a099270d
JT
102int
103rb_get_ssl_certfp(rb_fde_t *F, uint8_t certfp[RB_SSL_CERTFP_LEN])
104{
105 return 0;
106}
107
94b4fbf9
VY
108void
109rb_ssl_start_accepted(rb_fde_t *new_F, ACCB * cb, void *data, int timeout)
b57f37fb
WP
110{
111 return;
112}
113
94b4fbf9
VY
114void
115rb_ssl_start_connected(rb_fde_t *F, CNCB * callback, void *data, int timeout)
b57f37fb
WP
116{
117 return;
118}
119
120void
94b4fbf9
VY
121rb_connect_tcp_ssl(rb_fde_t *F, struct sockaddr *dest,
122 struct sockaddr *clocal, int socklen, CNCB * callback, void *data, int timeout)
b57f37fb
WP
123{
124 return;
125}
126
127int
128rb_supports_ssl(void)
129{
130 return 0;
131}
132
133void
94b4fbf9
VY
134rb_ssl_shutdown(rb_fde_t *F)
135{
b57f37fb 136 return;
94b4fbf9 137}
1ac65021
WP
138
139void
94b4fbf9 140rb_ssl_accept_setup(rb_fde_t *F, rb_fde_t *new_F, struct sockaddr *st, int addrlen)
1ac65021
WP
141{
142 return;
143}
144
145ssize_t
94b4fbf9 146rb_ssl_read(rb_fde_t *F, void *buf, size_t count)
1ac65021 147{
033be687
VY
148 errno = ENOSYS;
149 return -1;
1ac65021
WP
150}
151
152ssize_t
94b4fbf9 153rb_ssl_write(rb_fde_t *F, const void *buf, size_t count)
1ac65021 154{
033be687
VY
155 errno = ENOSYS;
156 return -1;
1ac65021
WP
157}
158
033be687
VY
159unsigned int
160rb_ssl_handshake_count(rb_fde_t *F)
161{
162 return 0;
163}
94b4fbf9
VY
164
165void
033be687
VY
166rb_ssl_clear_handshake_count(rb_fde_t *F)
167{
168 return;
169}
b57f37fb 170
f030cae8
VY
171void
172rb_get_ssl_info(char *buf, size_t len)
173{
174 rb_snprintf(buf, len, "Not compiled with SSL support");
175}
176
94b4fbf9 177#endif /* !HAVE_OPENSSL */