[Wine-devel] Eter's patch is applied to winehq repo 12/01/10

builder на builder.office.etersoft.ru builder на builder.office.etersoft.ru
Ср Дек 1 22:20:26 MSK 2010


New Etersoft's patches since last build time:
commit 6fcca28b07c81aa1431a0f9ff9dcbb94fd5af7e1
Author: Alexander Morozov <amorozov на etersoft.ru>

    crypt32: Add a stub enveloped message implementation.

---

commit 6fcca28b07c81aa1431a0f9ff9dcbb94fd5af7e1
Author: Alexander Morozov <amorozov на etersoft.ru>
Date:   Wed Dec 1 13:38:49 2010 +0300

    crypt32: Add a stub enveloped message implementation.

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 6b2d8b6..b31562b 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -1461,6 +1461,101 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags,
     return msg;
 }
 
+typedef struct _CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS
+{
+    DWORD                       cbSize;
+    HCRYPTPROV_LEGACY           hCryptProv;
+    CRYPT_ALGORITHM_IDENTIFIER  ContentEncryptionAlgorithm;
+    void                       *pvEncryptionAuxInfo;
+    DWORD                       cRecipients;
+    PCERT_INFO                 *rgpRecipientCert;
+    PCMSG_RECIPIENT_ENCODE_INFO rgCmsRecipients;
+    DWORD                       cCertEncoded;
+    PCERT_BLOB                  rgCertEncoded;
+    DWORD                       cCrlEncoded;
+    PCRL_BLOB                   rgCrlEncoded;
+    DWORD                       cAttrCertEncoded;
+    PCERT_BLOB                  rgAttrCertEncoded;
+    DWORD                       cUnprotectedAttr;
+    PCRYPT_ATTRIBUTE            rgUnprotectedAttr;
+} CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS, *PCMSG_ENVELOPED_ENCODE_INFO_WITH_CMS;
+
+typedef struct _CEnvelopedEncodeMsg
+{
+    CryptMsgBase                   base;
+    HCRYPTPROV                     prov;
+} CEnvelopedEncodeMsg;
+
+static void CEnvelopedEncodeMsg_Close(HCRYPTMSG hCryptMsg)
+{
+    CEnvelopedEncodeMsg *msg = hCryptMsg;
+
+    if (msg->base.open_flags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG)
+        CryptReleaseContext(msg->prov, 0);
+}
+
+static BOOL CEnvelopedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
+ DWORD dwIndex, void *pvData, DWORD *pcbData)
+{
+    FIXME("(%p, %d, %d, %p, %p): stub\n", hCryptMsg, dwParamType, dwIndex,
+     pvData, pcbData);
+    return FALSE;
+}
+
+static BOOL CEnvelopedEncodeMsg_Update(HCRYPTMSG hCryptMsg, const BYTE *pbData,
+ DWORD cbData, BOOL fFinal)
+{
+    FIXME("(%p, %p, %d, %d): stub\n", hCryptMsg, pbData, cbData, fFinal);
+    return FALSE;
+}
+
+static HCRYPTMSG CEnvelopedEncodeMsg_Open(DWORD dwFlags,
+ const void *pvMsgEncodeInfo, LPCSTR pszInnerContentObjID,
+ PCMSG_STREAM_INFO pStreamInfo)
+{
+    CEnvelopedEncodeMsg *msg;
+    const CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS *info = pvMsgEncodeInfo;
+    HCRYPTPROV prov;
+    ALG_ID algID;
+
+    if (info->cbSize != sizeof(CMSG_ENVELOPED_ENCODE_INFO) &&
+     info->cbSize != sizeof(CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS))
+    {
+        SetLastError(E_INVALIDARG);
+        return NULL;
+    }
+    if (info->cbSize == sizeof(CMSG_ENVELOPED_ENCODE_INFO_WITH_CMS))
+        FIXME("CMS fields unsupported\n");
+    if (!(algID = CertOIDToAlgId(info->ContentEncryptionAlgorithm.pszObjId)))
+    {
+        SetLastError(CRYPT_E_UNKNOWN_ALGO);
+        return NULL;
+    }
+    if (info->cRecipients && !info->rgpRecipientCert)
+    {
+        SetLastError(E_INVALIDARG);
+        return NULL;
+    }
+    if (info->hCryptProv)
+        prov = info->hCryptProv;
+    else
+    {
+        prov = CRYPT_GetDefaultProvider();
+        dwFlags &= ~CMSG_CRYPT_RELEASE_CONTEXT_FLAG;
+    }
+    msg = CryptMemAlloc(sizeof(CEnvelopedEncodeMsg));
+    if (msg)
+    {
+        CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo,
+         CEnvelopedEncodeMsg_Close, CEnvelopedEncodeMsg_GetParam,
+         CEnvelopedEncodeMsg_Update, CRYPT_DefaultMsgControl);
+        msg->prov = prov;
+    }
+    if (!msg && (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG))
+        CryptReleaseContext(prov, 0);
+    return msg;
+}
+
 HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
  DWORD dwMsgType, const void *pvMsgEncodeInfo, LPSTR pszInnerContentObjID,
  PCMSG_STREAM_INFO pStreamInfo)
