Commit 09454507 authored by James Hawkins's avatar James Hawkins Committed by Alexandre Julliard

crypt32: Fix several failing tests in win9x.

parent 99a5afa6
...@@ -513,7 +513,8 @@ static void testCertProperties(void) ...@@ -513,7 +513,8 @@ static void testCertProperties(void)
CERT_SIGNATURE_HASH_PROP_ID, NULL, &size); CERT_SIGNATURE_HASH_PROP_ID, NULL, &size);
ok(!ret && ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_BADTAG || (GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == CRYPT_E_NOT_FOUND), GetLastError() == CRYPT_E_NOT_FOUND ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError()); "Expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
/* Test key contexts and handles and such */ /* Test key contexts and handles and such */
...@@ -1815,7 +1816,9 @@ static void testSignAndEncodeCert(void) ...@@ -1815,7 +1816,9 @@ static void testSignAndEncodeCert(void)
*/ */
ret = CryptSignAndEncodeCertificate(0, 0, X509_ASN_ENCODING, ret = CryptSignAndEncodeCertificate(0, 0, X509_ASN_ENCODING,
X509_CERT_TO_BE_SIGNED, &info, &algID, NULL, NULL, &size); X509_CERT_TO_BE_SIGNED, &info, &algID, NULL, NULL, &size);
ok(!ret && GetLastError() == NTE_BAD_ALGID, ok(!ret &&
(GetLastError() == NTE_BAD_ALGID ||
GetLastError() == OSS_BAD_PTR), /* win9x */
"Expected NTE_BAD_ALGID, got %08x\n", GetLastError()); "Expected NTE_BAD_ALGID, got %08x\n", GetLastError());
algID.pszObjId = oid_rsa_md5rsa; algID.pszObjId = oid_rsa_md5rsa;
ret = CryptSignAndEncodeCertificate(0, 0, X509_ASN_ENCODING, ret = CryptSignAndEncodeCertificate(0, 0, X509_ASN_ENCODING,
...@@ -2625,19 +2628,25 @@ static void testHashToBeSigned(void) ...@@ -2625,19 +2628,25 @@ static void testHashToBeSigned(void)
"expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); "expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, NULL, 0, NULL, &size); ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, NULL, 0, NULL, &size);
ok(!ret && GetLastError() == CRYPT_E_ASN1_EOD, ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError()); "expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
/* Can't sign anything: has to be asn.1 encoded, at least */ /* Can't sign anything: has to be asn.1 encoded, at least */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, int1, sizeof(int1), ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, int1, sizeof(int1),
NULL, &size); NULL, &size);
ok(!ret && GetLastError() == CRYPT_E_ASN1_BADTAG, ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_MORE_INPUT), /* win9x */
"expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError()); "expected CRYPT_E_ASN1_BADTAG, got %08x\n", GetLastError());
/* Can't be empty, either */ /* Can't be empty, either */
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, emptyCert, ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, emptyCert,
sizeof(emptyCert), NULL, &size); sizeof(emptyCert), NULL, &size);
ok(!ret && GetLastError() == CRYPT_E_ASN1_CORRUPT, ok(!ret &&
(GetLastError() == CRYPT_E_ASN1_CORRUPT ||
GetLastError() == OSS_DATA_ERROR), /* win9x */
"expected CRYPT_E_ASN1_CORRUPT, got %08x\n", GetLastError()); "expected CRYPT_E_ASN1_CORRUPT, got %08x\n", GetLastError());
/* Signing a cert works */ /* Signing a cert works */
ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, md5SignedEmptyCert, ret = CryptHashToBeSigned(0, X509_ASN_ENCODING, md5SignedEmptyCert,
...@@ -3021,7 +3030,9 @@ static void testGetPublicKeyLength(void) ...@@ -3021,7 +3030,9 @@ static void testGetPublicKeyLength(void)
ret, GetLastError()); ret, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info); ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info);
ok(ret == 0 && GetLastError() == CRYPT_E_ASN1_EOD, ok(ret == 0 &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"Expected length 0 and CRYPT_E_ASN1_EOD, got length %d, %08x\n", "Expected length 0 and CRYPT_E_ASN1_EOD, got length %d, %08x\n",
ret, GetLastError()); ret, GetLastError());
/* With a nearly-empty public key info */ /* With a nearly-empty public key info */
...@@ -3033,7 +3044,9 @@ static void testGetPublicKeyLength(void) ...@@ -3033,7 +3044,9 @@ static void testGetPublicKeyLength(void)
ret, GetLastError()); ret, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info); ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info);
ok(ret == 0 && GetLastError() == CRYPT_E_ASN1_EOD, ok(ret == 0 &&
(GetLastError() == CRYPT_E_ASN1_EOD ||
GetLastError() == OSS_BAD_ARG), /* win9x */
"Expected length 0 and CRYPT_E_ASN1_EOD, got length %d, %08x\n", "Expected length 0 and CRYPT_E_ASN1_EOD, got length %d, %08x\n",
ret, GetLastError()); ret, GetLastError());
/* With a bogus key */ /* With a bogus key */
...@@ -3046,7 +3059,9 @@ static void testGetPublicKeyLength(void) ...@@ -3046,7 +3059,9 @@ static void testGetPublicKeyLength(void)
ret, GetLastError()); ret, GetLastError());
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info); ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info);
ok(ret == 0 && GetLastError() == CRYPT_E_ASN1_BADTAG, ok(ret == 0 &&
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == OSS_PDU_MISMATCH), /* win9x */
"Expected length 0 and CRYPT_E_ASN1_BADTAGTAG, got length %d, %08x\n", "Expected length 0 and CRYPT_E_ASN1_BADTAGTAG, got length %d, %08x\n",
ret, GetLastError()); ret, GetLastError());
/* With a believable RSA key but a bogus OID */ /* With a believable RSA key but a bogus OID */
...@@ -3065,7 +3080,9 @@ static void testGetPublicKeyLength(void) ...@@ -3065,7 +3080,9 @@ static void testGetPublicKeyLength(void)
info.Algorithm.pszObjId = oid_rsa_dh; info.Algorithm.pszObjId = oid_rsa_dh;
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info); ret = CertGetPublicKeyLength(X509_ASN_ENCODING, &info);
ok(ret == 0 && GetLastError() == CRYPT_E_ASN1_BADTAG, ok(ret == 0 &&
(GetLastError() == CRYPT_E_ASN1_BADTAG ||
GetLastError() == E_INVALIDARG), /* win9x */
"Expected length 0 and CRYPT_E_ASN1_BADTAG, got length %d, %08x\n", "Expected length 0 and CRYPT_E_ASN1_BADTAG, got length %d, %08x\n",
ret, GetLastError()); ret, GetLastError());
/* With the RSA OID */ /* With the RSA OID */
......
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