crypt32: Implement getting hash message version.

This commit is contained in:
Juan Lang 2007-07-12 14:51:03 -07:00 committed by Alexandre Julliard
parent e3d6f771e8
commit 804b9d7165
2 changed files with 21 additions and 3 deletions

View File

@ -344,6 +344,27 @@ static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
ret = CryptGetHashParam(msg->hash, HP_HASHVAL, (BYTE *)pvData, pcbData,
0);
break;
case CMSG_VERSION_PARAM:
if (!msg->base.finalized)
SetLastError(CRYPT_E_MSG_ERROR);
else if (!pvData)
{
*pcbData = sizeof(DWORD);
ret = TRUE;
}
else if (*pcbData < sizeof(DWORD))
{
SetLastError(ERROR_MORE_DATA);
*pcbData = sizeof(DWORD);
}
else
{
/* FIXME: under what circumstances is this CMSG_HASHED_DATA_V2? */
*(DWORD *)pvData = CMSG_HASHED_DATA_PKCS_1_5_VERSION;
*pcbData = sizeof(DWORD);
ret = TRUE;
}
break;
default:
FIXME("%d: stub\n", dwParamType);
ret = FALSE;

View File

@ -790,14 +790,11 @@ static void test_hash_msg_get_param(void)
/* The version is also available, and should be zero for this message. */
size = 0;
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, NULL, &size);
todo_wine
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
size = sizeof(value);
ret = CryptMsgGetParam(msg, CMSG_VERSION_PARAM, 0, (LPBYTE)&value, &size);
todo_wine {
ok(ret, "CryptMsgGetParam failed: %08x\n", GetLastError());
ok(value == 0, "Expected version 0, got %d\n", value);
}
/* As usual, the type isn't available. */
ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
todo_wine