Commit 676d5db6 authored by Alexander Morozov's avatar Alexander Morozov Committed by Alexandre Julliard

crypt32/tests: Fix test failures on WinME and some NT4.

parent 113c6145
...@@ -2159,7 +2159,9 @@ static void test_enveloped_msg_update(void) ...@@ -2159,7 +2159,9 @@ static void test_enveloped_msg_update(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
todo_wine todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); ok(ret ||
broken(!ret && GetLastError() == NTE_PERM), /* some NT4 */
"CryptMsgUpdate failed: %08x\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, NULL, 0, TRUE); ret = CryptMsgUpdate(msg, NULL, 0, TRUE);
todo_wine todo_wine
...@@ -2204,7 +2206,9 @@ static void test_enveloped_msg_update(void) ...@@ -2204,7 +2206,9 @@ static void test_enveloped_msg_update(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
todo_wine todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); ok(ret ||
broken(!ret && GetLastError() == NTE_PERM), /* some NT4 */
"CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg); CryptMsgClose(msg);
} }
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
...@@ -2242,7 +2246,9 @@ static void test_enveloped_msg_update(void) ...@@ -2242,7 +2246,9 @@ static void test_enveloped_msg_update(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE); ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
todo_wine todo_wine
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); ok(ret ||
broken(!ret && GetLastError() == NTE_PERM), /* some NT4 */
"CryptMsgUpdate failed: %08x\n", GetLastError());
CryptMsgClose(msg); CryptMsgClose(msg);
} }
} }
...@@ -2863,7 +2869,7 @@ static void test_decode_msg_get_param(void) ...@@ -2863,7 +2869,7 @@ static void test_decode_msg_get_param(void)
{ {
HCRYPTMSG msg; HCRYPTMSG msg;
HCRYPTPROV hCryptProv; HCRYPTPROV hCryptProv;
HCRYPTKEY key; HCRYPTKEY key = 0;
BOOL ret; BOOL ret;
DWORD size = 0, value; DWORD size = 0, value;
LPBYTE buf; LPBYTE buf;
...@@ -3099,27 +3105,34 @@ static void test_decode_msg_get_param(void) ...@@ -3099,27 +3105,34 @@ static void test_decode_msg_get_param(void)
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptImportKey(hCryptProv, publicPrivateKeyPair, ret = CryptImportKey(hCryptProv, publicPrivateKeyPair,
sizeof(publicPrivateKeyPair), 0, 0, &key); sizeof(publicPrivateKeyPair), 0, 0, &key);
ok(ret, "CryptImportKey failed: %08x\n", GetLastError()); ok(ret ||
broken(!ret && GetLastError() == NTE_PERM), /* WinME and some NT4 */
"CryptImportKey failed: %08x\n", GetLastError());
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
CryptMsgUpdate(msg, envelopedMessage, sizeof(envelopedMessage), TRUE); CryptMsgUpdate(msg, envelopedMessage, sizeof(envelopedMessage), TRUE);
todo_wine todo_wine
check_param("enveloped message before decrypting", msg, CMSG_CONTENT_PARAM, check_param("enveloped message before decrypting", msg, CMSG_CONTENT_PARAM,
envelopedMessage + sizeof(envelopedMessage) - 4, 4); envelopedMessage + sizeof(envelopedMessage) - 4, 4);
decryptPara.hCryptProv = hCryptProv; if (key)
SetLastError(0xdeadbeef); {
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara); decryptPara.hCryptProv = hCryptProv;
todo_wine SetLastError(0xdeadbeef);
ok(ret, "CryptMsgControl failed: %08x\n", GetLastError()); ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
decryptPara.hCryptProv = 0; todo_wine
SetLastError(0xdeadbeef); ok(ret, "CryptMsgControl failed: %08x\n", GetLastError());
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara); decryptPara.hCryptProv = 0;
todo_wine SetLastError(0xdeadbeef);
ok(!ret && GetLastError() == CRYPT_E_ALREADY_DECRYPTED, ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
"expected CRYPT_E_ALREADY_DECRYPTED, got %08x\n", GetLastError()); todo_wine
todo_wine ok(!ret && GetLastError() == CRYPT_E_ALREADY_DECRYPTED,
check_param("enveloped message", msg, CMSG_CONTENT_PARAM, msgData, "expected CRYPT_E_ALREADY_DECRYPTED, got %08x\n", GetLastError());
sizeof(msgData)); todo_wine
check_param("enveloped message", msg, CMSG_CONTENT_PARAM, msgData,
sizeof(msgData));
}
else
win_skip("failed to import a key, skipping tests\n");
CryptMsgClose(msg); CryptMsgClose(msg);
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL, msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED, 0, NULL,
...@@ -3130,17 +3143,23 @@ static void test_decode_msg_get_param(void) ...@@ -3130,17 +3143,23 @@ static void test_decode_msg_get_param(void)
check_param("enveloped bare message before decrypting", msg, check_param("enveloped bare message before decrypting", msg,
CMSG_CONTENT_PARAM, envelopedBareMessage + CMSG_CONTENT_PARAM, envelopedBareMessage +
sizeof(envelopedBareMessage) - 4, 4); sizeof(envelopedBareMessage) - 4, 4);
decryptPara.hCryptProv = hCryptProv; if (key)
SetLastError(0xdeadbeef); {
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara); decryptPara.hCryptProv = hCryptProv;
todo_wine SetLastError(0xdeadbeef);
ok(ret, "CryptMsgControl failed: %08x\n", GetLastError()); ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
todo_wine todo_wine
check_param("enveloped bare message", msg, CMSG_CONTENT_PARAM, msgData, ok(ret, "CryptMsgControl failed: %08x\n", GetLastError());
sizeof(msgData)); todo_wine
check_param("enveloped bare message", msg, CMSG_CONTENT_PARAM, msgData,
sizeof(msgData));
}
else
win_skip("failed to import a key, skipping tests\n");
CryptMsgClose(msg); CryptMsgClose(msg);
CryptDestroyKey(key); if (key)
CryptDestroyKey(key);
CryptReleaseContext(hCryptProv, 0); CryptReleaseContext(hCryptProv, 0);
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
......
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