tortls_internal.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /* Copyright (c) 2003, Roger Dingledine
  2. * Copyright (c) 2004-2006, Roger Dingledine, Nick Mathewson.
  3. * Copyright (c) 2007-2018, The Tor Project, Inc. */
  4. /* See LICENSE for licensing information */
  5. #ifndef TORTLS_INTERNAL_H
  6. #define TORTLS_INTERNAL_H
  7. int tor_errno_to_tls_error(int e);
  8. #ifdef ENABLE_OPENSSL
  9. int tor_tls_get_error(tor_tls_t *tls, int r, int extra,
  10. const char *doing, int severity, int domain);
  11. #endif
  12. MOCK_DECL(void, try_to_extract_certs_from_tls,
  13. (int severity, tor_tls_t *tls,
  14. tor_x509_cert_impl_t **cert_out,
  15. tor_x509_cert_impl_t **id_cert_out));
  16. tor_tls_context_t *tor_tls_context_new(crypto_pk_t *identity,
  17. unsigned int key_lifetime, unsigned flags, int is_client);
  18. int tor_tls_context_init_one(tor_tls_context_t **ppcontext,
  19. crypto_pk_t *identity,
  20. unsigned int key_lifetime,
  21. unsigned int flags,
  22. int is_client);
  23. int tor_tls_context_init_certificates(tor_tls_context_t *result,
  24. crypto_pk_t *identity,
  25. unsigned key_lifetime,
  26. unsigned flags);
  27. void tor_tls_impl_free_(tor_tls_impl_t *ssl);
  28. void tor_tls_context_impl_free(tor_tls_context_impl_t *);
  29. #ifdef ENABLE_OPENSSL
  30. tor_tls_t *tor_tls_get_by_ssl(const struct ssl_st *ssl);
  31. int tor_tls_client_is_using_v2_ciphers(const struct ssl_st *ssl);
  32. void tor_tls_debug_state_callback(const struct ssl_st *ssl,
  33. int type, int val);
  34. void tor_tls_server_info_callback(const struct ssl_st *ssl,
  35. int type, int val);
  36. void tor_tls_allocate_tor_tls_object_ex_data_index(void);
  37. #if !defined(HAVE_SSL_SESSION_GET_MASTER_KEY)
  38. size_t SSL_SESSION_get_master_key(struct ssl_session_st *s,
  39. uint8_t *out,
  40. size_t len);
  41. #endif
  42. #ifdef TORTLS_OPENSSL_PRIVATE
  43. int always_accept_verify_cb(int preverify_ok, X509_STORE_CTX *x509_ctx);
  44. int tor_tls_classify_client_ciphers(const struct ssl_st *ssl,
  45. STACK_OF(SSL_CIPHER) *peer_ciphers);
  46. STATIC int tor_tls_session_secret_cb(struct ssl_st *ssl, void *secret,
  47. int *secret_len,
  48. STACK_OF(SSL_CIPHER) *peer_ciphers,
  49. CONST_IF_OPENSSL_1_1_API SSL_CIPHER **cipher,
  50. void *arg);
  51. STATIC int find_cipher_by_id(const SSL *ssl, const SSL_METHOD *m,
  52. uint16_t cipher);
  53. #endif
  54. #endif
  55. #ifdef TOR_UNIT_TESTS
  56. extern int tor_tls_object_ex_data_index;
  57. extern tor_tls_context_t *server_tls_context;
  58. extern tor_tls_context_t *client_tls_context;
  59. extern uint16_t v2_cipher_list[];
  60. extern uint64_t total_bytes_written_over_tls;
  61. extern uint64_t total_bytes_written_by_tls;
  62. #endif /* defined(TOR_UNIT_TESTS) */
  63. #endif /* defined(TORTLS_INTERNAL_H) */