Juan Lang : rsaenh: Disallow creating schannel master hashes before setting the client random and server random .

Alexandre Julliard julliard at winehq.org
Fri Feb 11 11:16:36 CST 2011


Module: wine
Branch: master
Commit: ea43c5989cc6e44ad2681548f18efc389b330698
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ea43c5989cc6e44ad2681548f18efc389b330698

Author: Juan Lang <juan.lang at gmail.com>
Date:   Thu Feb 10 09:40:14 2011 -0800

rsaenh: Disallow creating schannel master hashes before setting the client random and server random.

---

 dlls/rsaenh/rsaenh.c       |    7 +++++++
 dlls/rsaenh/tests/rsaenh.c |   14 --------------
 2 files changed, 7 insertions(+), 14 deletions(-)

diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c
index afd06e1..5f67589 100644
--- a/dlls/rsaenh/rsaenh.c
+++ b/dlls/rsaenh/rsaenh.c
@@ -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);
diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c
index e3a31a2..0476275 100644
--- a/dlls/rsaenh/tests/rsaenh.c
+++ b/dlls/rsaenh/tests/rsaenh.c
@@ -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. */




More information about the wine-cvs mailing list