1 /*- 2 * SSLsplit - transparent SSL/TLS interception 3 * https://www.roe.ch/SSLsplit 4 * 5 * Copyright (c) 2009-2019, Daniel Roethlisberger <daniel@roe.ch>. 6 * Copyright (c) 2017-2021, Soner Tari <sonertari@gmail.com>. 7 * All rights reserved. 8 * 9 * Redistribution and use in source and binary forms, with or without 10 * modification, are permitted provided that the following conditions are met: 11 * 1. Redistributions of source code must retain the above copyright notice, 12 * this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright notice, 14 * this list of conditions and the following disclaimer in the documentation 15 * and/or other materials provided with the distribution. 16 * 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS'' 18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 21 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27 * POSSIBILITY OF SUCH DAMAGE. 28 */ 29 30 #ifndef PROTOSSL_H 31 #define PROTOSSL_H 32 33 #include "pxyconn.h" 34 35 int protossl_log_masterkey(pxy_conn_ctx_t *, pxy_conn_desc_t *) NONNULL(1,2); 36 void protossl_log_ssl_error(struct bufferevent *, pxy_conn_ctx_t *) NONNULL(1,2); 37 38 // @todo Used externally by pxy_log_connect_src(), create tcp and ssl versions of that function instead? 39 void protossl_srccert_write(pxy_conn_ctx_t *) NONNULL(1); 40 SSL *protossl_dstssl_create(pxy_conn_ctx_t *) NONNULL(1); 41 42 void protossl_free(pxy_conn_ctx_t *) NONNULL(1); 43 void protossl_init_conn(evutil_socket_t, short, void *); 44 int protossl_conn_connect(pxy_conn_ctx_t *) NONNULL(1) WUNRES; 45 void protossl_connect_child(pxy_conn_child_ctx_t *) NONNULL(1); 46 47 int protossl_enable_src(pxy_conn_ctx_t *) NONNULL(1); 48 49 int protossl_setup_src_ssl_from_dst(pxy_conn_ctx_t *) NONNULL(1); 50 int protossl_setup_src_ssl_from_child_dst(pxy_conn_child_ctx_t *) NONNULL(1); 51 int protossl_setup_src_new_bev_ssl_accepting(pxy_conn_ctx_t *) NONNULL(1); 52 53 int protossl_setup_dst_ssl(pxy_conn_ctx_t *) NONNULL(1); 54 int protossl_setup_dst_new_bev_ssl_connecting(pxy_conn_ctx_t *) NONNULL(1); 55 int protossl_setup_dst_ssl_child(pxy_conn_child_ctx_t *) NONNULL(1); 56 int protossl_setup_dst_new_bev_ssl_connecting_child(pxy_conn_child_ctx_t *) NONNULL(1); 57 int protossl_setup_dst_child(pxy_conn_child_ctx_t *) NONNULL(1); 58 59 int protossl_setup_srvdst(pxy_conn_ctx_t *ctx) NONNULL(1); 60 61 void protossl_bev_eventcb_srvdst(struct bufferevent *, short, pxy_conn_ctx_t *) NONNULL(1); 62 63 void protossl_bev_eventcb(struct bufferevent *, short, void *) NONNULL(1); 64 void protossl_bev_eventcb_child(struct bufferevent *, short, void *) NONNULL(1); 65 66 protocol_t protossl_setup(pxy_conn_ctx_t *) NONNULL(1); 67 protocol_t protossl_setup_child(pxy_conn_child_ctx_t *) NONNULL(1); 68 69 #endif /* PROTOSSL_H */ 70