mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 14:40:56 +00:00
crypt32: Implement getting a hash message's hash value.
This commit is contained in:
parent
1745d8a728
commit
bb1246a51c
@ -332,9 +332,23 @@ static void CHashEncodeMsg_Close(HCRYPTMSG hCryptMsg)
|
|||||||
static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
|
static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
|
||||||
DWORD dwIndex, void *pvData, DWORD *pcbData)
|
DWORD dwIndex, void *pvData, DWORD *pcbData)
|
||||||
{
|
{
|
||||||
FIXME("(%p, %d, %d, %p, %p): stub\n", hCryptMsg, dwParamType, dwIndex,
|
CHashEncodeMsg *msg = (CHashEncodeMsg *)hCryptMsg;
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
|
||||||
|
TRACE("(%p, %d, %d, %p, %p)\n", hCryptMsg, dwParamType, dwIndex,
|
||||||
pvData, pcbData);
|
pvData, pcbData);
|
||||||
return FALSE;
|
|
||||||
|
switch (dwParamType)
|
||||||
|
{
|
||||||
|
case CMSG_COMPUTED_HASH_PARAM:
|
||||||
|
ret = CryptGetHashParam(msg->hash, HP_HASHVAL, (BYTE *)pvData, pcbData,
|
||||||
|
0);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
FIXME("%d: stub\n", dwParamType);
|
||||||
|
ret = FALSE;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL CHashEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
|
static BOOL CHashEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
|
||||||
|
@ -776,24 +776,22 @@ static void test_hash_msg_get_param(void)
|
|||||||
/* The hash is also available. */
|
/* The hash is also available. */
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
|
|
||||||
CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
|
CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
}
|
/* The hash doesn't seem to change even after an update, which matches
|
||||||
/* Oddly, the hash doesn't seem to change even after an update */
|
* how rsaenh behaves - an update can't happen after the has is retrieved.
|
||||||
|
*/
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
/* So is the version. */
|
/* So is the version. */
|
||||||
size = 0;
|
size = 0;
|
||||||
@ -829,61 +827,30 @@ static void test_hash_msg_get_param(void)
|
|||||||
/* The hash is still available. */
|
/* The hash is still available. */
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
/* An empty update has no effect on the hash */
|
/* An empty update has no effect on the hash */
|
||||||
CryptMsgUpdate(msg, NULL, 0, FALSE);
|
CryptMsgUpdate(msg, NULL, 0, FALSE);
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
/* A non-empty update doesn't appear to either? */
|
/* A non-empty update doesn't either - see above comments. */
|
||||||
CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
|
CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
|
||||||
size = 0;
|
size = 0;
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
|
||||||
CryptMsgClose(msg);
|
|
||||||
/* A detached message similarly has a non-updating hash */
|
|
||||||
msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG,
|
|
||||||
CMSG_HASHED, &hashInfo, NULL, NULL);
|
|
||||||
size = 0;
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
|
||||||
CryptMsgUpdate(msg, msgData, sizeof(msgData), FALSE);
|
|
||||||
size = 0;
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, NULL, &size);
|
|
||||||
todo_wine {
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
ok(size == sizeof(buf), "Unexpected size %d\n", size);
|
|
||||||
ret = CryptMsgGetParam(msg, CMSG_COMPUTED_HASH_PARAM, 0, buf, &size);
|
|
||||||
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
|
|
||||||
}
|
|
||||||
if (size == sizeof(buf))
|
if (size == sizeof(buf))
|
||||||
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
ok(!memcmp(buf, emptyHashParam, size), "Unexpected value\n");
|
||||||
CryptMsgClose(msg);
|
CryptMsgClose(msg);
|
||||||
|
Loading…
Reference in New Issue
Block a user