@@ -1490,7 +1585,8 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
          pszInnerContentObjID, pStreamInfo);
         break;
     case CMSG_ENVELOPED:
-        FIXME("unimplemented for type CMSG_ENVELOPED\n");
+        msg = CEnvelopedEncodeMsg_Open(dwFlags, pvMsgEncodeInfo,
+         pszInnerContentObjID, pStreamInfo);
         break;
     case CMSG_SIGNED_AND_ENVELOPED:
     case CMSG_ENCRYPTED:
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index d8b1b94..fb7a7c2 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -2043,7 +2043,6 @@ static void test_enveloped_msg_open(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(!msg && GetLastError() == E_INVALIDARG,
      "expected E_INVALIDARG, got %08x\n", GetLastError());
 
@@ -2051,7 +2050,6 @@ static void test_enveloped_msg_open(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(!msg &&
      (GetLastError() == CRYPT_E_UNKNOWN_ALGO ||
       GetLastError() == E_INVALIDARG), /* Win9x */
@@ -2061,7 +2059,6 @@ static void test_enveloped_msg_open(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2073,7 +2070,6 @@ static void test_enveloped_msg_open(void)
         SetLastError(0xdeadbeef);
         msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
          &envelopedInfo, NULL, NULL);
-        todo_wine
         ok(!msg && GetLastError() == E_INVALIDARG,
          "expected E_INVALIDARG, got %08x\n", GetLastError());
     }
@@ -2086,7 +2082,6 @@ static void test_enveloped_msg_open(void)
         SetLastError(0xdeadbeef);
         msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
          &envelopedInfo, NULL, NULL);
-        todo_wine
         ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
         CryptMsgClose(msg);
         SetLastError(0xdeadbeef);
@@ -2096,7 +2091,6 @@ static void test_enveloped_msg_open(void)
         SetLastError(0xdeadbeef);
         msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
          &envelopedInfo, NULL, NULL);
-        todo_wine
         ok(msg != NULL, "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
         CryptMsgClose(msg);
         CryptReleaseContext(envelopedInfo.hCryptProv, 0);
@@ -2117,7 +2111,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2142,7 +2135,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2169,7 +2161,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG,
      CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2189,7 +2180,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, CMSG_DETACHED_FLAG,
      CMSG_ENVELOPED, &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2211,7 +2201,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, &streamInfo);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2230,7 +2219,6 @@ static void test_enveloped_msg_update(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, &streamInfo);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
@@ -2269,15 +2257,16 @@ static void test_enveloped_msg_encoding(void)
     SetLastError(0xdeadbeef);
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_ENVELOPED,
      &envelopedInfo, NULL, NULL);
-    todo_wine
     ok(msg != NULL ||
      broken(!msg), /* Win9x */
      "CryptMsgOpenToEncode failed: %08x\n", GetLastError());
     if (msg)
     {
+        todo_wine
         check_param("enveloped empty bare content", msg,
          CMSG_BARE_CONTENT_PARAM, envelopedEmptyBareContent,
          sizeof(envelopedEmptyBareContent));
+        todo_wine
         check_param("enveloped empty content", msg, CMSG_CONTENT_PARAM,
          envelopedEmptyContent, sizeof(envelopedEmptyContent));
         CryptMsgClose(msg);


Подробная информация о списке рассылки Wine-devel