Commit c58c42ad authored by Torge Matthies's avatar Torge Matthies Committed by Alexandre Julliard

wintrust: Encode algorithm id without parameters if pszObjId is NULL.

The only user of this function is CRYPT_AsnEncodeSPCDigest, whose only user is WVTAsn1SpcIndirectDataContentEncode, so this behavior might be specific to that function. Signed-off-by: 's avatarTorge Matthies <openglfreak@googlemail.com>
parent 40209104
......@@ -652,6 +652,7 @@ static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType,
return ret;
}
/* Different from the one in crypt32 */
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo,
BYTE *pbEncoded, DWORD *pcbEncoded)
......@@ -665,12 +666,15 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
{ algo->pszObjId, CRYPT_AsnEncodeOid, 0 },
{ NULL, CRYPT_CopyEncodedBlob, 0 },
};
DWORD cItem = 2;
if (algo->Parameters.cbData)
items[1].pvStructInfo = &algo->Parameters;
else
else if (algo->pszObjId)
items[1].pvStructInfo = &nullBlob;
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items),
else
cItem -= 1;
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem,
pbEncoded, pcbEncoded);
return ret;
}
......
......@@ -578,10 +578,8 @@ static void test_encodeSPCIndirectDataContent(void)
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
if (ret)
{
todo_wine
ok(size == sizeof(emptyIndirectData), "Unexpected size %ld\n", size);
if (size == sizeof(emptyIndirectData))
todo_wine
ok(!memcmp(buf, emptyIndirectData, sizeof(emptyIndirectData)),
"Unexpected value\n");
LocalFree(buf);
......@@ -594,10 +592,8 @@ static void test_encodeSPCIndirectDataContent(void)
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
if (ret)
{
todo_wine
ok(size == sizeof(spcidcWithOnlyDigest), "Unexpected size %ld\n", size);
if (size == sizeof(spcidcWithOnlyDigest))
todo_wine
ok(!memcmp(buf, spcidcWithOnlyDigest, sizeof(spcidcWithOnlyDigest)),
"Unexpected value\n");
LocalFree(buf);
......
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