Dmitry Timoshkov : crypt32: Make helper for copying CMSG_CMS_SIGNER_INFO attributes more generic.

Alexandre Julliard julliard at winehq.org
Thu Nov 12 15:17:45 CST 2020


Module: wine
Branch: master
Commit: 1b87f222eddac50b0840eccae3c1b01a57b55cef
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=1b87f222eddac50b0840eccae3c1b01a57b55cef

Author: Dmitry Timoshkov <dmitry at baikal.ru>
Date:   Thu Nov 12 11:15:01 2020 +0300

crypt32: Make helper for copying CMSG_CMS_SIGNER_INFO attributes more generic.

Signed-off-by: Dmitry Timoshkov <dmitry at baikal.ru>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/crypt32/msg.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index b71c52bb0f6..88c27a1c664 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -2995,15 +2995,14 @@ static BOOL CDecodeEnvelopedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
     return ret;
 }
 
-static BOOL CRYPT_CopyUnauthAttr(void *pvData, DWORD *pcbData,
- const CMSG_CMS_SIGNER_INFO *in)
+static BOOL CRYPT_CopyAttr(void *pvData, DWORD *pcbData, const CRYPT_ATTRIBUTES *attr)
 {
     DWORD size;
     BOOL ret;
 
-    TRACE("(%p, %d, %p)\n", pvData, pvData ? *pcbData : 0, in);
+    TRACE("(%p, %d, %p)\n", pvData, pvData ? *pcbData : 0, attr);
 
-    size = CRYPT_SizeOfAttributes(&in->UnauthAttrs);
+    size = CRYPT_SizeOfAttributes(attr);
     if (!pvData)
     {
         *pcbData = size;
@@ -3016,12 +3015,8 @@ static BOOL CRYPT_CopyUnauthAttr(void *pvData, DWORD *pcbData,
         ret = FALSE;
     }
     else
-    {
-        CRYPT_ATTRIBUTES *out = pvData;
+        ret = CRYPT_ConstructAttributes(pvData, attr);
 
-        CRYPT_ConstructAttributes(out,&in->UnauthAttrs);
-        ret = TRUE;
-    }
     TRACE("returning %d\n", ret);
     return ret;
 }
@@ -3205,8 +3200,8 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType,
             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]);
+                ret = CRYPT_CopyAttr(pvData, pcbData,
+                 &msg->u.signed_data.info->rgSignerInfo[dwIndex].UnauthAttrs);
         }
         else
             SetLastError(CRYPT_E_INVALID_MSG_TYPE);




More information about the wine-cvs mailing list