crypt32(13/20): Implement getting outer content of a signed message

Juan Lang juan.lang at gmail.com
Mon Jul 23 20:31:03 CDT 2007


--Juan
-------------- next part --------------
From 008233fa612f6d7c6c9563a01e64fbdec8178c9c Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 23 Jul 2007 18:11:49 -0700
Subject: [PATCH] Implement getting outer content of a signed message
---
 dlls/crypt32/msg.c       |   28 ++++++++++++++++++++++++++++
 dlls/crypt32/tests/msg.c |    4 ----
 2 files changed, 28 insertions(+), 4 deletions(-)

diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index cd1dd39..1fcf980 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -797,6 +797,34 @@ static BOOL CSignedEncodeMsg_GetParam(HC
 
     switch (dwParamType)
     {
+    case CMSG_CONTENT_PARAM:
+    {
+        CRYPT_CONTENT_INFO info;
+
+        ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0, NULL,
+         &info.Content.cbData);
+        if (ret)
+        {
+            info.Content.pbData = CryptMemAlloc(info.Content.cbData);
+            if (info.Content.pbData)
+            {
+                ret = CryptMsgGetParam(hCryptMsg, CMSG_BARE_CONTENT_PARAM, 0,
+                 info.Content.pbData, &info.Content.cbData);
+                if (ret)
+                {
+                    char oid_rsa_signed[] = szOID_RSA_signedData;
+
+                    info.pszObjId = oid_rsa_signed;
+                    ret = CryptEncodeObjectEx(X509_ASN_ENCODING,
+                     PKCS_CONTENT_INFO, &info, 0, NULL, pvData, pcbData);
+                }
+                CryptMemFree(info.Content.pbData);
+            }
+            else
+                ret = FALSE;
+        }
+        break;
+    }
     case CMSG_BARE_CONTENT_PARAM:
     {
         CRYPT_SIGNED_INFO info;
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 7a244b5..f7c863c 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -1292,7 +1292,6 @@ static void test_signed_msg_encoding(voi
     check_param("detached signed empty bare content", msg,
      CMSG_BARE_CONTENT_PARAM, signedEmptyBareContent,
      sizeof(signedEmptyBareContent));
-    todo_wine
     check_param("detached signed empty content", msg, CMSG_CONTENT_PARAM,
      signedEmptyContent, sizeof(signedEmptyContent));
     ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
@@ -1301,7 +1300,6 @@ static void test_signed_msg_encoding(voi
      signedHash, sizeof(signedHash));
     check_param("detached signed bare content", msg, CMSG_BARE_CONTENT_PARAM,
      detachedSignedBareContent, sizeof(detachedSignedBareContent));
-    todo_wine
     check_param("detached signed content", msg, CMSG_CONTENT_PARAM,
      detachedSignedContent, sizeof(detachedSignedContent));
     SetLastError(0xdeadbeef);
@@ -1317,14 +1315,12 @@ static void test_signed_msg_encoding(voi
 
     check_param("signed empty bare content", msg, CMSG_BARE_CONTENT_PARAM,
      signedEmptyBareContent, sizeof(signedEmptyBareContent));
-    todo_wine
     check_param("signed empty content", msg, CMSG_CONTENT_PARAM,
      signedEmptyContent, sizeof(signedEmptyContent));
     ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
     ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError());
     check_param("signed bare content", msg, CMSG_BARE_CONTENT_PARAM,
      signedBareContent, sizeof(signedBareContent));
-    todo_wine
     check_param("signed content", msg, CMSG_CONTENT_PARAM,
      signedContent, sizeof(signedContent));
 
-- 
1.4.1


More information about the wine-patches mailing list