Commit 804b9d71 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

crypt32: Implement getting hash message version.

parent e3d6f771
......@@ -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;
......
......@@ -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
......
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