Module: wine Branch: master Commit: b12072b72d7fad907ae204ca6bb0423f092aa840 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b12072b72d7fad907ae204ca6b...
Author: Juan Lang juan.lang@gmail.com Date: Thu Jul 12 14:20:55 2007 -0700
crypt32: 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(); }