crypt32: Implement CryptVerifyMessageHash.
This commit is contained in:
parent
c097a7a6a6
commit
f98eb4a8a0
@ -323,8 +323,40 @@ BOOL WINAPI CryptVerifyMessageHash(PCRYPT_HASH_MESSAGE_PARA pHashPara,
|
|||||||
BYTE *pbHashedBlob, DWORD cbHashedBlob, BYTE *pbToBeHashed,
|
BYTE *pbHashedBlob, DWORD cbHashedBlob, BYTE *pbToBeHashed,
|
||||||
DWORD *pcbToBeHashed, BYTE *pbComputedHash, DWORD *pcbComputedHash)
|
DWORD *pcbToBeHashed, BYTE *pbComputedHash, DWORD *pcbComputedHash)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %p, %d, %p, %p, %p, %p): stub\n", pHashPara, pbHashedBlob,
|
HCRYPTMSG msg;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
TRACE("(%p, %p, %d, %p, %p, %p, %p)\n", pHashPara, pbHashedBlob,
|
||||||
cbHashedBlob, pbToBeHashed, pcbToBeHashed, pbComputedHash,
|
cbHashedBlob, pbToBeHashed, pcbToBeHashed, pbComputedHash,
|
||||||
pcbComputedHash);
|
pcbComputedHash);
|
||||||
return FALSE;
|
|
||||||
|
if (pHashPara->cbSize != sizeof(CRYPT_HASH_MESSAGE_PARA))
|
||||||
|
{
|
||||||
|
SetLastError(E_INVALIDARG);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (GET_CMSG_ENCODING_TYPE(pHashPara->dwMsgEncodingType) !=
|
||||||
|
PKCS_7_ASN_ENCODING)
|
||||||
|
{
|
||||||
|
SetLastError(E_INVALIDARG);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
msg = CryptMsgOpenToDecode(pHashPara->dwMsgEncodingType, 0, 0,
|
||||||
|
pHashPara->hCryptProv, NULL, NULL);
|
||||||
|
if (msg)
|
||||||
|
{
|
||||||
|
ret = CryptMsgUpdate(msg, pbHashedBlob, cbHashedBlob, TRUE);
|
||||||
|
if (ret)
|
||||||
|
{
|
||||||
|
ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_HASH, NULL);
|
||||||
|
if (ret && pcbToBeHashed)
|
||||||
|
ret = CryptMsgGetParam(msg, CMSG_CONTENT_PARAM, 0,
|
||||||
|
pbToBeHashed, pcbToBeHashed);
|
||||||
|
if (ret && pcbComputedHash)
|
||||||
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0,
|
||||||
|
pbComputedHash, pcbComputedHash);
|
||||||
|
}
|
||||||
|
CryptMsgClose(msg);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -210,19 +210,16 @@ static void test_verify_message_hash(void)
|
|||||||
ret = CryptVerifyMessageHash(NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
ret = CryptVerifyMessageHash(NULL, NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||||
para.cbSize = sizeof(para);
|
para.cbSize = sizeof(para);
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(!ret && GetLastError() == E_INVALIDARG,
|
ok(!ret && GetLastError() == E_INVALIDARG,
|
||||||
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
"expected E_INVALIDARG, got %08x\n", GetLastError());
|
||||||
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
|
para.dwMsgEncodingType = PKCS_7_ASN_ENCODING;
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
ret = CryptVerifyMessageHash(¶, NULL, 0, NULL, NULL, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(!ret && GetLastError() == CRYPT_E_ASN1_EOD,
|
ok(!ret && GetLastError() == CRYPT_E_ASN1_EOD,
|
||||||
"expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
|
"expected CRYPT_E_ASN1_EOD, got %08x\n", GetLastError());
|
||||||
/* Verifying the hash of a detached message succeeds? */
|
/* Verifying the hash of a detached message succeeds? */
|
||||||
@ -233,11 +230,9 @@ static void test_verify_message_hash(void)
|
|||||||
/* As does verifying the hash of a regular message. */
|
/* As does verifying the hash of a regular message. */
|
||||||
ret = CryptVerifyMessageHash(¶, hashContent, sizeof(hashContent),
|
ret = CryptVerifyMessageHash(¶, hashContent, sizeof(hashContent),
|
||||||
NULL, NULL, NULL, NULL);
|
NULL, NULL, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
|
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
|
||||||
ret = CryptVerifyMessageHash(¶, hashContent, sizeof(hashContent),
|
ret = CryptVerifyMessageHash(¶, hashContent, sizeof(hashContent),
|
||||||
NULL, &size, NULL, NULL);
|
NULL, &size, NULL, NULL);
|
||||||
todo_wine
|
|
||||||
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
|
ok(ret, "CryptVerifyMessageHash failed: %08x\n", GetLastError());
|
||||||
if (ret)
|
if (ret)
|
||||||
buf = CryptMemAlloc(size);
|
buf = CryptMemAlloc(size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user