[PATCH 1/2] crypt32: Add support for CMSG_SIGNER_AUTH_ATTR_PARAM.

Dmitry Timoshkov dmitry at baikal.ru
Fri Oct 2 13:52:02 CDT 2020


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

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 5df03f7c99..0e50cc13d6 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -2998,6 +2998,37 @@ 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_ATTRIBUTES *out = pvData;
+
+        CRYPT_ConstructAttributes(out,&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)
 {
@@ -3202,6 +3233,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.26.2




More information about the wine-devel mailing list