Author: phater
Date: Thu May 18 08:47:30 2017
New Revision: 74577
URL:
http://svn.reactos.org/svn/reactos?rev=74577&view=rev
Log:
[MSTSC] Fix BSOD when we can't acquire context from CryptoAPI. CORE-13263 #resolve
Modified:
trunk/reactos/base/applications/mstsc/ssl_calls.c
Modified: trunk/reactos/base/applications/mstsc/ssl_calls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mstsc/ss…
==============================================================================
--- trunk/reactos/base/applications/mstsc/ssl_calls.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/mstsc/ssl_calls.c [iso-8859-1] Thu May 18 08:47:30
2017
@@ -59,10 +59,22 @@
return NULL;
}
ret = CryptAcquireContext(&info->hCryptProv,
- NULL,
+ L"MSTSC",
MS_ENHANCED_PROV,
PROV_RSA_FULL,
0);
+ if (!ret)
+ {
+ dwErr = GetLastError();
+ if (dwErr == NTE_BAD_KEYSET)
+ {
+ ret = CryptAcquireContext(&info->hCryptProv,
+ L"MSTSC",
+ MS_ENHANCED_PROV,
+ PROV_RSA_FULL,
+ CRYPT_NEWKEYSET);
+ }
+ }
if (!ret)
{
dwErr = GetLastError();
@@ -214,10 +226,22 @@
return NULL;
}
ret = CryptAcquireContext(&info->hCryptProv,
- NULL,
+ L"MSTSC",
MS_ENHANCED_PROV,
PROV_RSA_FULL,
0);
+ if (!ret)
+ {
+ dwErr = GetLastError();
+ if (dwErr == NTE_BAD_KEYSET)
+ {
+ ret = CryptAcquireContext(&info->hCryptProv,
+ L"MSTSC",
+ MS_ENHANCED_PROV,
+ PROV_RSA_FULL,
+ CRYPT_NEWKEYSET);
+ }
+ }
if (!ret)
{
dwErr = GetLastError();
@@ -451,10 +475,22 @@
return;
}
ret = CryptAcquireContext(&hCryptProv,
- NULL,
+ L"MSTSC",
MS_ENHANCED_PROV,
PROV_RSA_FULL,
0);
+ if (!ret)
+ {
+ dwErr = GetLastError();
+ if (dwErr == NTE_BAD_KEYSET)
+ {
+ ret = CryptAcquireContext(&hCryptProv,
+ L"MSTSC",
+ MS_ENHANCED_PROV,
+ PROV_RSA_FULL,
+ CRYPT_NEWKEYSET);
+ }
+ }
if (!ret)
{
dwErr = GetLastError();
@@ -1566,9 +1602,13 @@
{
return 1;
}
+ md5 = rdssl_md5_info_create();
+ if (!md5)
+ {
+ return 1;
+ }
key = (char*)xmalloc(176);
md5_final = (char*)xmalloc(64);
- md5 = rdssl_md5_info_create();
// copy the test key
memcpy(key, testkey, 176);
// replace e and n