From: Vijay Kiran Kamuju Subject: [crypt32] add CMSG_SIGNER_UNAUTH_ATTR_PARAM implementation Message-Id: Date: Wed, 13 Feb 2019 06:03:19 +0100 fixes https://bugs.winehq.org/show_bug.cgi?id=37837 From 7058b37652d8e32b6bb7a9ffd9412b29f3c9fb1b Mon Sep 17 00:00:00 2001 From: Vijay Kiran Kamuju Date: Wed, 13 Feb 2019 05:56:20 +0100 Subject: [PATCH] [crypt32] Add CSG_SIGNER_UNAUTH_ATTR_PARAM implementation Signed-off-by: Vijay Kiran Kamuju --- dlls/crypt32/msg.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 4132390855..86d9bb5898 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -2999,6 +2999,37 @@ static BOOL CDecodeEnvelopedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType, 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, DWORD dwIndex, void *pvData, DWORD *pcbData) { @@ -3172,6 +3203,19 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType, else SetLastError(CRYPT_E_INVALID_MSG_TYPE); 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: FIXME("unimplemented for %d\n", dwParamType); SetLastError(CRYPT_E_INVALID_MSG_TYPE); -- 2.20.1