mirror of
https://github.com/reactos/reactos.git
synced 2025-01-03 21:09:19 +00:00
[MSTSC] Fix BSOD when we can't acquire context from CryptoAPI. CORE-13263 #resolve
svn path=/trunk/; revision=74577
This commit is contained in:
parent
1338881e3b
commit
2796bd5d20
1 changed files with 44 additions and 4 deletions
|
@ -59,11 +59,23 @@ rdssl_rc4_info_create(void)
|
|||
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();
|
||||
error("CryptAcquireContext failed with %lx\n", dwErr);
|
||||
|
@ -214,11 +226,23 @@ rdssl_hash_info_create(ALG_ID id)
|
|||
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();
|
||||
g_free(info);
|
||||
|
@ -451,11 +475,23 @@ rdssl_hmac_md5(char* key, int keylen, char* data, int len, char* output)
|
|||
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();
|
||||
g_free(blob);
|
||||
|
@ -1566,9 +1602,13 @@ rdssl_sign_ok(char* e_data, int e_len, char* n_data, int n_len,
|
|||
{
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue