Merge pull request #3665 from realjiangms/fix_ssl_add_all_digests
Winpr/openssl: Fix digests initialization in multi-thread
This commit is contained in:
commit
71ce3378da
@ -13,7 +13,7 @@ create_test_sourcelist(${MODULE_PREFIX}_SRCS
|
||||
|
||||
add_executable(${MODULE_NAME} ${${MODULE_PREFIX}_SRCS})
|
||||
|
||||
target_link_libraries(${MODULE_NAME} freerdp)
|
||||
target_link_libraries(${MODULE_NAME} freerdp winpr)
|
||||
|
||||
set_target_properties(${MODULE_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${TESTING_OUTPUT_DIRECTORY}")
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/ssl.h>
|
||||
|
||||
#include <freerdp/assistance.h>
|
||||
|
||||
@ -180,6 +181,8 @@ int test_msrsc_incident_file_type2()
|
||||
|
||||
int TestCommonAssistance(int argc, char* argv[])
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
|
||||
if (test_msrsc_incident_file_type1() != 0)
|
||||
{
|
||||
printf("test_msrsc_incident_file_type1 failed\n");
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include <winpr/string.h>
|
||||
#include <winpr/stream.h>
|
||||
#include <winpr/wtsapi.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/debug.h>
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
@ -877,6 +878,7 @@ freerdp* freerdp_new()
|
||||
if (!instance)
|
||||
return NULL;
|
||||
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
instance->ContextSize = sizeof(rdpContext);
|
||||
instance->SendChannelData = freerdp_send_channel_data;
|
||||
instance->ReceiveChannelData = freerdp_channels_data;
|
||||
|
@ -109,8 +109,6 @@ const EVP_CIPHER* winpr_openssl_get_evp_cipher(int cipher)
|
||||
{
|
||||
const EVP_CIPHER* evp = NULL;
|
||||
|
||||
OpenSSL_add_all_ciphers();
|
||||
|
||||
switch (cipher)
|
||||
{
|
||||
case WINPR_CIPHER_NULL:
|
||||
|
@ -49,8 +49,6 @@ const EVP_MD* winpr_openssl_get_evp_md(int md)
|
||||
{
|
||||
const EVP_MD* evp = NULL;
|
||||
|
||||
OpenSSL_add_all_digests();
|
||||
|
||||
switch (md)
|
||||
{
|
||||
case WINPR_MD_MD2:
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/crypto.h>
|
||||
#include <winpr/ssl.h>
|
||||
|
||||
|
||||
|
||||
@ -216,6 +217,8 @@ static BOOL test_crypto_cipher_key()
|
||||
|
||||
int TestCryptoCipher(int argc, char* argv[])
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
|
||||
if (!test_crypto_cipher_aes_128_cbc())
|
||||
return -1;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/crypto.h>
|
||||
#include <winpr/ssl.h>
|
||||
|
||||
static const char* TEST_MD5_DATA = "test";
|
||||
static const BYTE* TEST_MD5_HASH = (BYTE*) "\x09\x8f\x6b\xcd\x46\x21\xd3\x73\xca\xde\x4e\x83\x26\x27\xb4\xf6";
|
||||
@ -267,6 +268,8 @@ out:
|
||||
|
||||
int TestCryptoHash(int argc, char* argv[])
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
|
||||
if (!test_crypto_hash_md5())
|
||||
return -1;
|
||||
|
||||
|
@ -2,6 +2,7 @@
|
||||
#include <winpr/crt.h>
|
||||
#include <winpr/print.h>
|
||||
#include <winpr/crypto.h>
|
||||
#include <winpr/ssl.h>
|
||||
#include <winpr/wlog.h>
|
||||
|
||||
static const char* SECRET_PASSWORD_TEST = "MySecretPassword123!";
|
||||
@ -24,6 +25,7 @@ int TestCryptoProtectMemory(int argc, char* argv[])
|
||||
}
|
||||
CopyMemory(pCipherText, pPlainText, cbPlainText);
|
||||
ZeroMemory(&pCipherText[cbPlainText], (cbCipherText - cbPlainText));
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
|
||||
if (!CryptProtectMemory(pCipherText, cbCipherText, CRYPTPROTECTMEMORY_SAME_PROCESS))
|
||||
{
|
||||
|
@ -258,6 +258,8 @@ static BOOL CALLBACK _winpr_openssl_initialize(PINIT_ONCE once, PVOID param, PVO
|
||||
SSL_load_error_strings();
|
||||
/* SSL_library_init() always returns "1" */
|
||||
SSL_library_init();
|
||||
OpenSSL_add_all_digests();
|
||||
OpenSSL_add_all_ciphers();
|
||||
g_winpr_openssl_initialized_by_winpr = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user