Commit 3c6fb6bb authored by Paul Vriens's avatar Paul Vriens Committed by Alexandre Julliard

crypt32/tests: Prevent some crashes on Win9x (test_decode_msg).

parent 6859eee6
...@@ -2022,9 +2022,12 @@ static void test_decode_msg_update(void) ...@@ -2022,9 +2022,12 @@ static void test_decode_msg_update(void)
ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError());
CryptMsgClose(msg); CryptMsgClose(msg);
if (have_nt)
{
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
/* Updating a message that has a NULL stream callback fails */ /* Updating a message that has a NULL stream callback fails */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
/* Crashes on some Win9x */
ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent),
FALSE); FALSE);
todo_wine todo_wine
...@@ -2045,6 +2048,7 @@ static void test_decode_msg_update(void) ...@@ -2045,6 +2048,7 @@ static void test_decode_msg_update(void)
"Expected STATUS_ACCESS_VIOLATION or STATUS_ILLEGAL_INSTRUCTION, got %x\n", "Expected STATUS_ACCESS_VIOLATION or STATUS_ILLEGAL_INSTRUCTION, got %x\n",
GetLastError()); GetLastError());
CryptMsgClose(msg); CryptMsgClose(msg);
}
/* Empty non-final updates are allowed when streaming.. */ /* Empty non-final updates are allowed when streaming.. */
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, &streamInfo);
...@@ -2353,10 +2357,14 @@ static void test_decode_msg_get_param(void) ...@@ -2353,10 +2357,14 @@ static void test_decode_msg_get_param(void)
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
ret = CryptMsgUpdate(msg, hashEmptyContent, sizeof(hashEmptyContent), TRUE); ret = CryptMsgUpdate(msg, hashEmptyContent, sizeof(hashEmptyContent), TRUE);
if (ret)
{
/* Crashes on some Win9x */
check_param("empty hash content", msg, CMSG_CONTENT_PARAM, NULL, 0); check_param("empty hash content", msg, CMSG_CONTENT_PARAM, NULL, 0);
check_param("empty hash hash data", msg, CMSG_HASH_DATA_PARAM, NULL, 0); check_param("empty hash hash data", msg, CMSG_HASH_DATA_PARAM, NULL, 0);
check_param("empty hash computed hash", msg, CMSG_COMPUTED_HASH_PARAM, check_param("empty hash computed hash", msg, CMSG_COMPUTED_HASH_PARAM,
emptyHashParam, sizeof(emptyHashParam)); emptyHashParam, sizeof(emptyHashParam));
}
CryptMsgClose(msg); CryptMsgClose(msg);
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
ret = CryptMsgUpdate(msg, hashContent, sizeof(hashContent), TRUE); ret = CryptMsgUpdate(msg, hashContent, sizeof(hashContent), TRUE);
...@@ -2477,6 +2485,12 @@ static void test_decode_msg_get_param(void) ...@@ -2477,6 +2485,12 @@ static void test_decode_msg_get_param(void)
msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL); msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, 0, 0, NULL, NULL);
ret = CryptMsgUpdate(msg, signedKeyIdEmptyContent, ret = CryptMsgUpdate(msg, signedKeyIdEmptyContent,
sizeof(signedKeyIdEmptyContent), TRUE); sizeof(signedKeyIdEmptyContent), TRUE);
if (!ret && GetLastError() == OSS_DATA_ERROR)
{
/* Subsequent tests crashes on some Win9x, so bail out */
CryptMsgClose(msg);
return;
}
ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError()); ok(ret, "CryptMsgUpdate failed: %08x\n", GetLastError());
size = sizeof(value); size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_SIGNER_COUNT_PARAM, 0, &value, &size); ret = CryptMsgGetParam(msg, CMSG_SIGNER_COUNT_PARAM, 0, &value, &size);
......
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