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