Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
739cc08b
Commit
739cc08b
authored
Jul 12, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 13, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Partially implement updating hash messages.
parent
5cb26d8e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
12 deletions
+39
-12
msg.c
dlls/crypt32/msg.c
+32
-2
msg.c
dlls/crypt32/tests/msg.c
+7
-10
No files found.
dlls/crypt32/msg.c
View file @
739cc08b
...
@@ -354,8 +354,38 @@ static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
...
@@ -354,8 +354,38 @@ static BOOL CHashEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType,
static
BOOL
CHashEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
static
BOOL
CHashEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
DWORD
cbData
,
BOOL
fFinal
)
DWORD
cbData
,
BOOL
fFinal
)
{
{
FIXME
(
"(%p, %p, %d, %d): stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
CHashEncodeMsg
*
msg
=
(
CHashEncodeMsg
*
)
hCryptMsg
;
return
FALSE
;
BOOL
ret
=
FALSE
;
TRACE
(
"(%p, %p, %d, %d)
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
if
(
msg
->
base
.
finalized
)
SetLastError
(
CRYPT_E_MSG_ERROR
);
else
{
if
(
fFinal
)
msg
->
base
.
finalized
=
TRUE
;
if
(
msg
->
base
.
streamed
)
{
/* Doesn't do anything, as stream output is never called, and you
* can't get the content.
*/
ret
=
CryptHashData
(
msg
->
hash
,
pbData
,
cbData
,
0
);
}
else
{
if
(
!
(
msg
->
base
.
open_flags
&
CMSG_DETACHED_FLAG
)
&&
!
fFinal
)
SetLastError
(
CRYPT_E_MSG_ERROR
);
else
{
ret
=
CryptHashData
(
msg
->
hash
,
pbData
,
cbData
,
0
);
/* Still a stub, as content isn't modified */
FIXME
(
"(%p, %p, %d, %d): stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
}
}
}
return
ret
;
}
}
static
HCRYPTMSG
CHashEncodeMsg_Open
(
DWORD
dwFlags
,
const
void
*
pvMsgEncodeInfo
,
static
HCRYPTMSG
CHashEncodeMsg_Open
(
DWORD
dwFlags
,
const
void
*
pvMsgEncodeInfo
,
...
...
dlls/crypt32/tests/msg.c
View file @
739cc08b
...
@@ -701,25 +701,20 @@ static void test_hash_msg_update(void)
...
@@ -701,25 +701,20 @@ static void test_hash_msg_update(void)
* updates..
* updates..
*/
*/
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* including non-final updates with no data.. */
/* including non-final updates with no data.. */
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* and final updates with no data. */
/* and final updates with no data. */
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
/* But no updates are allowed after the final update. */
/* But no updates are allowed after the final update. */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
...
@@ -730,19 +725,16 @@ static void test_hash_msg_update(void)
...
@@ -730,19 +725,16 @@ static void test_hash_msg_update(void)
NULL
,
NULL
);
NULL
,
NULL
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_MSG_ERROR
,
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
"Expected CRYPT_E_MSG_ERROR, got %x
\n
"
,
GetLastError
());
/* Final updates (including empty ones) are allowed. */
/* Final updates (including empty ones) are allowed. */
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
ret
=
CryptMsgUpdate
(
msg
,
NULL
,
0
,
TRUE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
/* And, of course, streaming mode allows non-final updates */
/* And, of course, streaming mode allows non-final updates */
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
&
streamInfo
);
NULL
,
&
streamInfo
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
/* Setting pfnStreamOutput to NULL results in no error. (In what appears
/* Setting pfnStreamOutput to NULL results in no error. (In what appears
...
@@ -752,7 +744,6 @@ static void test_hash_msg_update(void)
...
@@ -752,7 +744,6 @@ static void test_hash_msg_update(void)
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
&
streamInfo
);
NULL
,
&
streamInfo
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
FALSE
);
todo_wine
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgUpdate failed: %08x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
}
}
...
@@ -794,7 +785,6 @@ static void test_hash_msg_get_param(void)
...
@@ -794,7 +785,6 @@ static void test_hash_msg_get_param(void)
/* By getting the hash, further updates are not allowed */
/* By getting the hash, further updates are not allowed */
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
NTE_BAD_HASH_STATE
,
ok
(
!
ret
&&
GetLastError
()
==
NTE_BAD_HASH_STATE
,
"Expected NTE_BAD_HASH_STATE, got %x
\n
"
,
GetLastError
());
"Expected NTE_BAD_HASH_STATE, got %x
\n
"
,
GetLastError
());
/* The version is also available, and should be zero for this message. */
/* The version is also available, and should be zero for this message. */
...
@@ -837,6 +827,13 @@ static void test_hash_msg_get_param(void)
...
@@ -837,6 +827,13 @@ static void test_hash_msg_get_param(void)
ok
(
ret
,
"CryptMsgGetParam failed: %08x
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptMsgGetParam failed: %08x
\n
"
,
GetLastError
());
if
(
size
==
sizeof
(
buf
))
if
(
size
==
sizeof
(
buf
))
ok
(
!
memcmp
(
buf
,
emptyHashParam
,
size
),
"Unexpected value
\n
"
);
ok
(
!
memcmp
(
buf
,
emptyHashParam
,
size
),
"Unexpected value
\n
"
);
/* After updating the hash, further updates aren't allowed on streamed
* messages either.
*/
SetLastError
(
0xdeadbeef
);
ret
=
CryptMsgUpdate
(
msg
,
msgData
,
sizeof
(
msgData
),
TRUE
);
ok
(
!
ret
&&
GetLastError
()
==
NTE_BAD_HASH_STATE
,
"Expected NTE_BAD_HASH_STATE, got %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment