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

crypt32: Fix encoding cert issuer/subject unique ids.

parent acfa433f
...@@ -506,37 +506,37 @@ static BOOL WINAPI CRYPT_AsnEncodeCertInfo(DWORD dwCertEncodingType, ...@@ -506,37 +506,37 @@ static BOOL WINAPI CRYPT_AsnEncodeCertInfo(DWORD dwCertEncodingType,
{ &info->SubjectPublicKeyInfo, CRYPT_AsnEncodePubKeyInfoNoNull, 0 }, { &info->SubjectPublicKeyInfo, CRYPT_AsnEncodePubKeyInfoNoNull, 0 },
{ 0 } { 0 }
}; };
struct AsnConstructedItem constructed[3] = { { 0 } }; struct AsnConstructedItem constructed = { 0 };
DWORD cItem = 7, cConstructed = 0; struct AsnEncodeTagSwappedItem swapped[2] = { { 0 } };
DWORD cItem = 7, cSwapped = 0;
if (info->IssuerUniqueId.cbData) if (info->IssuerUniqueId.cbData)
{ {
constructed[cConstructed].tag = 1; swapped[cSwapped].tag = ASN_CONTEXT | 1;
constructed[cConstructed].pvStructInfo = &info->IssuerUniqueId; swapped[cSwapped].pvStructInfo = &info->IssuerUniqueId;
constructed[cConstructed].encodeFunc = CRYPT_AsnEncodeBits; swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits;
items[cItem].pvStructInfo = &constructed[cConstructed]; items[cItem].pvStructInfo = &swapped[cSwapped];
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed; items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
cConstructed++; cSwapped++;
cItem++; cItem++;
} }
if (info->SubjectUniqueId.cbData) if (info->SubjectUniqueId.cbData)
{ {
constructed[cConstructed].tag = 2; swapped[cSwapped].tag = ASN_CONTEXT | 2;
constructed[cConstructed].pvStructInfo = &info->SubjectUniqueId; swapped[cSwapped].pvStructInfo = &info->SubjectUniqueId;
constructed[cConstructed].encodeFunc = CRYPT_AsnEncodeBits; swapped[cSwapped].encodeFunc = CRYPT_AsnEncodeBits;
items[cItem].pvStructInfo = &constructed[cConstructed]; items[cItem].pvStructInfo = &swapped[cSwapped];
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed; items[cItem].encodeFunc = CRYPT_AsnEncodeSwapTag;
cConstructed++; cSwapped++;
cItem++; cItem++;
} }
if (info->cExtension) if (info->cExtension)
{ {
constructed[cConstructed].tag = 3; constructed.tag = 3;
constructed[cConstructed].pvStructInfo = &info->cExtension; constructed.pvStructInfo = &info->cExtension;
constructed[cConstructed].encodeFunc = CRYPT_AsnEncodeExtensions; constructed.encodeFunc = CRYPT_AsnEncodeExtensions;
items[cItem].pvStructInfo = &constructed[cConstructed]; items[cItem].pvStructInfo = &constructed;
items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed; items[cItem].encodeFunc = CRYPT_AsnEncodeConstructed;
cConstructed++;
cItem++; cItem++;
} }
......
...@@ -2979,11 +2979,9 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding) ...@@ -2979,11 +2979,9 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding)
ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08x\n", GetLastError());
if (buf) if (buf)
{ {
todo_wine {
ok(size == sizeof(v1CertWithIssuerUniqueId), "Wrong size %d\n", size); ok(size == sizeof(v1CertWithIssuerUniqueId), "Wrong size %d\n", size);
ok(!memcmp(buf, v1CertWithIssuerUniqueId, size), ok(!memcmp(buf, v1CertWithIssuerUniqueId, size),
"Got unexpected value\n"); "Got unexpected value\n");
}
LocalFree(buf); LocalFree(buf);
} }
/* Test v1 cert with an issuer name, a subject name, and a serial number */ /* Test v1 cert with an issuer name, a subject name, and a serial number */
...@@ -3031,7 +3029,6 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding) ...@@ -3031,7 +3029,6 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding)
ok(size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueId) || ok(size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueId) ||
size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull), size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull),
"Wrong size %d\n", size); "Wrong size %d\n", size);
todo_wine {
if (size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueId)) if (size == sizeof(v1CertWithSubjectIssuerSerialAndIssuerUniqueId))
ok(!memcmp(buf, v1CertWithSubjectIssuerSerialAndIssuerUniqueId, ok(!memcmp(buf, v1CertWithSubjectIssuerSerialAndIssuerUniqueId,
size), "unexpected value\n"); size), "unexpected value\n");
...@@ -3040,7 +3037,6 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding) ...@@ -3040,7 +3037,6 @@ static void test_encodeCertToBeSigned(DWORD dwEncoding)
ok(!memcmp(buf, ok(!memcmp(buf,
v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull, size), v1CertWithSubjectIssuerSerialAndIssuerUniqueIdNoNull, size),
"unexpected value\n"); "unexpected value\n");
}
LocalFree(buf); LocalFree(buf);
} }
/* Remove the public key, and add a subject key identifier extension */ /* Remove the public key, and add a subject key identifier extension */
......
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