Commit ea43c598 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

rsaenh: Disallow creating schannel master hashes before setting the client…

rsaenh: Disallow creating schannel master hashes before setting the client random and server random.
parent b0ae8ca7
......@@ -1857,6 +1857,13 @@ BOOL WINAPI RSAENH_CPCreateHash(HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
SetLastError(NTE_BAD_KEY);
return FALSE;
}
if (Algid == CALG_SCHANNEL_MASTER_HASH &&
((!pCryptKey->siSChannelInfo.blobClientRandom.cbData) ||
(!pCryptKey->siSChannelInfo.blobServerRandom.cbData)))
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ((Algid == CALG_TLS1PRF) && (pCryptKey->dwState != RSAENH_KEYSTATE_MASTERKEY)) {
SetLastError(NTE_BAD_KEY_STATE);
......
......@@ -2346,22 +2346,8 @@ static void test_schannel_provider(void)
* random or server random set.
*/
result = CryptCreateHash(hProv, CALG_SCHANNEL_MASTER_HASH, hMasterSecret, 0, &hMasterHash);
todo_wine
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER,
"expected ERROR_INVALID_PARAMETER, got %08x\n", GetLastError());
if (result)
{
CryptDestroyHash(hMasterHash);
/* Reimporting the master secret is necessary under Wine until creating
* the hash fails as it should.
*/
CryptDestroyKey(hMasterSecret);
dwLen = (DWORD)sizeof(abTLS1Master);
result = CryptImportKey(hProv, abTLS1Master, dwLen, hRSAKey, 0, &hMasterSecret);
ok (result, "%08x\n", GetLastError());
if (!result) return;
}
/* Setting the TLS1 client and server random parameters, as well as the
* MAC and encryption algorithm parameters. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment