regress_ssl.c revision 1.3 1 1.3 christos /* $NetBSD: regress_ssl.c,v 1.3 2017/01/31 23:17:40 christos Exp $ */
2 1.1 christos /*
3 1.1 christos * Copyright (c) 2009-2012 Niels Provos and Nick Mathewson
4 1.1 christos *
5 1.1 christos * Redistribution and use in source and binary forms, with or without
6 1.1 christos * modification, are permitted provided that the following conditions
7 1.1 christos * are met:
8 1.1 christos * 1. Redistributions of source code must retain the above copyright
9 1.1 christos * notice, this list of conditions and the following disclaimer.
10 1.1 christos * 2. Redistributions in binary form must reproduce the above copyright
11 1.1 christos * notice, this list of conditions and the following disclaimer in the
12 1.1 christos * documentation and/or other materials provided with the distribution.
13 1.1 christos * 3. The name of the author may not be used to endorse or promote products
14 1.1 christos * derived from this software without specific prior written permission.
15 1.1 christos *
16 1.1 christos * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 1.1 christos * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 1.1 christos * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 1.1 christos * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 1.1 christos * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 1.1 christos * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 1.1 christos * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 1.1 christos * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 1.1 christos * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 1.1 christos * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 1.1 christos */
27 1.1 christos
28 1.3 christos // Get rid of OSX 10.7 and greater deprecation warnings.
29 1.3 christos #if defined(__APPLE__) && defined(__clang__)
30 1.3 christos #pragma clang diagnostic ignored "-Wdeprecated-declarations"
31 1.3 christos #endif
32 1.3 christos
33 1.3 christos #ifdef _WIN32
34 1.1 christos #include <winsock2.h>
35 1.1 christos #include <windows.h>
36 1.1 christos #endif
37 1.1 christos
38 1.3 christos #include "util-internal.h"
39 1.3 christos
40 1.3 christos #ifndef _WIN32
41 1.1 christos #include <sys/types.h>
42 1.1 christos #include <sys/socket.h>
43 1.1 christos #include <netinet/in.h>
44 1.1 christos #endif
45 1.1 christos
46 1.1 christos #include "event2/util.h"
47 1.1 christos #include "event2/event.h"
48 1.1 christos #include "event2/bufferevent_ssl.h"
49 1.3 christos #include "event2/bufferevent_struct.h"
50 1.1 christos #include "event2/buffer.h"
51 1.1 christos #include "event2/listener.h"
52 1.1 christos
53 1.1 christos #include "regress.h"
54 1.1 christos #include "tinytest.h"
55 1.1 christos #include "tinytest_macros.h"
56 1.1 christos
57 1.1 christos #include <openssl/bio.h>
58 1.1 christos #include <openssl/err.h>
59 1.1 christos #include <openssl/pem.h>
60 1.3 christos #include "openssl-compat.h"
61 1.1 christos
62 1.1 christos #include <string.h>
63 1.3 christos #ifdef _WIN32
64 1.3 christos #include <io.h>
65 1.3 christos #define read _read
66 1.3 christos #define write _write
67 1.3 christos #else
68 1.3 christos #include <unistd.h>
69 1.3 christos #endif
70 1.1 christos
71 1.3 christos /* A pre-generated key, to save the cost of doing an RSA key generation step
72 1.3 christos * during the unit tests. It is published in this file, so you would have to
73 1.3 christos * be very foolish to consider using it in your own code. */
74 1.1 christos static const char KEY[] =
75 1.1 christos "-----BEGIN RSA PRIVATE KEY-----\n"
76 1.3 christos "MIIEogIBAAKCAQEAtK07Ili0dkJb79m/sFmHoVJTWyLoveXex2yX/BtUzzcvZEOu\n"
77 1.3 christos "QLon/++5YOA48kzZm5K9mIwZkZhui1ZgJ5Bjq0LGAWTZGIn+NXjLFshPYvTKpOCW\n"
78 1.3 christos "uzL0Ir0LXMsBLYJQ5A4FomLNxs4I3H/dhDSGy/rSiJB1B4w2xNiwPK08/VL3zZqk\n"
79 1.3 christos "V+GsSvGIIkzhTMbqPJy9K8pqyjwOU2pgORS794yXciTGxWYjTDzJPgQ35YMDATaG\n"
80 1.3 christos "jr4HHo1zxU/Lj0pndSUK5rKLYxYQ3Uc8B3AVYDl9CP/GbOoQ4LBzS68JjcAUyp6i\n"
81 1.3 christos "6NfXlc2D9S9XgqVqwI+JqgJs0eW/+zPY2UEDWwIDAQABAoIBAD2HzV66FOM9YDAD\n"
82 1.3 christos "2RtGskEHV2nvLpIVadRCsFPkPvK+2X3s6rgSbbLkwh4y3lHuSCGKTNVZyQ9jeSos\n"
83 1.3 christos "xVxT+Q2HFQW+gYyw2gj91TQyDY8mzKhv8AVaqff2p5r3a7RC8CdqexK9UVUGL9Bg\n"
84 1.3 christos "H2F5vfpTtkVZ5PEoGDLblNFlMiMW/t1SobUeBVx+Msco/xqk9lFv1A9nnepGy0Gi\n"
85 1.3 christos "D+i6YNGTBsX22YhoCZl/ICxCL8lgqPei4FvBr9dBVh/jQgjuUBm2jz55p2r7+7Aw\n"
86 1.3 christos "khmXHReejoVokQ2+htgSgZNKlKuDy710ZpBqnDi8ynQi82Y2qCpyg/p/xcER54B6\n"
87 1.3 christos "hSftaiECgYEA2RkSoxU+nWk+BClQEUZRi88QK5W/M8oo1DvUs36hvPFkw3Jk/gz0\n"
88 1.3 christos "fgd5bnA+MXj0Fc0QHvbddPjIkyoI/evq9GPV+JYIuH5zabrlI3Jvya8q9QpAcEDO\n"
89 1.3 christos "KkL/O09qXVEW52S6l05nh4PLejyI7aTyTIN5nbVLac/+M8MY/qOjZksCgYEA1Q1o\n"
90 1.3 christos "L8kjSavU2xhQmSgZb9W62Do60sa3e73ljrDPoiyvbExldpSdziFYxHBD/Rep0ePf\n"
91 1.3 christos "eVSGS3VSwevt9/jSGo2Oa83TYYns9agBm03oR/Go/DukESdI792NsEM+PRFypVNy\n"
92 1.3 christos "AohWRLj0UU6DV+zLKp0VBavtx0ATeLFX0eN17TECgYBI2O/3Bz7uhQ0JSm+SjFz6\n"
93 1.3 christos "o+2SInp5P2G57aWu4VQWWY3tQ2p+EQzNaWam10UXRrXoxtmc+ktPX9e2AgnoYoyB\n"
94 1.3 christos "myqGcpnUhqHlnZAb999o9r1cYidDQ4uqhLauSTSwwXAFDzjJYsa8o03Y440y6QFh\n"
95 1.3 christos "CVD6yYXXqLJs3g96CqDexwKBgAHxq1+0QCQt8zVElYewO/svQhMzBNJjic0RQIT6\n"
96 1.3 christos "zAo4yij80XgxhvcYiszQEW6/xobpw2JCCS+rFGQ8mOFIXfJsFD6blDAxp/3d2JXo\n"
97 1.3 christos "MhRl+hrDGI4ng5zcsqxHEMxR2m/zwPiQ8eiSn3gWdVBaEsiCwmxY00ScKxFQ3PJH\n"
98 1.3 christos "Vw4hAoGAdZLd8KfjjG6lg7hfpVqavstqVi9LOgkHeCfdjn7JP+76kYrgLk/XdkrP\n"
99 1.3 christos "N/BHhtFVFjOi/mTQfQ5YfZImkm/1ePBy7437DT8BDkOxspa50kK4HPggHnU64h1w\n"
100 1.3 christos "lhdEOj7mAgHwGwwVZWOgs9Lq6vfztnSuhqjha1daESY6kDscPIQ=\n"
101 1.1 christos "-----END RSA PRIVATE KEY-----\n";
102 1.2 christos static void *xkey = __UNCONST(KEY);
103 1.1 christos
104 1.3 christos EVP_PKEY *
105 1.3 christos ssl_getkey(void)
106 1.1 christos {
107 1.1 christos EVP_PKEY *key;
108 1.1 christos BIO *bio;
109 1.1 christos
110 1.1 christos /* new read-only BIO backed by KEY. */
111 1.2 christos bio = BIO_new_mem_buf(xkey, -1);
112 1.1 christos tt_assert(bio);
113 1.1 christos
114 1.1 christos key = PEM_read_bio_PrivateKey(bio,NULL,NULL,NULL);
115 1.1 christos BIO_free(bio);
116 1.1 christos tt_assert(key);
117 1.1 christos
118 1.1 christos return key;
119 1.1 christos end:
120 1.1 christos return NULL;
121 1.1 christos }
122 1.1 christos
123 1.3 christos X509 *
124 1.3 christos ssl_getcert(void)
125 1.1 christos {
126 1.1 christos /* Dummy code to make a quick-and-dirty valid certificate with
127 1.1 christos OpenSSL. Don't copy this code into your own program! It does a
128 1.1 christos number of things in a stupid and insecure way. */
129 1.1 christos X509 *x509 = NULL;
130 1.1 christos X509_NAME *name = NULL;
131 1.3 christos EVP_PKEY *key = ssl_getkey();
132 1.1 christos int nid;
133 1.1 christos time_t now = time(NULL);
134 1.1 christos
135 1.1 christos tt_assert(key);
136 1.1 christos
137 1.1 christos x509 = X509_new();
138 1.1 christos tt_assert(x509);
139 1.1 christos tt_assert(0 != X509_set_version(x509, 2));
140 1.1 christos tt_assert(0 != ASN1_INTEGER_set(X509_get_serialNumber(x509),
141 1.1 christos (long)now));
142 1.1 christos
143 1.1 christos name = X509_NAME_new();
144 1.1 christos tt_assert(name);
145 1.1 christos nid = OBJ_txt2nid("commonName");
146 1.1 christos tt_assert(NID_undef != nid);
147 1.1 christos tt_assert(0 != X509_NAME_add_entry_by_NID(
148 1.2 christos name, nid, MBSTRING_ASC, __UNCONST("example.com"),
149 1.1 christos -1, -1, 0));
150 1.1 christos
151 1.1 christos X509_set_subject_name(x509, name);
152 1.1 christos X509_set_issuer_name(x509, name);
153 1.1 christos
154 1.1 christos X509_time_adj(X509_get_notBefore(x509), 0, &now);
155 1.1 christos now += 3600;
156 1.1 christos X509_time_adj(X509_get_notAfter(x509), 0, &now);
157 1.1 christos X509_set_pubkey(x509, key);
158 1.1 christos tt_assert(0 != X509_sign(x509, key, EVP_sha1()));
159 1.1 christos
160 1.1 christos return x509;
161 1.1 christos end:
162 1.1 christos X509_free(x509);
163 1.1 christos return NULL;
164 1.1 christos }
165 1.1 christos
166 1.1 christos static int disable_tls_11_and_12 = 0;
167 1.1 christos static SSL_CTX *the_ssl_ctx = NULL;
168 1.1 christos
169 1.3 christos SSL_CTX *
170 1.1 christos get_ssl_ctx(void)
171 1.1 christos {
172 1.1 christos if (the_ssl_ctx)
173 1.1 christos return the_ssl_ctx;
174 1.1 christos the_ssl_ctx = SSL_CTX_new(SSLv23_method());
175 1.1 christos if (!the_ssl_ctx)
176 1.1 christos return NULL;
177 1.1 christos if (disable_tls_11_and_12) {
178 1.1 christos #ifdef SSL_OP_NO_TLSv1_2
179 1.1 christos SSL_CTX_set_options(the_ssl_ctx, SSL_OP_NO_TLSv1_2);
180 1.1 christos #endif
181 1.1 christos #ifdef SSL_OP_NO_TLSv1_1
182 1.1 christos SSL_CTX_set_options(the_ssl_ctx, SSL_OP_NO_TLSv1_1);
183 1.1 christos #endif
184 1.1 christos }
185 1.1 christos return the_ssl_ctx;
186 1.1 christos }
187 1.1 christos
188 1.3 christos void
189 1.1 christos init_ssl(void)
190 1.1 christos {
191 1.3 christos #if OPENSSL_VERSION_NUMBER < 0x10100000L
192 1.1 christos SSL_library_init();
193 1.1 christos ERR_load_crypto_strings();
194 1.1 christos SSL_load_error_strings();
195 1.1 christos OpenSSL_add_all_algorithms();
196 1.1 christos if (SSLeay() != OPENSSL_VERSION_NUMBER) {
197 1.3 christos TT_DECLARE("WARN", ("Version mismatch for openssl: compiled with %lx but running with %lx", (unsigned long)OPENSSL_VERSION_NUMBER, (unsigned long) SSLeay()));
198 1.1 christos }
199 1.3 christos #endif
200 1.1 christos }
201 1.1 christos
202 1.1 christos /* ====================
203 1.1 christos Here's a simple test: we read a number from the input, increment it, and
204 1.1 christos reply, until we get to 1001.
205 1.1 christos */
206 1.1 christos
207 1.1 christos static int test_is_done = 0;
208 1.1 christos static int n_connected = 0;
209 1.1 christos static int got_close = 0;
210 1.1 christos static int got_error = 0;
211 1.3 christos static int got_timeout = 0;
212 1.1 christos static int renegotiate_at = -1;
213 1.1 christos static int stop_when_connected = 0;
214 1.1 christos static int pending_connect_events = 0;
215 1.1 christos static struct event_base *exit_base = NULL;
216 1.1 christos
217 1.3 christos enum regress_openssl_type
218 1.3 christos {
219 1.3 christos REGRESS_OPENSSL_SOCKETPAIR = 1,
220 1.3 christos REGRESS_OPENSSL_FILTER = 2,
221 1.3 christos REGRESS_OPENSSL_RENEGOTIATE = 4,
222 1.3 christos REGRESS_OPENSSL_OPEN = 8,
223 1.3 christos REGRESS_OPENSSL_DIRTY_SHUTDOWN = 16,
224 1.3 christos REGRESS_OPENSSL_FD = 32,
225 1.3 christos
226 1.3 christos REGRESS_OPENSSL_CLIENT = 64,
227 1.3 christos REGRESS_OPENSSL_SERVER = 128,
228 1.3 christos
229 1.3 christos REGRESS_OPENSSL_FREED = 256,
230 1.3 christos REGRESS_OPENSSL_TIMEOUT = 512,
231 1.3 christos REGRESS_OPENSSL_SLEEP = 1024,
232 1.3 christos
233 1.3 christos REGRESS_OPENSSL_CLIENT_WRITE = 2048,
234 1.3 christos };
235 1.3 christos
236 1.3 christos static void
237 1.3 christos bufferevent_openssl_check_fd(struct bufferevent *bev, int filter)
238 1.3 christos {
239 1.3 christos tt_int_op(bufferevent_getfd(bev), !=, -1);
240 1.3 christos tt_int_op(bufferevent_setfd(bev, -1), ==, 0);
241 1.3 christos if (filter) {
242 1.3 christos tt_int_op(bufferevent_getfd(bev), !=, -1);
243 1.3 christos } else {
244 1.3 christos tt_int_op(bufferevent_getfd(bev), ==, -1);
245 1.3 christos }
246 1.3 christos
247 1.3 christos end:
248 1.3 christos ;
249 1.3 christos }
250 1.3 christos static void
251 1.3 christos bufferevent_openssl_check_freed(struct bufferevent *bev)
252 1.3 christos {
253 1.3 christos tt_int_op(event_pending(&bev->ev_read, EVLIST_ALL, NULL), ==, 0);
254 1.3 christos tt_int_op(event_pending(&bev->ev_write, EVLIST_ALL, NULL), ==, 0);
255 1.3 christos
256 1.3 christos end:
257 1.3 christos ;
258 1.3 christos }
259 1.3 christos
260 1.1 christos static void
261 1.1 christos respond_to_number(struct bufferevent *bev, void *ctx)
262 1.1 christos {
263 1.1 christos struct evbuffer *b = bufferevent_get_input(bev);
264 1.1 christos char *line;
265 1.1 christos int n;
266 1.3 christos
267 1.3 christos enum regress_openssl_type type;
268 1.3 christos type = (enum regress_openssl_type)ctx;
269 1.3 christos
270 1.1 christos line = evbuffer_readln(b, NULL, EVBUFFER_EOL_LF);
271 1.1 christos if (! line)
272 1.1 christos return;
273 1.1 christos n = atoi(line);
274 1.1 christos if (n <= 0)
275 1.1 christos TT_FAIL(("Bad number: %s", line));
276 1.3 christos free(line);
277 1.1 christos TT_BLATHER(("The number was %d", n));
278 1.1 christos if (n == 1001) {
279 1.1 christos ++test_is_done;
280 1.1 christos bufferevent_free(bev); /* Should trigger close on other side. */
281 1.1 christos return;
282 1.1 christos }
283 1.3 christos if ((type & REGRESS_OPENSSL_CLIENT) && n == renegotiate_at) {
284 1.1 christos SSL_renegotiate(bufferevent_openssl_get_ssl(bev));
285 1.1 christos }
286 1.1 christos ++n;
287 1.1 christos evbuffer_add_printf(bufferevent_get_output(bev),
288 1.1 christos "%d\n", n);
289 1.1 christos TT_BLATHER(("Done reading; now writing."));
290 1.1 christos bufferevent_enable(bev, EV_WRITE);
291 1.1 christos bufferevent_disable(bev, EV_READ);
292 1.1 christos }
293 1.1 christos
294 1.1 christos static void
295 1.1 christos done_writing_cb(struct bufferevent *bev, void *ctx)
296 1.1 christos {
297 1.1 christos struct evbuffer *b = bufferevent_get_output(bev);
298 1.1 christos if (evbuffer_get_length(b))
299 1.1 christos return;
300 1.1 christos TT_BLATHER(("Done writing."));
301 1.1 christos bufferevent_disable(bev, EV_WRITE);
302 1.1 christos bufferevent_enable(bev, EV_READ);
303 1.1 christos }
304 1.1 christos
305 1.1 christos static void
306 1.1 christos eventcb(struct bufferevent *bev, short what, void *ctx)
307 1.1 christos {
308 1.3 christos enum regress_openssl_type type;
309 1.3 christos type = (enum regress_openssl_type)ctx;
310 1.3 christos
311 1.1 christos TT_BLATHER(("Got event %d", (int)what));
312 1.1 christos if (what & BEV_EVENT_CONNECTED) {
313 1.1 christos SSL *ssl;
314 1.1 christos X509 *peer_cert;
315 1.1 christos ++n_connected;
316 1.1 christos ssl = bufferevent_openssl_get_ssl(bev);
317 1.1 christos tt_assert(ssl);
318 1.1 christos peer_cert = SSL_get_peer_certificate(ssl);
319 1.3 christos if (type & REGRESS_OPENSSL_SERVER) {
320 1.1 christos tt_assert(peer_cert == NULL);
321 1.1 christos } else {
322 1.1 christos tt_assert(peer_cert != NULL);
323 1.1 christos }
324 1.1 christos if (stop_when_connected) {
325 1.1 christos if (--pending_connect_events == 0)
326 1.1 christos event_base_loopexit(exit_base, NULL);
327 1.1 christos }
328 1.3 christos
329 1.3 christos if ((type & REGRESS_OPENSSL_CLIENT_WRITE) && (type & REGRESS_OPENSSL_CLIENT))
330 1.3 christos evbuffer_add_printf(bufferevent_get_output(bev), "1\n");
331 1.1 christos } else if (what & BEV_EVENT_EOF) {
332 1.1 christos TT_BLATHER(("Got a good EOF"));
333 1.1 christos ++got_close;
334 1.3 christos if (type & REGRESS_OPENSSL_FD) {
335 1.3 christos bufferevent_openssl_check_fd(bev, type & REGRESS_OPENSSL_FILTER);
336 1.3 christos }
337 1.3 christos if (type & REGRESS_OPENSSL_FREED) {
338 1.3 christos bufferevent_openssl_check_freed(bev);
339 1.3 christos }
340 1.1 christos bufferevent_free(bev);
341 1.1 christos } else if (what & BEV_EVENT_ERROR) {
342 1.1 christos TT_BLATHER(("Got an error."));
343 1.1 christos ++got_error;
344 1.3 christos if (type & REGRESS_OPENSSL_FD) {
345 1.3 christos bufferevent_openssl_check_fd(bev, type & REGRESS_OPENSSL_FILTER);
346 1.3 christos }
347 1.3 christos if (type & REGRESS_OPENSSL_FREED) {
348 1.3 christos bufferevent_openssl_check_freed(bev);
349 1.3 christos }
350 1.3 christos bufferevent_free(bev);
351 1.3 christos } else if (what & BEV_EVENT_TIMEOUT) {
352 1.3 christos TT_BLATHER(("Got timeout."));
353 1.3 christos ++got_timeout;
354 1.3 christos if (type & REGRESS_OPENSSL_FD) {
355 1.3 christos bufferevent_openssl_check_fd(bev, type & REGRESS_OPENSSL_FILTER);
356 1.3 christos }
357 1.3 christos if (type & REGRESS_OPENSSL_FREED) {
358 1.3 christos bufferevent_openssl_check_freed(bev);
359 1.3 christos }
360 1.1 christos bufferevent_free(bev);
361 1.1 christos }
362 1.1 christos end:
363 1.1 christos ;
364 1.1 christos }
365 1.1 christos
366 1.1 christos static void
367 1.1 christos open_ssl_bufevs(struct bufferevent **bev1_out, struct bufferevent **bev2_out,
368 1.1 christos struct event_base *base, int is_open, int flags, SSL *ssl1, SSL *ssl2,
369 1.3 christos evutil_socket_t *fd_pair, struct bufferevent **underlying_pair,
370 1.3 christos enum regress_openssl_type type)
371 1.1 christos {
372 1.1 christos int state1 = is_open ? BUFFEREVENT_SSL_OPEN :BUFFEREVENT_SSL_CONNECTING;
373 1.1 christos int state2 = is_open ? BUFFEREVENT_SSL_OPEN :BUFFEREVENT_SSL_ACCEPTING;
374 1.3 christos int dirty_shutdown = type & REGRESS_OPENSSL_DIRTY_SHUTDOWN;
375 1.1 christos if (fd_pair) {
376 1.1 christos *bev1_out = bufferevent_openssl_socket_new(
377 1.1 christos base, fd_pair[0], ssl1, state1, flags);
378 1.1 christos *bev2_out = bufferevent_openssl_socket_new(
379 1.1 christos base, fd_pair[1], ssl2, state2, flags);
380 1.1 christos } else {
381 1.1 christos *bev1_out = bufferevent_openssl_filter_new(
382 1.1 christos base, underlying_pair[0], ssl1, state1, flags);
383 1.1 christos *bev2_out = bufferevent_openssl_filter_new(
384 1.1 christos base, underlying_pair[1], ssl2, state2, flags);
385 1.1 christos
386 1.1 christos }
387 1.1 christos bufferevent_setcb(*bev1_out, respond_to_number, done_writing_cb,
388 1.3 christos eventcb, (void*)(REGRESS_OPENSSL_CLIENT | (long)type));
389 1.1 christos bufferevent_setcb(*bev2_out, respond_to_number, done_writing_cb,
390 1.3 christos eventcb, (void*)(REGRESS_OPENSSL_SERVER | (long)type));
391 1.3 christos
392 1.3 christos bufferevent_openssl_set_allow_dirty_shutdown(*bev1_out, dirty_shutdown);
393 1.3 christos bufferevent_openssl_set_allow_dirty_shutdown(*bev2_out, dirty_shutdown);
394 1.1 christos }
395 1.1 christos
396 1.1 christos static void
397 1.1 christos regress_bufferevent_openssl(void *arg)
398 1.1 christos {
399 1.1 christos struct basic_test_data *data = arg;
400 1.1 christos
401 1.1 christos struct bufferevent *bev1, *bev2;
402 1.1 christos SSL *ssl1, *ssl2;
403 1.3 christos X509 *cert = ssl_getcert();
404 1.3 christos EVP_PKEY *key = ssl_getkey();
405 1.1 christos int flags = BEV_OPT_DEFER_CALLBACKS;
406 1.1 christos struct bufferevent *bev_ll[2] = { NULL, NULL };
407 1.1 christos evutil_socket_t *fd_pair = NULL;
408 1.1 christos
409 1.3 christos enum regress_openssl_type type;
410 1.3 christos type = (enum regress_openssl_type)data->setup_data;
411 1.3 christos
412 1.1 christos tt_assert(cert);
413 1.1 christos tt_assert(key);
414 1.1 christos
415 1.1 christos init_ssl();
416 1.1 christos
417 1.3 christos if (type & REGRESS_OPENSSL_RENEGOTIATE) {
418 1.1 christos if (SSLeay() >= 0x10001000 &&
419 1.1 christos SSLeay() < 0x1000104f) {
420 1.1 christos /* 1.0.1 up to 1.0.1c has a bug where TLS1.1 and 1.2
421 1.1 christos * can't renegotiate with themselves. Disable. */
422 1.1 christos disable_tls_11_and_12 = 1;
423 1.1 christos }
424 1.1 christos renegotiate_at = 600;
425 1.1 christos }
426 1.1 christos
427 1.1 christos ssl1 = SSL_new(get_ssl_ctx());
428 1.1 christos ssl2 = SSL_new(get_ssl_ctx());
429 1.1 christos
430 1.1 christos SSL_use_certificate(ssl2, cert);
431 1.1 christos SSL_use_PrivateKey(ssl2, key);
432 1.1 christos
433 1.3 christos if (!(type & REGRESS_OPENSSL_OPEN))
434 1.1 christos flags |= BEV_OPT_CLOSE_ON_FREE;
435 1.1 christos
436 1.3 christos if (!(type & REGRESS_OPENSSL_FILTER)) {
437 1.3 christos tt_assert(type & REGRESS_OPENSSL_SOCKETPAIR);
438 1.1 christos fd_pair = data->pair;
439 1.1 christos } else {
440 1.1 christos bev_ll[0] = bufferevent_socket_new(data->base, data->pair[0],
441 1.1 christos BEV_OPT_CLOSE_ON_FREE);
442 1.1 christos bev_ll[1] = bufferevent_socket_new(data->base, data->pair[1],
443 1.1 christos BEV_OPT_CLOSE_ON_FREE);
444 1.1 christos }
445 1.1 christos
446 1.1 christos open_ssl_bufevs(&bev1, &bev2, data->base, 0, flags, ssl1, ssl2,
447 1.3 christos fd_pair, bev_ll, type);
448 1.1 christos
449 1.3 christos if (!(type & REGRESS_OPENSSL_FILTER)) {
450 1.1 christos tt_int_op(bufferevent_getfd(bev1), ==, data->pair[0]);
451 1.1 christos } else {
452 1.1 christos tt_ptr_op(bufferevent_get_underlying(bev1), ==, bev_ll[0]);
453 1.1 christos }
454 1.1 christos
455 1.3 christos if (type & REGRESS_OPENSSL_OPEN) {
456 1.1 christos pending_connect_events = 2;
457 1.1 christos stop_when_connected = 1;
458 1.1 christos exit_base = data->base;
459 1.1 christos event_base_dispatch(data->base);
460 1.1 christos /* Okay, now the renegotiation is done. Make new
461 1.1 christos * bufferevents to test opening in BUFFEREVENT_SSL_OPEN */
462 1.1 christos flags |= BEV_OPT_CLOSE_ON_FREE;
463 1.1 christos bufferevent_free(bev1);
464 1.1 christos bufferevent_free(bev2);
465 1.1 christos bev1 = bev2 = NULL;
466 1.1 christos open_ssl_bufevs(&bev1, &bev2, data->base, 1, flags, ssl1, ssl2,
467 1.3 christos fd_pair, bev_ll, type);
468 1.1 christos }
469 1.1 christos
470 1.3 christos if (!(type & REGRESS_OPENSSL_TIMEOUT)) {
471 1.3 christos bufferevent_enable(bev1, EV_READ|EV_WRITE);
472 1.3 christos bufferevent_enable(bev2, EV_READ|EV_WRITE);
473 1.3 christos
474 1.3 christos if (!(type & REGRESS_OPENSSL_CLIENT_WRITE))
475 1.3 christos evbuffer_add_printf(bufferevent_get_output(bev1), "1\n");
476 1.3 christos
477 1.3 christos event_base_dispatch(data->base);
478 1.3 christos
479 1.3 christos tt_assert(test_is_done == 1);
480 1.3 christos tt_assert(n_connected == 2);
481 1.1 christos
482 1.3 christos /* We don't handle shutdown properly yet */
483 1.3 christos if (type & REGRESS_OPENSSL_DIRTY_SHUTDOWN) {
484 1.3 christos tt_int_op(got_close, ==, 1);
485 1.3 christos tt_int_op(got_error, ==, 0);
486 1.3 christos } else {
487 1.3 christos tt_int_op(got_error, ==, 1);
488 1.3 christos }
489 1.3 christos tt_int_op(got_timeout, ==, 0);
490 1.3 christos } else {
491 1.3 christos struct timeval t = { 2, 0 };
492 1.1 christos
493 1.3 christos bufferevent_enable(bev1, EV_READ|EV_WRITE);
494 1.3 christos bufferevent_disable(bev2, EV_READ|EV_WRITE);
495 1.1 christos
496 1.3 christos bufferevent_set_timeouts(bev1, &t, &t);
497 1.3 christos
498 1.3 christos if (!(type & REGRESS_OPENSSL_CLIENT_WRITE))
499 1.3 christos evbuffer_add_printf(bufferevent_get_output(bev1), "1\n");
500 1.3 christos
501 1.3 christos event_base_dispatch(data->base);
502 1.1 christos
503 1.3 christos tt_assert(test_is_done == 0);
504 1.3 christos tt_assert(n_connected == 0);
505 1.3 christos
506 1.3 christos tt_int_op(got_close, ==, 0);
507 1.3 christos tt_int_op(got_error, ==, 0);
508 1.3 christos tt_int_op(got_timeout, ==, 1);
509 1.3 christos }
510 1.1 christos end:
511 1.1 christos return;
512 1.1 christos }
513 1.1 christos
514 1.1 christos static void
515 1.3 christos acceptcb_deferred(evutil_socket_t fd, short events, void *arg)
516 1.3 christos {
517 1.3 christos struct bufferevent *bev = arg;
518 1.3 christos bufferevent_enable(bev, EV_READ|EV_WRITE);
519 1.3 christos }
520 1.3 christos static void
521 1.1 christos acceptcb(struct evconnlistener *listener, evutil_socket_t fd,
522 1.1 christos struct sockaddr *addr, int socklen, void *arg)
523 1.1 christos {
524 1.1 christos struct basic_test_data *data = arg;
525 1.1 christos struct bufferevent *bev;
526 1.3 christos enum regress_openssl_type type;
527 1.1 christos SSL *ssl = SSL_new(get_ssl_ctx());
528 1.1 christos
529 1.3 christos type = (enum regress_openssl_type)data->setup_data;
530 1.3 christos
531 1.3 christos SSL_use_certificate(ssl, ssl_getcert());
532 1.3 christos SSL_use_PrivateKey(ssl, ssl_getkey());
533 1.1 christos
534 1.1 christos bev = bufferevent_openssl_socket_new(
535 1.1 christos data->base,
536 1.1 christos fd,
537 1.1 christos ssl,
538 1.1 christos BUFFEREVENT_SSL_ACCEPTING,
539 1.1 christos BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS);
540 1.1 christos
541 1.1 christos bufferevent_setcb(bev, respond_to_number, NULL, eventcb,
542 1.3 christos (void*)(REGRESS_OPENSSL_SERVER));
543 1.1 christos
544 1.3 christos if (type & REGRESS_OPENSSL_SLEEP) {
545 1.3 christos struct timeval when = { 1, 0 };
546 1.3 christos event_base_once(data->base, -1, EV_TIMEOUT,
547 1.3 christos acceptcb_deferred, bev, &when);
548 1.3 christos bufferevent_disable(bev, EV_READ|EV_WRITE);
549 1.3 christos } else {
550 1.3 christos bufferevent_enable(bev, EV_READ|EV_WRITE);
551 1.3 christos }
552 1.1 christos
553 1.1 christos /* Only accept once, then disable ourself. */
554 1.1 christos evconnlistener_disable(listener);
555 1.1 christos }
556 1.1 christos
557 1.3 christos struct rwcount
558 1.3 christos {
559 1.3 christos int fd;
560 1.3 christos size_t read;
561 1.3 christos size_t write;
562 1.3 christos };
563 1.3 christos static int
564 1.3 christos bio_rwcount_new(BIO *b)
565 1.3 christos {
566 1.3 christos BIO_set_init(b, 0);
567 1.3 christos BIO_set_data(b, NULL);
568 1.3 christos return 1;
569 1.3 christos }
570 1.3 christos static int
571 1.3 christos bio_rwcount_free(BIO *b)
572 1.3 christos {
573 1.3 christos if (!b)
574 1.3 christos return 0;
575 1.3 christos if (BIO_get_shutdown(b)) {
576 1.3 christos BIO_set_init(b, 0);
577 1.3 christos BIO_set_data(b, NULL);
578 1.3 christos }
579 1.3 christos return 1;
580 1.3 christos }
581 1.3 christos static int
582 1.3 christos bio_rwcount_read(BIO *b, char *out, int outlen)
583 1.3 christos {
584 1.3 christos struct rwcount *rw = BIO_get_data(b);
585 1.3 christos ev_ssize_t ret = recv(rw->fd, out, outlen, 0);
586 1.3 christos ++rw->read;
587 1.3 christos if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
588 1.3 christos BIO_set_retry_read(b);
589 1.3 christos }
590 1.3 christos return ret;
591 1.3 christos }
592 1.3 christos static int
593 1.3 christos bio_rwcount_write(BIO *b, const char *in, int inlen)
594 1.3 christos {
595 1.3 christos
596 1.3 christos struct rwcount *rw = BIO_get_data(b);
597 1.3 christos ev_ssize_t ret = send(rw->fd, in, inlen, 0);
598 1.3 christos ++rw->write;
599 1.3 christos if (ret == -1 && EVUTIL_ERR_RW_RETRIABLE(EVUTIL_SOCKET_ERROR())) {
600 1.3 christos BIO_set_retry_write(b);
601 1.3 christos }
602 1.3 christos return ret;
603 1.3 christos }
604 1.3 christos static long
605 1.3 christos bio_rwcount_ctrl(BIO *b, int cmd, long num, void *ptr)
606 1.3 christos {
607 1.3 christos long ret = 0;
608 1.3 christos switch (cmd) {
609 1.3 christos case BIO_CTRL_GET_CLOSE:
610 1.3 christos ret = BIO_get_shutdown(b);
611 1.3 christos break;
612 1.3 christos case BIO_CTRL_SET_CLOSE:
613 1.3 christos BIO_set_shutdown(b, (int)num);
614 1.3 christos break;
615 1.3 christos case BIO_CTRL_PENDING:
616 1.3 christos ret = 0;
617 1.3 christos break;
618 1.3 christos case BIO_CTRL_WPENDING:
619 1.3 christos ret = 0;
620 1.3 christos break;
621 1.3 christos case BIO_CTRL_DUP:
622 1.3 christos case BIO_CTRL_FLUSH:
623 1.3 christos ret = 1;
624 1.3 christos break;
625 1.3 christos }
626 1.3 christos return ret;
627 1.3 christos }
628 1.3 christos static int
629 1.3 christos bio_rwcount_puts(BIO *b, const char *s)
630 1.3 christos {
631 1.3 christos return bio_rwcount_write(b, s, strlen(s));
632 1.3 christos }
633 1.3 christos #define BIO_TYPE_LIBEVENT_RWCOUNT 0xff1
634 1.3 christos static BIO_METHOD *methods_rwcount;
635 1.3 christos
636 1.3 christos static BIO_METHOD *
637 1.3 christos BIO_s_rwcount(void)
638 1.3 christos {
639 1.3 christos if (methods_rwcount == NULL) {
640 1.3 christos methods_rwcount = BIO_meth_new(BIO_TYPE_LIBEVENT_RWCOUNT, "rwcount");
641 1.3 christos if (methods_rwcount == NULL)
642 1.3 christos return NULL;
643 1.3 christos BIO_meth_set_write(methods_rwcount, bio_rwcount_write);
644 1.3 christos BIO_meth_set_read(methods_rwcount, bio_rwcount_read);
645 1.3 christos BIO_meth_set_puts(methods_rwcount, bio_rwcount_puts);
646 1.3 christos BIO_meth_set_ctrl(methods_rwcount, bio_rwcount_ctrl);
647 1.3 christos BIO_meth_set_create(methods_rwcount, bio_rwcount_new);
648 1.3 christos BIO_meth_set_destroy(methods_rwcount, bio_rwcount_free);
649 1.3 christos }
650 1.3 christos return methods_rwcount;
651 1.3 christos }
652 1.3 christos static BIO *
653 1.3 christos BIO_new_rwcount(int close_flag)
654 1.3 christos {
655 1.3 christos BIO *result;
656 1.3 christos if (!(result = BIO_new(BIO_s_rwcount())))
657 1.3 christos return NULL;
658 1.3 christos BIO_set_init(result, 1);
659 1.3 christos BIO_set_data(result, NULL);
660 1.3 christos BIO_set_shutdown(result, !!close_flag);
661 1.3 christos return result;
662 1.3 christos }
663 1.3 christos
664 1.1 christos static void
665 1.1 christos regress_bufferevent_openssl_connect(void *arg)
666 1.1 christos {
667 1.1 christos struct basic_test_data *data = arg;
668 1.1 christos
669 1.1 christos struct event_base *base = data->base;
670 1.1 christos
671 1.1 christos struct evconnlistener *listener;
672 1.1 christos struct bufferevent *bev;
673 1.1 christos struct sockaddr_in sin;
674 1.1 christos struct sockaddr_storage ss;
675 1.1 christos ev_socklen_t slen;
676 1.3 christos SSL *ssl;
677 1.3 christos BIO *bio;
678 1.3 christos struct rwcount rw = { -1, 0, 0 };
679 1.3 christos enum regress_openssl_type type;
680 1.3 christos
681 1.3 christos type = (enum regress_openssl_type)data->setup_data;
682 1.1 christos
683 1.1 christos init_ssl();
684 1.1 christos
685 1.1 christos memset(&sin, 0, sizeof(sin));
686 1.1 christos sin.sin_family = AF_INET;
687 1.1 christos sin.sin_addr.s_addr = htonl(0x7f000001);
688 1.1 christos
689 1.1 christos memset(&ss, 0, sizeof(ss));
690 1.1 christos slen = sizeof(ss);
691 1.1 christos
692 1.1 christos listener = evconnlistener_new_bind(base, acceptcb, data,
693 1.1 christos LEV_OPT_CLOSE_ON_FREE|LEV_OPT_REUSEABLE,
694 1.1 christos -1, (struct sockaddr *)&sin, sizeof(sin));
695 1.1 christos
696 1.1 christos tt_assert(listener);
697 1.1 christos tt_assert(evconnlistener_get_fd(listener) >= 0);
698 1.1 christos
699 1.3 christos ssl = SSL_new(get_ssl_ctx());
700 1.3 christos tt_assert(ssl);
701 1.3 christos
702 1.1 christos bev = bufferevent_openssl_socket_new(
703 1.3 christos data->base, -1, ssl,
704 1.1 christos BUFFEREVENT_SSL_CONNECTING,
705 1.1 christos BEV_OPT_CLOSE_ON_FREE|BEV_OPT_DEFER_CALLBACKS);
706 1.1 christos tt_assert(bev);
707 1.1 christos
708 1.1 christos bufferevent_setcb(bev, respond_to_number, NULL, eventcb,
709 1.3 christos (void*)(REGRESS_OPENSSL_CLIENT));
710 1.1 christos
711 1.1 christos tt_assert(getsockname(evconnlistener_get_fd(listener),
712 1.1 christos (struct sockaddr*)&ss, &slen) == 0);
713 1.1 christos tt_assert(slen == sizeof(struct sockaddr_in));
714 1.1 christos tt_int_op(((struct sockaddr*)&ss)->sa_family, ==, AF_INET);
715 1.1 christos
716 1.1 christos tt_assert(0 ==
717 1.1 christos bufferevent_socket_connect(bev, (struct sockaddr*)&ss, slen));
718 1.3 christos /* Possible only when we have fd, since be_openssl can and will overwrite
719 1.3 christos * bio otherwise before */
720 1.3 christos if (type & REGRESS_OPENSSL_SLEEP) {
721 1.3 christos rw.fd = bufferevent_getfd(bev);
722 1.3 christos bio = BIO_new_rwcount(0);
723 1.3 christos tt_assert(bio);
724 1.3 christos BIO_set_data(bio, &rw);
725 1.3 christos SSL_set_bio(ssl, bio, bio);
726 1.3 christos }
727 1.1 christos evbuffer_add_printf(bufferevent_get_output(bev), "1\n");
728 1.1 christos bufferevent_enable(bev, EV_READ|EV_WRITE);
729 1.1 christos
730 1.1 christos event_base_dispatch(base);
731 1.3 christos
732 1.3 christos tt_int_op(rw.read, <=, 100);
733 1.3 christos tt_int_op(rw.write, <=, 100);
734 1.1 christos end:
735 1.1 christos ;
736 1.1 christos }
737 1.1 christos
738 1.1 christos struct testcase_t ssl_testcases[] = {
739 1.3 christos #define T(a) ((void *)(a))
740 1.3 christos { "bufferevent_socketpair", regress_bufferevent_openssl,
741 1.3 christos TT_ISOLATED, &basic_setup, T(REGRESS_OPENSSL_SOCKETPAIR) },
742 1.3 christos { "bufferevent_socketpair_write_after_connect", regress_bufferevent_openssl,
743 1.3 christos TT_ISOLATED, &basic_setup,
744 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR|REGRESS_OPENSSL_CLIENT_WRITE) },
745 1.1 christos { "bufferevent_filter", regress_bufferevent_openssl,
746 1.3 christos TT_ISOLATED, &basic_setup, T(REGRESS_OPENSSL_FILTER) },
747 1.3 christos { "bufferevent_filter_write_after_connect", regress_bufferevent_openssl,
748 1.3 christos TT_ISOLATED, &basic_setup,
749 1.3 christos T(REGRESS_OPENSSL_FILTER|REGRESS_OPENSSL_CLIENT_WRITE) },
750 1.1 christos { "bufferevent_renegotiate_socketpair", regress_bufferevent_openssl,
751 1.3 christos TT_ISOLATED, &basic_setup,
752 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_RENEGOTIATE) },
753 1.1 christos { "bufferevent_renegotiate_filter", regress_bufferevent_openssl,
754 1.3 christos TT_ISOLATED, &basic_setup,
755 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_RENEGOTIATE) },
756 1.1 christos { "bufferevent_socketpair_startopen", regress_bufferevent_openssl,
757 1.3 christos TT_ISOLATED, &basic_setup,
758 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_OPEN) },
759 1.1 christos { "bufferevent_filter_startopen", regress_bufferevent_openssl,
760 1.3 christos TT_ISOLATED, &basic_setup,
761 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_OPEN) },
762 1.3 christos
763 1.3 christos { "bufferevent_socketpair_dirty_shutdown", regress_bufferevent_openssl,
764 1.3 christos TT_ISOLATED, &basic_setup,
765 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
766 1.3 christos { "bufferevent_filter_dirty_shutdown", regress_bufferevent_openssl,
767 1.3 christos TT_ISOLATED, &basic_setup,
768 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
769 1.3 christos { "bufferevent_renegotiate_socketpair_dirty_shutdown",
770 1.3 christos regress_bufferevent_openssl,
771 1.3 christos TT_ISOLATED,
772 1.3 christos &basic_setup,
773 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_RENEGOTIATE | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
774 1.3 christos { "bufferevent_renegotiate_filter_dirty_shutdown",
775 1.3 christos regress_bufferevent_openssl,
776 1.3 christos TT_ISOLATED,
777 1.3 christos &basic_setup,
778 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_RENEGOTIATE | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
779 1.3 christos { "bufferevent_socketpair_startopen_dirty_shutdown",
780 1.3 christos regress_bufferevent_openssl,
781 1.3 christos TT_ISOLATED, &basic_setup,
782 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_OPEN | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
783 1.3 christos { "bufferevent_filter_startopen_dirty_shutdown",
784 1.3 christos regress_bufferevent_openssl,
785 1.3 christos TT_ISOLATED, &basic_setup,
786 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_OPEN | REGRESS_OPENSSL_DIRTY_SHUTDOWN) },
787 1.3 christos
788 1.3 christos { "bufferevent_socketpair_fd", regress_bufferevent_openssl,
789 1.3 christos TT_ISOLATED, &basic_setup,
790 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_FD) },
791 1.3 christos { "bufferevent_socketpair_freed", regress_bufferevent_openssl,
792 1.3 christos TT_ISOLATED, &basic_setup,
793 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_FREED) },
794 1.3 christos { "bufferevent_socketpair_freed_fd", regress_bufferevent_openssl,
795 1.3 christos TT_ISOLATED, &basic_setup,
796 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_FREED | REGRESS_OPENSSL_FD) },
797 1.3 christos { "bufferevent_filter_freed_fd", regress_bufferevent_openssl,
798 1.3 christos TT_ISOLATED, &basic_setup,
799 1.3 christos T(REGRESS_OPENSSL_FILTER | REGRESS_OPENSSL_FREED | REGRESS_OPENSSL_FD) },
800 1.3 christos
801 1.3 christos { "bufferevent_socketpair_timeout", regress_bufferevent_openssl,
802 1.3 christos TT_ISOLATED, &basic_setup,
803 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_TIMEOUT) },
804 1.3 christos { "bufferevent_socketpair_timeout_freed_fd", regress_bufferevent_openssl,
805 1.3 christos TT_ISOLATED, &basic_setup,
806 1.3 christos T(REGRESS_OPENSSL_SOCKETPAIR | REGRESS_OPENSSL_TIMEOUT | REGRESS_OPENSSL_FREED | REGRESS_OPENSSL_FD) },
807 1.1 christos
808 1.1 christos { "bufferevent_connect", regress_bufferevent_openssl_connect,
809 1.1 christos TT_FORK|TT_NEED_BASE, &basic_setup, NULL },
810 1.3 christos { "bufferevent_connect_sleep", regress_bufferevent_openssl_connect,
811 1.3 christos TT_FORK|TT_NEED_BASE, &basic_setup, T(REGRESS_OPENSSL_SLEEP) },
812 1.3 christos
813 1.3 christos #undef T
814 1.1 christos
815 1.1 christos END_OF_TESTCASES,
816 1.1 christos };
817