crypt32(4/10): Test that inner content OID is ignored for data messages

Juan Lang juan.lang at gmail.com
Mon Jul 9 13:50:15 CDT 2007


--Juan
-------------- next part --------------
From d56e2e900fddbe8af018b8cbe46d5893bdcfbeec Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Mon, 9 Jul 2007 10:56:20 -0700
Subject: [PATCH] Test that inner content OID is ignored
---
 dlls/crypt32/tests/msg.c |   16 +++++++++++++++-
 1 files changed, 15 insertions(+), 1 deletions(-)

diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index e688d70..6e8295a 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -429,7 +429,6 @@ static void test_data_msg_get_param(void
     ret = CryptMsgGetParam(msg, CMSG_TYPE_PARAM, 0, NULL, &size);
     ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
      "Expected CRYPT_E_INVALID_MSG_TYPE, got %x\n", GetLastError());
-
     CryptMsgClose(msg);
 }
 
@@ -446,6 +445,7 @@ static void test_data_msg_encoding(void)
 {
     HCRYPTMSG msg;
     BOOL ret;
+    static char oid[] = "1.2.3";
 
     msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, NULL,
      NULL);
@@ -474,6 +474,20 @@ static void test_data_msg_encoding(void)
     check_param("data content", msg, CMSG_CONTENT_PARAM, dataContent,
      sizeof(dataContent));
     CryptMsgClose(msg);
+    /* The inner OID is apparently ignored */
+    msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, NULL, oid,
+     NULL);
+    check_param("data bogus oid bare content", msg, CMSG_BARE_CONTENT_PARAM,
+     dataEmptyBareContent, sizeof(dataEmptyBareContent));
+    check_param("data bogus oid content", msg, CMSG_CONTENT_PARAM,
+     dataEmptyContent, sizeof(dataEmptyContent));
+    ret = CryptMsgUpdate(msg, msgData, sizeof(msgData), TRUE);
+    ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError());
+    check_param("data bare content", msg, CMSG_BARE_CONTENT_PARAM,
+     dataBareContent, sizeof(dataBareContent));
+    check_param("data content", msg, CMSG_CONTENT_PARAM, dataContent,
+     sizeof(dataContent));
+    CryptMsgClose(msg);
 }
 
 static void test_data_msg(void)
-- 
1.4.1


More information about the wine-patches mailing list