crypt32(3/25): Add open tests for hash messages (with patch)
Juan Lang
juan.lang at gmail.com
Thu Jul 12 17:16:09 CDT 2007
--Juan
-------------- next part --------------
From 9c3fcb87b44556daa2575471a12900c025accdd6 Mon Sep 17 00:00:00 2001
From: Juan Lang <juanlang at juan.corp.google.com>
Date: Thu, 12 Jul 2007 14:20:55 -0700
Subject: [PATCH] Add open tests for hash messages
---
dlls/crypt32/tests/msg.c | 33 +++++++++++++++++++++++++++++++++
1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 4898c6e..60bfe0b 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -653,6 +653,38 @@ static void test_data_msg(void)
test_data_msg_encoding();
}
+static void test_hash_msg_open(void)
+{
+ HCRYPTMSG msg;
+ CMSG_HASHED_ENCODE_INFO hashInfo = { 0 };
+ static char oid_rsa_md5[] = szOID_RSA_MD5;
+
+ SetLastError(0xdeadbeef);
+ msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_HASHED, &hashInfo,
+ NULL, NULL);
+ todo_wine
+ ok(!msg && GetLastError() == E_INVALIDARG,
+ "Expected E_INVALIDARG, got %x\n", GetLastError());
+ hashInfo.cbSize = sizeof(hashInfo);
+ SetLastError(0xdeadbeef);
+ msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_HASHED, &hashInfo,
+ NULL, NULL);
+ todo_wine
+ ok(!msg && GetLastError() == CRYPT_E_UNKNOWN_ALGO,
+ "Expected CRYPT_E_UNKNOWN_ALGO, got %x\n", GetLastError());
+ hashInfo.HashAlgorithm.pszObjId = oid_rsa_md5;
+ msg = CryptMsgOpenToEncode(PKCS_7_ASN_ENCODING, 0, CMSG_HASHED, &hashInfo,
+ NULL, NULL);
+ todo_wine
+ ok(msg != NULL, "CryptMsgOpenToEncode failed: %x\n", GetLastError());
+ CryptMsgClose(msg);
+}
+
+static void test_hash_msg(void)
+{
+ test_hash_msg_open();
+}
+
static CRYPT_DATA_BLOB b4 = { 0, NULL };
static const struct update_accum a4 = { 1, &b4 };
@@ -832,5 +864,6 @@ START_TEST(msg)
/* Message-type specific tests */
test_data_msg();
+ test_hash_msg();
test_decode_msg();
}
--
1.4.1
More information about the wine-patches
mailing list