rsaenh/tests: Make the tests pass in Windows 8

Bruno Jesus 00cpxxx at gmail.com
Sat Jul 12 14:57:26 CDT 2014


I noticed that Win 8 errors are being ignored for this DLL in the
patches list so this patch can make it be added for error testing
again.

This can be commited without or after my previous 3 patches. I just
don't want to resend everything again.
-------------- next part --------------
diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c
index cb7d044..71a7e6d 100644
--- a/dlls/rsaenh/tests/rsaenh.c
+++ b/dlls/rsaenh/tests/rsaenh.c
@@ -664,7 +664,9 @@ static void test_hashes(void)
     ok(result, "CryptCreateHash failed 0x%08x\n", GetLastError());
     /* Test that CryptHashData fails on this hash */
     result = CryptHashData(hHash, pbData, sizeof(pbData), 0);
-    ok(!result && GetLastError() == NTE_BAD_ALGID, "%08x\n", GetLastError());
+    error = GetLastError();
+    ok(!result && (error == NTE_BAD_ALGID || broken(error == ERROR_INVALID_HANDLE)) /* Win 8 */,
+       "%08x\n", GetLastError());
     result = CryptSetHashParam(hHash, HP_HASHVAL, pbHashValue, 0);
     ok(result, "%08x\n", GetLastError());
     len = (DWORD)sizeof(abPlainPrivateKey);
@@ -708,7 +710,7 @@ static void test_block_cipher_modes(void)
     HCRYPTKEY hKey;
     BOOL result;
     BYTE abData[24];
-    DWORD dwMode, dwLen;
+    DWORD dwMode, dwLen, error;
 
     result = derive_key(CALG_RC2, &hKey, 40);
     if (!result) return;
@@ -787,11 +789,15 @@ static void test_block_cipher_modes(void)
 
     dwMode = CRYPT_MODE_OFB;
     result = CryptSetKeyParam(hKey, KP_MODE, (BYTE*)&dwMode, 0);
-    ok(result, "%08x\n", GetLastError());
+    error = GetLastError();
+    ok(result || broken(error == ERROR_INTERNAL_ERROR) /* Win 8*/,
+       "%08x\n", error);
     
     dwLen = 23;
     result = CryptEncrypt(hKey, 0, TRUE, 0, abData, &dwLen, 24);
-    ok(!result && GetLastError() == NTE_BAD_ALGID, "%08x\n", GetLastError());
+    ok((!result && GetLastError() == NTE_BAD_ALGID)
+       || broken(result) /* Win 8 - OFB failed to be set in last test, so works here */,
+       "%08x\n", GetLastError());
 
     CryptDestroyKey(hKey);
 }
@@ -1822,7 +1828,8 @@ static void test_import_private(void)
     for (; dwLen < sizeof(abPlainPrivateKey); dwLen++)
     {
         result = CryptImportKey(hProv, abPlainPrivateKey, dwLen, 0, 0, &hKeyExchangeKey);
-        ok(result, "CryptImportKey failed at size %d: %d (%08x)\n", dwLen,
+        ok(result || broken(GetLastError() == ERROR_INVALID_DATA && dwLen >= 468 && dwLen <= 531) /* Win 8 */,
+           "CryptImportKey failed at size %d: %d (%08x)\n", dwLen,
            GetLastError(), GetLastError());
         if (result)
             CryptDestroyKey(hKeyExchangeKey);
@@ -2643,7 +2650,8 @@ static void test_schannel_provider(void)
     if (!result) return;
 
     result = CryptCreateHash(hProv, CALG_SCHANNEL_MASTER_HASH, hMasterSecret, 0, &hMasterHash);
-    ok (result, "%08x\n", GetLastError());
+    ok(result || broken(GetLastError() == NTE_FAIL) /* Win 8 */,
+        "%08x\n", GetLastError());
     if (!result) return;
 
     /* Deriving the server write encryption key from the master hash can't


More information about the wine-patches mailing list