FreeRDP/winpr/libwinpr/utils
Norbert Federa cdcdec99bc OpenSSL thread safety
freerdp/winpr had the following issues:
* The non reentrant SSL_library_init() was called concurrently (crash)
* Missing code/api to set the eventually required OpenSSL static and dynamic locking callbacks
* Missing code/api to free the application-global or thread-local OpenSSL data and tables

This commit creates two new winpr functions:

BOOL winpr_InitializeSSL(DWORD flags):

Use the flag WINPR_SSL_INIT_ALREADY_INITIALIZED if you want to tell winpr that
your application has already initialized OpenSSL.
If required use the flag WINPR_SSL_INIT_ENABLE_LOCKING to tell winpr that it
should set the OpenSSL static and dynamic locking callbacks.
Otherwise just call it with the flag WINPR_SSL_INIT_DEFAULT.

The recommended way is that your application calls this function once before
any threads are created. However, in order to support lazy OpenSSL library
initialization winpr_InitializeSSL() can also safely be called multiple times
and concurrently because it uses the new InitOnceExecuteOnce() function to
guarantee that the initialization is only performed successfully once during
the life time of the calling process.

BOOL winpr_CleanupSSL(DWORD flags):

If you create a thread that uses SSL you should call this function before the
thread returns using the flag WINPR_SSL_CLEANUP_THREAD in order to clean up
the thread-local OpenSSL data and tables.
Call the function with the flag WINPR_SSL_CLEANUP_GLOBAL before terminating
your application.

Note: This commit only replaced the current occurences of the
SSL_load_error_strings(); SSL_library_init(); pairs in the freerdp source
with winpr_InitializeSSL(). None of the server or client applications has been
changed according to the recommended usage described above (TBDL).
2014-07-28 21:55:57 +02:00
..
collections libfreerdp-gdi: migrate to _aligned_malloc/_aligned_free 2014-07-08 15:07:19 -04:00
test winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
trio wfreerdp: fix most build warnings 2014-02-10 22:12:13 -05:00
wlog winpr-utils: WLog_PrintMessageVA, include stdarg.h from wlog.h instead of wlog.c 2014-07-04 14:52:13 +02:00
CMakeLists.txt OpenSSL thread safety 2014-07-28 21:55:57 +02:00
cmdline.c libfreerdp-client: fix command-line parsing with .rdp file 2013-09-17 17:03:35 -04:00
ini.c libwinpr-utils: fix .ini parser whitespace trimming 2014-03-25 00:32:05 -04:00
ModuleOptions.cmake libwinpr: use ModuleOptions.cmake automatically 2012-10-03 19:50:48 -04:00
ntlm.c libwinpr-sspi: valgrind cleanup 2012-08-23 01:18:47 -04:00
print.c Add some const modifiers 2014-05-09 22:36:50 +02:00
sam.c wfreerdp: fix multiple warnings 2014-02-10 01:06:11 -05:00
ssl.c OpenSSL thread safety 2014-07-28 21:55:57 +02:00
stream.c libfreerdp-core: minor style cleanup 2013-11-08 13:57:41 -05:00