mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-14 16:34:18 +09:00
[winpr,ssl] check winpr_InitializeSSL return
This commit is contained in:
@@ -1397,7 +1397,9 @@ static BOOL setup_string(wArrayList* list)
|
||||
|
||||
rdpAssistanceFile* freerdp_assistance_file_new(void)
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return nullptr;
|
||||
|
||||
rdpAssistanceFile* file = calloc(1, sizeof(rdpAssistanceFile));
|
||||
if (!file)
|
||||
return nullptr;
|
||||
|
||||
@@ -286,11 +286,11 @@ static BOOL test_msrsc_incident_file_type2(wLog* log)
|
||||
|
||||
int TestCommonAssistance(int argc, char* argv[])
|
||||
{
|
||||
wLog* log = nullptr;
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
log = WLog_Get(__func__);
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
wLog* log = WLog_Get(__func__);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return -1;
|
||||
|
||||
for (size_t x = 0; x < ARRAYSIZE(fail_tests); x++)
|
||||
{
|
||||
|
||||
@@ -1479,7 +1479,9 @@ int main(int argc, char* argv[])
|
||||
}
|
||||
|
||||
WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi());
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return -1;
|
||||
|
||||
instance = freerdp_listener_new();
|
||||
|
||||
if (!instance)
|
||||
|
||||
@@ -813,7 +813,8 @@ BOOL pf_server_start(proxyServer* server)
|
||||
WINPR_ASSERT(server);
|
||||
|
||||
WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi());
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
goto error;
|
||||
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
|
||||
goto error;
|
||||
@@ -853,7 +854,8 @@ BOOL pf_server_start_from_socket(proxyServer* server, int socket)
|
||||
WINPR_ASSERT(server);
|
||||
|
||||
WTSRegisterWtsApiFunctionTable(FreeRDP_InitWtsApi());
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
goto error;
|
||||
|
||||
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0)
|
||||
goto error;
|
||||
|
||||
@@ -233,7 +233,8 @@ int TestCryptoCipher(int argc, char* argv[])
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return -1;
|
||||
|
||||
if (!test_crypto_cipher_aes_128_cbc(TRUE))
|
||||
return -1;
|
||||
|
||||
@@ -297,7 +297,8 @@ int TestCryptoHash(int argc, char* argv[])
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return -1;
|
||||
|
||||
if (!test_crypto_hash_md5())
|
||||
return -1;
|
||||
|
||||
@@ -9,6 +9,7 @@ static const char* SECRET_PASSWORD_TEST = "MySecretPassword123!";
|
||||
|
||||
int TestCryptoProtectMemory(int argc, char* argv[])
|
||||
{
|
||||
int rc = -1;
|
||||
UINT32 cbPlainText = 0;
|
||||
UINT32 cbCipherText = 0;
|
||||
const char* pPlainText = nullptr;
|
||||
@@ -30,12 +31,13 @@ int TestCryptoProtectMemory(int argc, char* argv[])
|
||||
}
|
||||
CopyMemory(pCipherText, pPlainText, cbPlainText);
|
||||
ZeroMemory(&pCipherText[cbPlainText], (cbCipherText - cbPlainText));
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
goto fail;
|
||||
|
||||
if (!CryptProtectMemory(pCipherText, cbCipherText, CRYPTPROTECTMEMORY_SAME_PROCESS))
|
||||
{
|
||||
printf("CryptProtectMemory failure\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("PlainText: %s (cbPlainText = %" PRIu32 ", cbCipherText = %" PRIu32 ")\n", pPlainText,
|
||||
@@ -45,11 +47,14 @@ int TestCryptoProtectMemory(int argc, char* argv[])
|
||||
if (!CryptUnprotectMemory(pCipherText, cbCipherText, CRYPTPROTECTMEMORY_SAME_PROCESS))
|
||||
{
|
||||
printf("CryptUnprotectMemory failure\n");
|
||||
return -1;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("Decrypted CipherText: %s\n", pCipherText);
|
||||
SecureZeroMemory(pCipherText, cbCipherText);
|
||||
|
||||
rc = 0;
|
||||
fail:
|
||||
free(pCipherText);
|
||||
return 0;
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -587,12 +587,13 @@ SECURITY_STATUS schannel_openssl_decrypt_message(SCHANNEL_OPENSSL* context, PSec
|
||||
|
||||
SCHANNEL_OPENSSL* schannel_openssl_new(void)
|
||||
{
|
||||
SCHANNEL_OPENSSL* context = nullptr;
|
||||
context = (SCHANNEL_OPENSSL*)calloc(1, sizeof(SCHANNEL_OPENSSL));
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return nullptr;
|
||||
|
||||
SCHANNEL_OPENSSL* context = (SCHANNEL_OPENSSL*)calloc(1, sizeof(SCHANNEL_OPENSSL));
|
||||
|
||||
if (context != nullptr)
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
context->connected = FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -972,7 +972,8 @@ static BOOL WINPR_init(void)
|
||||
static BOOL CALLBACK sspi_init(WINPR_ATTR_UNUSED PINIT_ONCE InitOnce,
|
||||
WINPR_ATTR_UNUSED PVOID Parameter, WINPR_ATTR_UNUSED PVOID* Context)
|
||||
{
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
return FALSE;
|
||||
sspi_ContextBufferAllocTableNew();
|
||||
if (!SCHANNEL_init())
|
||||
return FALSE;
|
||||
|
||||
@@ -153,7 +153,11 @@ int main(int argc, char* argv[])
|
||||
printf("missing username or password\n\n");
|
||||
return usage_and_exit();
|
||||
}
|
||||
winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT);
|
||||
if (!winpr_InitializeSSL(WINPR_SSL_INIT_DEFAULT))
|
||||
{
|
||||
printf("winpr_InitializeSSL failed\n\n");
|
||||
return usage_and_exit();
|
||||
}
|
||||
|
||||
UserLength = strlen(User);
|
||||
PasswordLength = strlen(Password);
|
||||
|
||||
Reference in New Issue
Block a user