Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
3c15f98b
Commit
3c15f98b
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: Add a stub hash message implementation.
parent
e6c339d0
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
76 additions
and
6 deletions
+76
-6
msg.c
dlls/crypt32/msg.c
+76
-1
msg.c
dlls/crypt32/tests/msg.c
+0
-5
No files found.
dlls/crypt32/msg.c
View file @
3c15f98b
...
@@ -313,6 +313,78 @@ static HCRYPTMSG CDataEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo,
...
@@ -313,6 +313,78 @@ static HCRYPTMSG CDataEncodeMsg_Open(DWORD dwFlags, const void *pvMsgEncodeInfo,
return
(
HCRYPTMSG
)
msg
;
return
(
HCRYPTMSG
)
msg
;
}
}
typedef
struct
_CHashEncodeMsg
{
CryptMsgBase
base
;
HCRYPTPROV
prov
;
HCRYPTHASH
hash
;
}
CHashEncodeMsg
;
static
void
CHashEncodeMsg_Close
(
HCRYPTMSG
hCryptMsg
)
{
CHashEncodeMsg
*
msg
=
(
CHashEncodeMsg
*
)
hCryptMsg
;
CryptDestroyHash
(
msg
->
hash
);
if
(
msg
->
base
.
open_flags
&
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
)
CryptReleaseContext
(
msg
->
prov
,
0
);
}
static
BOOL
CHashEncodeMsg_GetParam
(
HCRYPTMSG
hCryptMsg
,
DWORD
dwParamType
,
DWORD
dwIndex
,
void
*
pvData
,
DWORD
*
pcbData
)
{
FIXME
(
"(%p, %d, %d, %p, %p): stub
\n
"
,
hCryptMsg
,
dwParamType
,
dwIndex
,
pvData
,
pcbData
);
return
FALSE
;
}
static
BOOL
CHashEncodeMsg_Update
(
HCRYPTMSG
hCryptMsg
,
const
BYTE
*
pbData
,
DWORD
cbData
,
BOOL
fFinal
)
{
FIXME
(
"(%p, %p, %d, %d): stub
\n
"
,
hCryptMsg
,
pbData
,
cbData
,
fFinal
);
return
FALSE
;
}
static
HCRYPTMSG
CHashEncodeMsg_Open
(
DWORD
dwFlags
,
const
void
*
pvMsgEncodeInfo
,
LPSTR
pszInnerContentObjID
,
PCMSG_STREAM_INFO
pStreamInfo
)
{
CHashEncodeMsg
*
msg
;
const
CMSG_HASHED_ENCODE_INFO
*
info
=
(
const
CMSG_HASHED_ENCODE_INFO
*
)
pvMsgEncodeInfo
;
HCRYPTPROV
prov
;
ALG_ID
algID
;
if
(
info
->
cbSize
!=
sizeof
(
CMSG_HASHED_ENCODE_INFO
))
{
SetLastError
(
E_INVALIDARG
);
return
NULL
;
}
if
(
!
(
algID
=
CertOIDToAlgId
(
info
->
HashAlgorithm
.
pszObjId
)))
{
SetLastError
(
CRYPT_E_UNKNOWN_ALGO
);
return
NULL
;
}
if
(
info
->
hCryptProv
)
prov
=
info
->
hCryptProv
;
else
{
prov
=
CRYPT_GetDefaultProvider
();
dwFlags
&=
~
CMSG_CRYPT_RELEASE_CONTEXT_FLAG
;
}
msg
=
CryptMemAlloc
(
sizeof
(
CHashEncodeMsg
));
if
(
msg
)
{
CryptMsgBase_Init
((
CryptMsgBase
*
)
msg
,
dwFlags
,
pStreamInfo
,
CHashEncodeMsg_Close
,
CHashEncodeMsg_GetParam
,
CHashEncodeMsg_Update
);
msg
->
prov
=
prov
;
if
(
!
CryptCreateHash
(
prov
,
algID
,
0
,
0
,
&
msg
->
hash
))
{
CryptMsgClose
(
msg
);
msg
=
NULL
;
}
}
return
(
HCRYPTMSG
)
msg
;
}
static
inline
const
char
*
MSG_TYPE_STR
(
DWORD
type
)
static
inline
const
char
*
MSG_TYPE_STR
(
DWORD
type
)
{
{
switch
(
type
)
switch
(
type
)
...
@@ -350,9 +422,12 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
...
@@ -350,9 +422,12 @@ HCRYPTMSG WINAPI CryptMsgOpenToEncode(DWORD dwMsgEncodingType, DWORD dwFlags,
msg
=
CDataEncodeMsg_Open
(
dwFlags
,
pvMsgEncodeInfo
,
msg
=
CDataEncodeMsg_Open
(
dwFlags
,
pvMsgEncodeInfo
,
pszInnerContentObjID
,
pStreamInfo
);
pszInnerContentObjID
,
pStreamInfo
);
break
;
break
;
case
CMSG_HASHED
:
msg
=
CHashEncodeMsg_Open
(
dwFlags
,
pvMsgEncodeInfo
,
pszInnerContentObjID
,
pStreamInfo
);
break
;
case
CMSG_SIGNED
:
case
CMSG_SIGNED
:
case
CMSG_ENVELOPED
:
case
CMSG_ENVELOPED
:
case
CMSG_HASHED
:
FIXME
(
"unimplemented for type %s
\n
"
,
MSG_TYPE_STR
(
dwMsgType
));
FIXME
(
"unimplemented for type %s
\n
"
,
MSG_TYPE_STR
(
dwMsgType
));
break
;
break
;
case
CMSG_SIGNED_AND_ENVELOPED
:
case
CMSG_SIGNED_AND_ENVELOPED
:
...
...
dlls/crypt32/tests/msg.c
View file @
3c15f98b
...
@@ -663,30 +663,25 @@ static void test_hash_msg_open(void)
...
@@ -663,30 +663,25 @@ static void test_hash_msg_open(void)
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
NULL
);
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
ok
(
!
msg
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
"Expected E_INVALIDARG, got %x
\n
"
,
GetLastError
());
hashInfo
.
cbSize
=
sizeof
(
hashInfo
);
hashInfo
.
cbSize
=
sizeof
(
hashInfo
);
SetLastError
(
0xdeadbeef
);
SetLastError
(
0xdeadbeef
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
NULL
);
NULL
,
NULL
);
todo_wine
ok
(
!
msg
&&
GetLastError
()
==
CRYPT_E_UNKNOWN_ALGO
,
ok
(
!
msg
&&
GetLastError
()
==
CRYPT_E_UNKNOWN_ALGO
,
"Expected CRYPT_E_UNKNOWN_ALGO, got %x
\n
"
,
GetLastError
());
"Expected CRYPT_E_UNKNOWN_ALGO, got %x
\n
"
,
GetLastError
());
hashInfo
.
HashAlgorithm
.
pszObjId
=
oid_rsa_md5
;
hashInfo
.
HashAlgorithm
.
pszObjId
=
oid_rsa_md5
;
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
0
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
NULL
);
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
NULL
);
CMSG_HASHED
,
&
hashInfo
,
NULL
,
NULL
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
CryptMsgClose
(
msg
);
CryptMsgClose
(
msg
);
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
msg
=
CryptMsgOpenToEncode
(
PKCS_7_ASN_ENCODING
,
CMSG_DETACHED_FLAG
,
CMSG_HASHED
,
&
hashInfo
,
NULL
,
&
streamInfo
);
CMSG_HASHED
,
&
hashInfo
,
NULL
,
&
streamInfo
);
todo_wine
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %x
\n
"
,
GetLastError
());
ok
(
msg
!=
NULL
,
"CryptMsgOpenToEncode failed: %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