[asterisk-commits] russell: branch 1.6.2 r205148 - in /branches/1.6.2: ./ include/asterisk/ main...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jul 8 10:34:02 CDT 2009
Author: russell
Date: Wed Jul 8 10:33:59 2009
New Revision: 205148
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=205148
Log:
Merged revisions 205120 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk
........
r205120 | russell | 2009-07-08 10:17:19 -0500 (Wed, 08 Jul 2009) | 16 lines
Move OpenSSL initialization to a single place, make library usage thread-safe.
While doing some reading about OpenSSL, I noticed a couple of things that
needed to be improved with our usage of OpenSSL.
1) We had initialization of the library done in multiple modules. This has now
been moved to a core function that gets executed during Asterisk startup.
We already link OpenSSL into the core for TCP/TLS functionality, so this
was the most logical place to do it.
2) OpenSSL is not thread-safe by default. However, making it thread safe is
very easy. We just have to provide a couple of callbacks. One callback
returns a thread ID. The other handles locking. For more information,
start with the "Is OpenSSL thread-safe?" question on the FAQ page of
openssl.org.
........
Added:
branches/1.6.2/main/ssl.c
- copied unchanged from r205120, trunk/main/ssl.c
Modified:
branches/1.6.2/ (props changed)
branches/1.6.2/include/asterisk/_private.h
branches/1.6.2/main/Makefile
branches/1.6.2/main/asterisk.c
branches/1.6.2/res/res_crypto.c
branches/1.6.2/res/res_jabber.c
Propchange: branches/1.6.2/
------------------------------------------------------------------------------
Binary property 'trunk-merged' - no diff available.
Modified: branches/1.6.2/include/asterisk/_private.h
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/include/asterisk/_private.h?view=diff&rev=205148&r1=205147&r2=205148
==============================================================================
--- branches/1.6.2/include/asterisk/_private.h (original)
+++ branches/1.6.2/include/asterisk/_private.h Wed Jul 8 10:33:59 2009
@@ -41,6 +41,7 @@
int ast_timing_init(void); /*!< Provided by timing.c */
int ast_indications_init(void); /*!< Provided by indications.c */
int ast_indications_reload(void);/*!< Provided by indications.c */
+int ast_ssl_init(void); /*!< Porvided by ssl.c */
/*!
* \brief Reload asterisk modules.
Modified: branches/1.6.2/main/Makefile
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/Makefile?view=diff&rev=205148&r1=205147&r2=205148
==============================================================================
--- branches/1.6.2/main/Makefile (original)
+++ branches/1.6.2/main/Makefile Wed Jul 8 10:33:59 2009
@@ -29,7 +29,7 @@
strcompat.o threadstorage.o dial.o event.o adsistub.o audiohook.o \
astobj2.o hashtab.o global_datastores.o version.o \
features.o taskprocessor.o timing.o datastore.o xml.o xmldoc.o \
- strings.o bridging.o poll.o
+ strings.o bridging.o poll.o ssl.o
# we need to link in the objects statically, not as a library, because
# otherwise modules will not have them available if none of the static
Modified: branches/1.6.2/main/asterisk.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/main/asterisk.c?view=diff&rev=205148&r1=205147&r2=205148
==============================================================================
--- branches/1.6.2/main/asterisk.c (original)
+++ branches/1.6.2/main/asterisk.c Wed Jul 8 10:33:59 2009
@@ -3573,6 +3573,11 @@
exit(1);
}
+ if (ast_ssl_init()) {
+ printf("%s", term_quit());
+ exit(1);
+ }
+
#ifdef AST_XML_DOCS
/* Load XML documentation. */
ast_xmldoc_load_documentation();
Modified: branches/1.6.2/res/res_crypto.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/res/res_crypto.c?view=diff&rev=205148&r1=205147&r2=205148
==============================================================================
--- branches/1.6.2/res/res_crypto.c (original)
+++ branches/1.6.2/res/res_crypto.c Wed Jul 8 10:33:59 2009
@@ -585,8 +585,6 @@
/*! \brief initialise the res_crypto module */
static int crypto_init(void)
{
- SSL_library_init();
- ERR_load_crypto_strings();
ast_cli_register_multiple(cli_crypto, ARRAY_LEN(cli_crypto));
/* Install ourselves into stubs */
Modified: branches/1.6.2/res/res_jabber.c
URL: http://svn.asterisk.org/svn-view/asterisk/branches/1.6.2/res/res_jabber.c?view=diff&rev=205148&r1=205147&r2=205148
==============================================================================
--- branches/1.6.2/res/res_jabber.c (original)
+++ branches/1.6.2/res/res_jabber.c Wed Jul 8 10:33:59 2009
@@ -621,10 +621,6 @@
ast_debug(1, "Starting TLS handshake\n");
- /* Load encryption, hashing algorithms and error strings */
- SSL_library_init();
- SSL_load_error_strings();
-
/* Choose an SSL/TLS protocol version, create SSL_CTX */
client->ssl_method = SSLv3_method();
client->ssl_context = SSL_CTX_new(client->ssl_method);
More information about the asterisk-commits
mailing list