Commit 4f14b030 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Fix failing tests on Win9x/NT4.

parent 76d25370
...@@ -1318,9 +1318,10 @@ static void test_encodeNameValue(DWORD dwEncoding) ...@@ -1318,9 +1318,10 @@ static void test_encodeNameValue(DWORD dwEncoding)
ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_VALUE, ret = pCryptEncodeObjectEx(dwEncoding, X509_NAME_VALUE,
&nameValues[i].value, CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &nameValues[i].value, CRYPT_ENCODE_ALLOC_FLAG, NULL, (BYTE *)&buf,
&size); &size);
ok(ret, "Type %d: CryptEncodeObjectEx failed: %08x\n", ok(ret || broken(GetLastError() == OSS_PDU_MISMATCH) /* NT4/Win9x */,
"Type %d: CryptEncodeObjectEx failed: %08x\n",
nameValues[i].value.dwValueType, GetLastError()); nameValues[i].value.dwValueType, GetLastError());
if (buf) if (ret)
{ {
ok(size == nameValues[i].encodedSize, ok(size == nameValues[i].encodedSize,
"Expected size %d, got %d\n", nameValues[i].encodedSize, size); "Expected size %d, got %d\n", nameValues[i].encodedSize, size);
...@@ -1346,7 +1347,7 @@ static void test_decodeNameValue(DWORD dwEncoding) ...@@ -1346,7 +1347,7 @@ static void test_decodeNameValue(DWORD dwEncoding)
(BYTE *)&buf, &bufSize); (BYTE *)&buf, &bufSize);
ok(ret, "Value type %d: CryptDecodeObjectEx failed: %08x\n", ok(ret, "Value type %d: CryptDecodeObjectEx failed: %08x\n",
nameValues[i].value.dwValueType, GetLastError()); nameValues[i].value.dwValueType, GetLastError());
if (buf) if (ret)
{ {
compareNameValues(&nameValues[i].value, compareNameValues(&nameValues[i].value,
(const CERT_NAME_VALUE *)buf); (const CERT_NAME_VALUE *)buf);
...@@ -2367,8 +2368,10 @@ static void test_decodeRsaPublicKey(DWORD dwEncoding) ...@@ -2367,8 +2368,10 @@ static void test_decodeRsaPublicKey(DWORD dwEncoding)
ret = pCryptDecodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB, ret = pCryptDecodeObjectEx(dwEncoding, RSA_CSP_PUBLICKEYBLOB,
rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1], rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1],
CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize); CRYPT_DECODE_ALLOC_FLAG, NULL, (BYTE *)&buf, &bufSize);
ok(!ret && GetLastError() == CRYPT_E_ASN1_EOD, ok(!ret && (GetLastError() == CRYPT_E_ASN1_EOD ||
"Expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError()); GetLastError() == OSS_MORE_INPUT /* Win9x/NT4 */),
"Expected CRYPT_E_ASN1_EOD or OSS_MORE_INPUT, got %08x\n",
GetLastError());
/* Try with a couple of RSA-related OIDs */ /* Try with a couple of RSA-related OIDs */
ret = pCryptDecodeObjectEx(dwEncoding, szOID_RSA_RSA, ret = pCryptDecodeObjectEx(dwEncoding, szOID_RSA_RSA,
rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2, rsaPubKeys[0].encoded, rsaPubKeys[0].encoded[1] + 2,
...@@ -7065,6 +7068,11 @@ static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding) ...@@ -7065,6 +7068,11 @@ static void test_encodePolicyQualifierUserNotice(DWORD dwEncoding)
ret = pCryptEncodeObjectEx(dwEncoding, ret = pCryptEncodeObjectEx(dwEncoding,
X509_PKIX_POLICY_QUALIFIER_USERNOTICE, &notice, CRYPT_ENCODE_ALLOC_FLAG, X509_PKIX_POLICY_QUALIFIER_USERNOTICE, &notice, CRYPT_ENCODE_ALLOC_FLAG,
NULL, &buf, &size); NULL, &buf, &size);
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
{
skip("no X509_PKIX_POLICY_QUALIFIER_USERNOTICE encode support\n");
return;
}
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
if (ret) if (ret)
{ {
...@@ -7109,6 +7117,11 @@ static void test_decodePolicyQualifierUserNotice(DWORD dwEncoding) ...@@ -7109,6 +7117,11 @@ static void test_decodePolicyQualifierUserNotice(DWORD dwEncoding)
X509_PKIX_POLICY_QUALIFIER_USERNOTICE, X509_PKIX_POLICY_QUALIFIER_USERNOTICE,
emptySequence, sizeof(emptySequence), CRYPT_DECODE_ALLOC_FLAG, NULL, emptySequence, sizeof(emptySequence), CRYPT_DECODE_ALLOC_FLAG, NULL,
&notice, &size); &notice, &size);
if (!ret && GetLastError() == ERROR_FILE_NOT_FOUND)
{
skip("no X509_PKIX_POLICY_QUALIFIER_USERNOTICE decode support\n");
return;
}
ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptDecodeObjectEx failed: %08x\n", GetLastError());
if (ret) if (ret)
{ {
...@@ -7196,8 +7209,9 @@ static void test_encodeCertPolicies(DWORD dwEncoding) ...@@ -7196,8 +7209,9 @@ static void test_encodeCertPolicies(DWORD dwEncoding)
info.rgPolicyInfo = policy; info.rgPolicyInfo = policy;
ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info, ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size);
ok(!ret && GetLastError() == E_INVALIDARG, ok(!ret && (GetLastError() == E_INVALIDARG ||
"expected E_INVALIDARG, got %08x\n", GetLastError()); GetLastError() == OSS_LIMITED /* Win9x/NT4 */),
"expected E_INVALIDARG or OSS_LIMITED, got %08x\n", GetLastError());
policy[0].pszPolicyIdentifier = oid_any_policy; policy[0].pszPolicyIdentifier = oid_any_policy;
ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info, ret = pCryptEncodeObjectEx(dwEncoding, X509_CERT_POLICIES, &info,
CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &size); CRYPT_ENCODE_ALLOC_FLAG, NULL, &buf, &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