FreeRDP/winpr/libwinpr
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
..
asn1 winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
bcrypt winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
com winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
comm winpr: fix build on Windows with unit tests 2014-07-17 12:02:47 -04:00
credentials Added WITH_LIBRARY_VERSIONING, allowing to build shared libraries without 2014-07-11 11:53:58 +02:00
credui winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
crt winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
crypto winpr: fix build on Windows with unit tests 2014-07-17 12:02:47 -04:00
dsparse winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
environment winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
error winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
file winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
handle Merge pull request #1955 from nfedera/fix-2014-07-10-02 2014-07-11 16:35:12 +02:00
heap winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
input winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
interlocked winpr/sync: Added InitOnceExecuteOnce plus CTest 2014-07-24 21:12:59 +02:00
io winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
library winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
locale winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
memory winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
nt winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
path winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
pipe winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
pool winpr: improve windows builds across visual studio versions and toolsets 2014-07-17 15:11:04 -04:00
registry winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
rpc winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
security winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
smartcard Added WITH_LIBRARY_VERSIONING, allowing to build shared libraries without 2014-07-11 11:53:58 +02:00
sspi OpenSSL thread safety 2014-07-28 21:55:57 +02:00
sspicli winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
synch OpenSSL thread safety 2014-07-28 21:55:57 +02:00
sysinfo Added WITH_LIBRARY_VERSIONING, allowing to build shared libraries without 2014-07-11 11:53:58 +02:00
thread winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
timezone winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
utils OpenSSL thread safety 2014-07-28 21:55:57 +02:00
winhttp winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
winsock winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
wnd winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
wtsapi winpr: always build "monolitic" 2014-07-10 11:10:58 +02:00
CMakeLists.txt Added WITH_LIBRARY_VERSIONING, allowing to build shared libraries without 2014-07-11 11:53:58 +02:00
dummy.c freerdp: various missing link dependencies and symbol exports 2013-09-03 21:48:26 -04:00