[PATCH 1/2] crypt32: Add support for CMSG_SIGNER_AUTH_ATTR_PARAM for a being decoded signed message.

Dmitry Timoshkov dmitry at baikal.ru
Tue Nov 10 02:26:05 CST 2020


Based on CMSG_SIGNER_UNAUTH_ATTR_PARAM implementation.

This is a resend, previous patches felt out of the list.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
---
 dlls/crypt32/msg.c | 42 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 42 insertions(+)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index b71c52bb0f..13d7e06eb8 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -2995,6 +2995,34 @@ static BOOL CDecodeEnvelopedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
     return ret;
 }
 
+static BOOL CRYPT_CopyAuthAttr(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->AuthAttrs);
+    if (!pvData)
+    {
+        *pcbData = size;
+        ret = TRUE;
+    }
+    else if (*pcbData < size)
+    {
+        *pcbData = size;
+        SetLastError(ERROR_MORE_DATA);
+        ret = FALSE;
+    }
+    else
+    {
+        CRYPT_ConstructAttributes(pvData, &in->AuthAttrs);
+        ret = TRUE;
+    }
+    TRACE("returning %d\n", ret);
+    return ret;
+}
+
 static BOOL CRYPT_CopyUnauthAttr(void *pvData, DWORD *pcbData,
  const CMSG_CMS_SIGNER_INFO *in)
 {
@@ -3199,6 +3227,20 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
         else
             SetLastError(CRYPT_E_INVALID_MSG_TYPE);
         break;
+
+    case CMSG_SIGNER_AUTH_ATTR_PARAM:
+        if (msg->u.signed_data.info)
+        {
+            if (dwIndex >= msg->u.signed_data.info->cSignerInfo)
+                SetLastError(CRYPT_E_INVALID_INDEX);
+            else
+                ret = CRYPT_CopyAuthAttr(pvData, pcbData,
+                 &msg->u.signed_data.info->rgSignerInfo[dwIndex]);
+        }
+        else
+            SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+        break;
+
     case CMSG_SIGNER_UNAUTH_ATTR_PARAM:
         if (msg->u.signed_data.info)
         {
-- 
2.29.2




More information about the wine-devel mailing list