crypt32(4/21): Add a mostly stub control function for decode
messages
Juan Lang
juan.lang at gmail.com
Tue Aug 21 09:21:35 CDT 2007
--Juan
-------------- next part --------------
From b2453cbff887038e09762db5aef3b56c7da30bc8 Mon Sep 17 00:00:00 2001
From: Juan Lang <juan.lang at gmail.com>
Date: Mon, 20 Aug 2007 17:33:04 -0700
Subject: [PATCH] Add a mostly stub control function for decode messages
---
dlls/crypt32/msg.c | 43 ++++++++++++++++++++++++++++++++++++++++++-
dlls/crypt32/tests/msg.c | 8 --------
2 files changed, 42 insertions(+), 9 deletions(-)
diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c
index 02377b6..79c8f9b 100644
--- a/dlls/crypt32/msg.c
+++ b/dlls/crypt32/msg.c
@@ -1926,6 +1926,47 @@ static BOOL CDecodeMsg_GetParam(HCRYPTMS
return ret;
}
+static BOOL CDecodeMsg_Control(HCRYPTMSG hCryptMsg, DWORD dwFlags,
+ DWORD dwCtrlType, const void *pvCtrlPara)
+{
+ CDecodeMsg *msg = (CDecodeMsg *)hCryptMsg;
+ BOOL ret = FALSE;
+
+ switch (dwCtrlType)
+ {
+ case CMSG_CTRL_VERIFY_SIGNATURE:
+ switch (msg->type)
+ {
+ case CMSG_SIGNED:
+ FIXME("CMSG_CTRL_VERIFY_SIGNATURE: stub\n");
+ break;
+ default:
+ SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+ }
+ break;
+ case CMSG_CTRL_DECRYPT:
+ switch (msg->type)
+ {
+ default:
+ SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+ }
+ break;
+ case CMSG_CTRL_VERIFY_HASH:
+ switch (msg->type)
+ {
+ case CMSG_HASHED:
+ FIXME("CMSG_CTRL_VERIFY_HASH: stub\n");
+ break;
+ default:
+ SetLastError(CRYPT_E_INVALID_MSG_TYPE);
+ }
+ break;
+ default:
+ SetLastError(CRYPT_E_CONTROL_TYPE);
+ }
+ return ret;
+}
+
HCRYPTMSG WINAPI CryptMsgOpenToDecode(DWORD dwMsgEncodingType, DWORD dwFlags,
DWORD dwMsgType, HCRYPTPROV_LEGACY hCryptProv, PCERT_INFO pRecipientInfo,
PCMSG_STREAM_INFO pStreamInfo)
@@ -1945,7 +1986,7 @@ HCRYPTMSG WINAPI CryptMsgOpenToDecode(DW
{
CryptMsgBase_Init((CryptMsgBase *)msg, dwFlags, pStreamInfo,
CDecodeMsg_Close, CDecodeMsg_GetParam, CDecodeMsg_Update,
- CRYPT_DefaultMsgControl);
+ CDecodeMsg_Control);
msg->type = dwMsgType;
if (hCryptProv)
msg->crypt_prov = hCryptProv;
diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c
index 729aee6..e705824 100644
--- a/dlls/crypt32/tests/msg.c
+++ b/dlls/crypt32/tests/msg.c
@@ -2197,18 +2197,15 @@ static void test_msg_control(void)
/* Bad control type */
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 0, 0, NULL);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_CONTROL_TYPE,
"Expected CRYPT_E_CONTROL_TYPE, got %08x\n", GetLastError());
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 1, 0, NULL);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_CONTROL_TYPE,
"Expected CRYPT_E_CONTROL_TYPE, got %08x\n", GetLastError());
/* Can't verify the hash of an indeterminate-type message */
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_HASH, NULL);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
/* Crashes
@@ -2216,7 +2213,6 @@ static void test_msg_control(void)
*/
/* Can't decrypt an indeterminate-type message */
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
CryptMsgClose(msg);
@@ -2234,7 +2230,6 @@ static void test_msg_control(void)
*/
/* Can't verify the signature of a hash message */
ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, &certInfo);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
CryptMsgUpdate(msg, hashEmptyBareContent, sizeof(hashEmptyBareContent),
@@ -2252,7 +2247,6 @@ static void test_msg_control(void)
/* Can't decrypt an indeterminate-type message */
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
CryptMsgClose(msg);
@@ -2262,13 +2256,11 @@ static void test_msg_control(void)
/* Can't verify the hash of a signed message */
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_HASH, NULL);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
/* Can't decrypt a signed message */
SetLastError(0xdeadbeef);
ret = CryptMsgControl(msg, 0, CMSG_CTRL_DECRYPT, &decryptPara);
- todo_wine
ok(!ret && GetLastError() == CRYPT_E_INVALID_MSG_TYPE,
"Expected CRYPT_E_INVALID_MSG_TYPE, got %08x\n", GetLastError());
/* Crash
--
1.4.1
More information about the wine-patches
mailing list