tls_init.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. /*
  2. * $Id$
  3. *
  4. * TLS module - OpenSSL initialization funtions
  5. *
  6. * Copyright (C) 2001-2003 FhG FOKUS
  7. * Copyright (C) 2004,2005 Free Software Foundation, Inc.
  8. * Copyright (C) 2005,2006 iptelorg GmbH
  9. *
  10. * This file is part of ser, a free SIP server.
  11. *
  12. * ser is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License as published by
  14. * the Free Software Foundation; either version 2 of the License, or
  15. * (at your option) any later version
  16. *
  17. * For a license to use the ser software under conditions
  18. * other than those described here, or to purchase support for this
  19. * software, please contact iptel.org by e-mail at the following addresses:
  20. * [email protected]
  21. *
  22. * ser is distributed in the hope that it will be useful,
  23. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. * GNU General Public License for more details.
  26. *
  27. * You should have received a copy of the GNU General Public License
  28. * along with this program; if not, write to the Free Software
  29. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  30. */
  31. /*!
  32. * \file
  33. * \brief SIP-router TLS support :: OpenSSL initialization funtions
  34. * \ingroup tls
  35. * Module: \ref tls
  36. */
  37. #ifndef _TLS_INIT_H
  38. #define _TLS_INIT_H
  39. #include <openssl/ssl.h>
  40. #include "../../ip_addr.h"
  41. #include "tls_domain.h"
  42. /* openssl < 1. 0 */
  43. #if OPENSSL_VERSION_NUMBER < 0x01000000L
  44. /* alternative: check ifdef SSL_CTRL_SET_TLSEXT_HOSTNAME */
  45. #define OPENSSL_NO_TLSEXT
  46. #endif /* OPENSSL_VERION < 1.0 */
  47. #ifndef OPENSSL_NO_KRB5
  48. /* enable workarround for openssl kerberos wrong malloc bug
  49. * (kssl code uses libc malloc/free/calloc instead of OPENSSL_malloc &
  50. * friends)*/
  51. #define TLS_KSSL_WORKARROUND
  52. extern int openssl_kssl_malloc_bug; /* is openssl bug #1467 present ? */
  53. #endif
  54. extern const SSL_METHOD* ssl_methods[];
  55. /*
  56. * just once, pre-initialize the tls subsystem
  57. */
  58. int tls_pre_init(void);
  59. /*
  60. * just once, initialize the tls subsystem
  61. */
  62. int init_tls_h(void);
  63. /*
  64. * just once before cleanup
  65. */
  66. void destroy_tls_h(void);
  67. /*
  68. * for each socket
  69. */
  70. int tls_h_init_si(struct socket_info *si);
  71. /*
  72. * Make sure that all server domains in the configuration have corresponding
  73. * listening socket in SER
  74. */
  75. int tls_check_sockets(tls_domains_cfg_t* cfg);
  76. #endif /* _TLS_INIT_H */