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, ...@@ -652,6 +652,7 @@ static BOOL WINAPI CRYPT_CopyEncodedBlob(DWORD dwCertEncodingType,
return ret; return ret;
} }
/* Different from the one in crypt32 */
static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams( static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo, DWORD dwCertEncodingType, LPCSTR lpszStructType, const void *pvStructInfo,
BYTE *pbEncoded, DWORD *pcbEncoded) BYTE *pbEncoded, DWORD *pcbEncoded)
...@@ -665,12 +666,15 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams( ...@@ -665,12 +666,15 @@ static BOOL WINAPI CRYPT_AsnEncodeAlgorithmIdWithNullParams(
{ algo->pszObjId, CRYPT_AsnEncodeOid, 0 }, { algo->pszObjId, CRYPT_AsnEncodeOid, 0 },
{ NULL, CRYPT_CopyEncodedBlob, 0 }, { NULL, CRYPT_CopyEncodedBlob, 0 },
}; };
DWORD cItem = 2;
if (algo->Parameters.cbData) if (algo->Parameters.cbData)
items[1].pvStructInfo = &algo->Parameters; items[1].pvStructInfo = &algo->Parameters;
else else if (algo->pszObjId)
items[1].pvStructInfo = &nullBlob; items[1].pvStructInfo = &nullBlob;
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, ARRAY_SIZE(items), else
cItem -= 1;
ret = CRYPT_AsnEncodeSequence(dwCertEncodingType, items, cItem,
pbEncoded, pcbEncoded); pbEncoded, pcbEncoded);
return ret; return ret;
} }
......
...@@ -578,10 +578,8 @@ static void test_encodeSPCIndirectDataContent(void) ...@@ -578,10 +578,8 @@ static void test_encodeSPCIndirectDataContent(void)
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
if (ret) if (ret)
{ {
todo_wine
ok(size == sizeof(emptyIndirectData), "Unexpected size %ld\n", size); ok(size == sizeof(emptyIndirectData), "Unexpected size %ld\n", size);
if (size == sizeof(emptyIndirectData)) if (size == sizeof(emptyIndirectData))
todo_wine
ok(!memcmp(buf, emptyIndirectData, sizeof(emptyIndirectData)), ok(!memcmp(buf, emptyIndirectData, sizeof(emptyIndirectData)),
"Unexpected value\n"); "Unexpected value\n");
LocalFree(buf); LocalFree(buf);
...@@ -594,10 +592,8 @@ static void test_encodeSPCIndirectDataContent(void) ...@@ -594,10 +592,8 @@ static void test_encodeSPCIndirectDataContent(void)
ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError()); ok(ret, "CryptEncodeObjectEx failed: %08lx\n", GetLastError());
if (ret) if (ret)
{ {
todo_wine
ok(size == sizeof(spcidcWithOnlyDigest), "Unexpected size %ld\n", size); ok(size == sizeof(spcidcWithOnlyDigest), "Unexpected size %ld\n", size);
if (size == sizeof(spcidcWithOnlyDigest)) if (size == sizeof(spcidcWithOnlyDigest))
todo_wine
ok(!memcmp(buf, spcidcWithOnlyDigest, sizeof(spcidcWithOnlyDigest)), ok(!memcmp(buf, spcidcWithOnlyDigest, sizeof(spcidcWithOnlyDigest)),
"Unexpected value\n"); "Unexpected value\n");
LocalFree(buf); 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