tls_init.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. /*
  2. * TLS module
  3. *
  4. * Copyright (C) 2005,2006 iptelorg GmbH
  5. *
  6. * Permission to use, copy, modify, and distribute this software for any
  7. * purpose with or without fee is hereby granted, provided that the above
  8. * copyright notice and this permission notice appear in all copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  11. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  12. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  13. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  14. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  15. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  16. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /*!
  19. * \file
  20. * \brief Kamailio TLS support :: OpenSSL initialization funtions
  21. * \ingroup tls
  22. * Module: \ref tls
  23. */
  24. #ifndef _TLS_INIT_H
  25. #define _TLS_INIT_H
  26. #include <openssl/ssl.h>
  27. #include "../../ip_addr.h"
  28. #include "tls_domain.h"
  29. /* openssl < 1. 0 */
  30. #if OPENSSL_VERSION_NUMBER < 0x01000000L
  31. /* alternative: check ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME */
  32. #define OPENSSL_NO_TLSEXT
  33. #endif /* OPENSSL_VERION < 1.0 */
  34. #ifndef OPENSSL_NO_KRB5
  35. /* enable workarround for openssl kerberos wrong malloc bug
  36. * (kssl code uses libc malloc/free/calloc instead of OPENSSL_malloc &
  37. * friends)*/
  38. #define TLS_KSSL_WORKARROUND
  39. extern int openssl_kssl_malloc_bug; /* is openssl bug #1467 present ? */
  40. #endif
  41. extern const SSL_METHOD* ssl_methods[];
  42. /*
  43. * just once, pre-initialize the tls subsystem
  44. */
  45. int tls_pre_init(void);
  46. /**
  47. * just once, prepare for init of all modules
  48. */
  49. int tls_mod_pre_init_h(void);
  50. /*
  51. * just once, initialize the tls subsystem after all mod inits
  52. */
  53. int init_tls_h(void);
  54. /*
  55. * just once before cleanup
  56. */
  57. void destroy_tls_h(void);
  58. /*
  59. * for each socket
  60. */
  61. int tls_h_init_si(struct socket_info *si);
  62. /*
  63. * Make sure that all server domains in the configuration have corresponding
  64. * listening socket in SER
  65. */
  66. int tls_check_sockets(tls_domains_cfg_t* cfg);
  67. #endif /* _TLS_INIT_H */