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
3a85fa6b
Commit
3a85fa6b
authored
Jul 25, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Jul 26, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Partially implement decoding of signed messages.
parent
5674ca2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
81 additions
and
1 deletion
+81
-1
crypt32_private.h
dlls/crypt32/crypt32_private.h
+4
-0
decode.c
dlls/crypt32/decode.c
+56
-0
msg.c
dlls/crypt32/msg.c
+21
-1
No files found.
dlls/crypt32/crypt32_private.h
View file @
3a85fa6b
...
...
@@ -99,6 +99,10 @@ typedef struct _CRYPT_SIGNED_INFO
BOOL
CRYPT_AsnEncodePKCSSignedInfo
(
CRYPT_SIGNED_INFO
*
,
void
*
pvData
,
DWORD
*
pcbData
);
BOOL
CRYPT_AsnDecodePKCSSignedInfo
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
CRYPT_SIGNED_INFO
*
signedInfo
,
DWORD
*
pcbSignedInfo
);
/* Helper function to check *pcbEncoded, set it to the required size, and
* optionally to allocate memory. Assumes pbEncoded is not NULL.
* If CRYPT_ENCODE_ALLOC_FLAG is set in dwFlags, *pbEncoded will be set to a
...
...
dlls/crypt32/decode.c
View file @
3a85fa6b
...
...
@@ -3841,6 +3841,62 @@ static BOOL WINAPI CRYPT_AsnDecodePKCSSignerInfo(DWORD dwCertEncodingType,
return
ret
;
}
static
BOOL
WINAPI
CRYPT_DecodeSignerArray
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
{
BOOL
ret
;
struct
AsnArrayDescriptor
arrayDesc
=
{
ASN_CONSTRUCTOR
|
ASN_SETOF
,
CRYPT_AsnDecodePKCSSignerInfo
,
sizeof
(
CMSG_SIGNER_INFO
),
TRUE
,
offsetof
(
CMSG_SIGNER_INFO
,
Issuer
.
pbData
)
};
struct
GenericArray
*
array
=
(
struct
GenericArray
*
)
pvStructInfo
;
TRACE
(
"%p, %d, %08x, %p, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
*
pcbStructInfo
);
ret
=
CRYPT_AsnDecodeArray
(
&
arrayDesc
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
pvStructInfo
,
pcbStructInfo
,
array
?
array
->
rgItems
:
NULL
);
return
ret
;
}
BOOL
CRYPT_AsnDecodePKCSSignedInfo
(
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
CRYPT_SIGNED_INFO
*
signedInfo
,
DWORD
*
pcbSignedInfo
)
{
BOOL
ret
=
FALSE
;
struct
AsnDecodeSequenceItem
items
[]
=
{
{
ASN_INTEGER
,
offsetof
(
CRYPT_SIGNED_INFO
,
version
),
CRYPT_AsnDecodeInt
,
sizeof
(
DWORD
),
FALSE
,
FALSE
,
0
,
0
},
/* Placeholder for the hash algorithms - redundant with those in the
* signers, so just ignore them.
*/
{
ASN_CONSTRUCTOR
|
ASN_SETOF
,
0
,
NULL
,
0
,
TRUE
,
FALSE
,
0
,
0
},
{
ASN_SEQUENCE
,
offsetof
(
CRYPT_SIGNED_INFO
,
content
),
CRYPT_AsnDecodePKCSContentInfoInternal
,
sizeof
(
CRYPT_CONTENT_INFO
),
FALSE
,
TRUE
,
offsetof
(
CRYPT_SIGNED_INFO
,
content
.
pszObjId
),
0
},
{
ASN_CONSTRUCTOR
|
ASN_CONTEXT
|
0
,
offsetof
(
CRYPT_SIGNED_INFO
,
cCertEncoded
),
CRYPT_DecodeDERArray
,
sizeof
(
struct
GenericArray
),
TRUE
,
TRUE
,
offsetof
(
CRYPT_SIGNED_INFO
,
rgCertEncoded
),
0
},
{
ASN_CONSTRUCTOR
|
ASN_CONTEXT
|
1
,
offsetof
(
CRYPT_SIGNED_INFO
,
cCrlEncoded
),
CRYPT_DecodeDERArray
,
sizeof
(
struct
GenericArray
),
TRUE
,
TRUE
,
offsetof
(
CRYPT_SIGNED_INFO
,
rgCrlEncoded
),
0
},
{
ASN_CONSTRUCTOR
|
ASN_SETOF
,
offsetof
(
CRYPT_SIGNED_INFO
,
cSignerInfo
),
CRYPT_DecodeSignerArray
,
sizeof
(
struct
GenericArray
),
TRUE
,
TRUE
,
offsetof
(
CRYPT_SIGNED_INFO
,
rgSignerInfo
),
0
},
};
TRACE
(
"%p, %d, %08x, %p, %p, %d
\n
"
,
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
signedInfo
,
*
pcbSignedInfo
);
ret
=
CRYPT_AsnDecodeSequence
(
X509_ASN_ENCODING
,
items
,
sizeof
(
items
)
/
sizeof
(
items
[
0
]),
pbEncoded
,
cbEncoded
,
dwFlags
,
pDecodePara
,
signedInfo
,
pcbSignedInfo
,
NULL
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
BOOL
WINAPI
CryptDecodeObjectEx
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
BYTE
*
pbEncoded
,
DWORD
cbEncoded
,
DWORD
dwFlags
,
PCRYPT_DECODE_PARA
pDecodePara
,
void
*
pvStructInfo
,
DWORD
*
pcbStructInfo
)
...
...
dlls/crypt32/msg.c
View file @
3a85fa6b
...
...
@@ -1253,6 +1253,23 @@ static BOOL CDecodeMsg_DecodeHashedContent(CDecodeMsg *msg,
return
ret
;
}
static
BOOL
CDecodeMsg_DecodeSignedContent
(
CDecodeMsg
*
msg
,
CRYPT_DER_BLOB
*
blob
)
{
BOOL
ret
;
CRYPT_SIGNED_INFO
*
signedInfo
;
DWORD
size
;
ret
=
CRYPT_AsnDecodePKCSSignedInfo
(
blob
->
pbData
,
blob
->
cbData
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
CRYPT_SIGNED_INFO
*
)
&
signedInfo
,
&
size
);
if
(
ret
)
{
FIXME
(
"store properties in message
\n
"
);
LocalFree
(
signedInfo
);
}
return
ret
;
}
/* Decodes the content in blob as the type given, and updates the value
* (type, parameters, etc.) of msg based on what blob contains.
* It doesn't just use msg's type, to allow a recursive call from an implicitly
...
...
@@ -1274,10 +1291,13 @@ static BOOL CDecodeMsg_DecodeContent(CDecodeMsg *msg, CRYPT_DER_BLOB *blob,
msg
->
type
=
CMSG_HASHED
;
break
;
case
CMSG_ENVELOPED
:
case
CMSG_SIGNED
:
FIXME
(
"unimplemented for type %s
\n
"
,
MSG_TYPE_STR
(
type
));
ret
=
TRUE
;
break
;
case
CMSG_SIGNED
:
if
((
ret
=
CDecodeMsg_DecodeSignedContent
(
msg
,
blob
)))
msg
->
type
=
CMSG_HASHED
;
break
;
default:
{
CRYPT_CONTENT_INFO
*
info
;
...
...
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