diff --git a/reactos/base/applications/mstsc/ssl_calls.c b/reactos/base/applications/mstsc/ssl_calls.c index af9a78a64b1..d02a50b6dc3 100644 --- a/reactos/base/applications/mstsc/ssl_calls.c +++ b/reactos/base/applications/mstsc/ssl_calls.c @@ -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