25 struct ssl_session_st;
26 typedef struct ssl_ctx_st tor_tls_context_impl_t;
27 typedef struct ssl_st tor_tls_impl_t;
30 typedef struct PRFileDesc tor_tls_context_impl_t;
31 typedef struct PRFileDesc tor_tls_impl_t;
35 struct tor_x509_cert_t;
38 #define MIN_TOR_TLS_ERROR_VAL_ -9
39 #define TOR_TLS_ERROR_MISC -9
41 #define TOR_TLS_ERROR_IO -8
42 #define TOR_TLS_ERROR_CONNREFUSED -7
43 #define TOR_TLS_ERROR_CONNRESET -6
44 #define TOR_TLS_ERROR_NO_ROUTE -5
45 #define TOR_TLS_ERROR_TIMEOUT -4
46 #define TOR_TLS_CLOSE -3
47 #define TOR_TLS_WANTREAD -2
48 #define TOR_TLS_WANTWRITE -1
49 #define TOR_TLS_DONE 0
53 #define CASE_TOR_TLS_ERROR_ANY_NONIO \
54 case TOR_TLS_ERROR_MISC: \
55 case TOR_TLS_ERROR_CONNREFUSED: \
56 case TOR_TLS_ERROR_CONNRESET: \
57 case TOR_TLS_ERROR_NO_ROUTE: \
58 case TOR_TLS_ERROR_TIMEOUT
62 #define CASE_TOR_TLS_ERROR_ANY \
63 CASE_TOR_TLS_ERROR_ANY_NONIO: \
66 #define TOR_TLS_IS_ERROR(rv) ((rv) < TOR_TLS_CLOSE)
77 #define TOR_TLS_CTX_IS_PUBLIC_SERVER (1u<<0)
78 #define TOR_TLS_CTX_USE_ECDHE_P256 (1u<<1)
79 #define TOR_TLS_CTX_USE_ECDHE_P224 (1u<<2)
88 unsigned int key_lifetime);
100 #define tor_tls_free(tls) FREE_AND_NULL(tor_tls_t, tor_tls_free_, (tls))
116 size_t *n_read,
size_t *n_written);
119 size_t *rbuf_capacity,
size_t *rbuf_bytes,
120 size_t *wbuf_capacity,
size_t *wbuf_bytes);
125 int tor_tls_get_num_server_handshakes(
tor_tls_t *tls);
128 const struct tor_x509_cert_t *cert));
130 #ifdef ENABLE_OPENSSL
132 #define HAVE_WORKING_TOR_TLS_GET_TLSSECRETS
136 const uint8_t *context,
140 #ifdef ENABLE_OPENSSL
143 #define check_no_tls_errors() check_no_tls_errors_(__FILE__,__LINE__)
144 void check_no_tls_errors_(
const char *fname,
int line);
146 void tor_tls_log_one_error(
tor_tls_t *tls,
unsigned long err,
147 int severity,
int domain,
const char *doing);
149 #define check_no_tls_errors() STMT_NIL
153 const struct tor_x509_cert_t **link_cert_out,
154 const struct tor_x509_cert_t **id_cert_out);
157 const char *tor_tls_get_ciphersuite_name(
tor_tls_t *tls);
Headers for crypto_rsa.c.
Declarations for types used throughout the Tor networking system.
Macros to implement mocking and selective exposure for the test code.
#define MOCK_DECL(rv, funcname, arglist)
int tor_tls_get_my_certs(int server, const tor_x509_cert_t **link_cert_out, const tor_x509_cert_t **id_cert_out)
int tor_tls_server_got_renegotiate(tor_tls_t *tls)
struct tor_x509_cert_t * tor_tls_get_peer_cert(tor_tls_t *tls)
void tor_tls_block_renegotiation(tor_tls_t *tls)
int tor_tls_peer_has_cert(tor_tls_t *tls)
int tor_tls_context_init(unsigned flags, crypto_pk_t *client_identity, crypto_pk_t *server_identity, unsigned int key_lifetime)
int tor_tls_used_v1_handshake(tor_tls_t *tls)
void tor_tls_get_n_raw_bytes(tor_tls_t *tls, size_t *n_read, size_t *n_written)
void tor_tls_context_incref(tor_tls_context_t *ctx)
int tor_tls_read(tor_tls_t *tls, char *cp, size_t len)
void tor_tls_unblock_renegotiation(tor_tls_t *tls)
double tls_get_write_overhead_ratio(void)
int evaluate_ecgroup_for_tls(const char *ecgroup)
void tor_tls_context_decref(tor_tls_context_t *ctx)
void tor_tls_assert_renegotiation_unblocked(tor_tls_t *tls)
void tor_tls_set_renegotiate_callback(tor_tls_t *tls, void(*cb)(tor_tls_t *, void *arg), void *arg)
int tor_tls_write(tor_tls_t *tls, const char *cp, size_t n)
void tor_tls_free_(tor_tls_t *tls)
int tor_tls_get_buffer_sizes(tor_tls_t *tls, size_t *rbuf_capacity, size_t *rbuf_bytes, size_t *wbuf_capacity, size_t *wbuf_bytes)
crypto_pk_t * tor_tls_get_my_client_auth_key(void)
int tor_tls_is_server(tor_tls_t *tls)
tor_tls_context_t * tor_tls_context_get(int is_server)
void tor_tls_set_logged_address(tor_tls_t *tls, const char *address)
int tor_tls_get_pending_bytes(tor_tls_t *tls)
int tor_tls_handshake(tor_tls_t *tls)
struct tor_x509_cert_t * tor_tls_get_own_cert(tor_tls_t *tls)
const char * tor_tls_err_to_string(int err)
const char * tor_tls_get_last_error_msg(const tor_tls_t *tls)
int tor_tls_finish_handshake(tor_tls_t *tls)
void tls_log_errors(tor_tls_t *tls, int severity, int domain, const char *doing)
int tor_tls_get_tlssecrets(tor_tls_t *tls, uint8_t *secrets_out)
void tor_tls_free_all(void)
void tor_tls_get_state_description(tor_tls_t *tls, char *buf, size_t sz)
void tor_tls_release_socket(tor_tls_t *tls)
tor_tls_t * tor_tls_new(tor_socket_t sock, int is_server)
int tor_tls_verify(int severity, tor_tls_t *tls, crypto_pk_t **identity)
int tor_tls_export_key_material(tor_tls_t *tls, uint8_t *secrets_out, const uint8_t *context, size_t context_len, const char *label)
size_t tor_tls_get_forced_write_size(tor_tls_t *tls)