crypt32: Add CMSG_SIGNER_UNAUTH_ATTR_PARAM implementation.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=37837
Signed-off-by: Vijay Kiran Kamuju <infyquest@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Vijay Kiran Kamuju 2019-02-13 05:56:20 +01:00 committed by Alexandre Julliard
parent c666a45560
commit 0d0906b56d
1 changed files with 43 additions and 0 deletions

View File

@ -2999,6 +2999,37 @@ static BOOL CDecodeEnvelopedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
return ret; return ret;
} }
static BOOL CRYPT_CopyUnauthAttr(void *pvData, DWORD *pcbData,
const CMSG_CMS_SIGNER_INFO *in)
{
DWORD size;
BOOL ret;
TRACE("(%p, %d, %p)\n", pvData, pvData ? *pcbData : 0, in);
size = CRYPT_SizeOfAttributes(&in->UnauthAttrs);
if (!pvData)
{
*pcbData = size;
ret = TRUE;
}
else if (*pcbData < size)
{
*pcbData = size;
SetLastError(ERROR_MORE_DATA);
ret = FALSE;
}
else
{
CRYPT_ATTRIBUTES *out = pvData;
CRYPT_ConstructAttributes(out,&in->UnauthAttrs);
ret = TRUE;
}
TRACE("returning %d\n", ret);
return ret;
}
static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType, static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
DWORD dwIndex, void *pvData, DWORD *pcbData) DWORD dwIndex, void *pvData, DWORD *pcbData)
{ {
@ -3172,6 +3203,18 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
else else
SetLastError(CRYPT_E_INVALID_MSG_TYPE); SetLastError(CRYPT_E_INVALID_MSG_TYPE);
break; break;
case CMSG_SIGNER_UNAUTH_ATTR_PARAM:
if (msg->u.signed_data.info)
{
if (dwIndex >= msg->u.signed_data.info->cSignerInfo)
SetLastError(CRYPT_E_INVALID_INDEX);
else
ret = CRYPT_CopyUnauthAttr(pvData, pcbData,
&msg->u.signed_data.info->rgSignerInfo[dwIndex]);
}
else
SetLastError(CRYPT_E_INVALID_MSG_TYPE);
break;
default: default:
FIXME("unimplemented for %d\n", dwParamType); FIXME("unimplemented for %d\n", dwParamType);
SetLastError(CRYPT_E_INVALID_MSG_TYPE); SetLastError(CRYPT_E_INVALID_MSG_TYPE);