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
9e7c5626
Commit
9e7c5626
authored
Dec 09, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Dec 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Implement WVTAsn1SpcSpOpusInfoEncode.
parent
796bb073
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
14 deletions
+100
-14
asn.c
dlls/wintrust/asn.c
+100
-9
asn.c
dlls/wintrust/tests/asn.c
+0
-5
No files found.
dlls/wintrust/asn.c
View file @
9e7c5626
...
...
@@ -740,15 +740,6 @@ BOOL WINAPI WVTAsn1SpcIndirectDataContentEncode(DWORD dwCertEncodingType,
return
ret
;
}
BOOL
WINAPI
WVTAsn1SpcSpOpusInfoEncode
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
FIXME
(
"(0x%08x, %s, %p, %p, %p): stub
\n
"
,
dwCertEncodingType
,
debugstr_a
(
lpszStructType
),
pvStructInfo
,
pbEncoded
,
pcbEncoded
);
return
FALSE
;
}
static
BOOL
WINAPI
CRYPT_AsnEncodeBMPString
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
...
...
@@ -788,6 +779,106 @@ static BOOL WINAPI CRYPT_AsnEncodeBMPString(DWORD dwCertEncodingType,
return
ret
;
}
struct
AsnEncodeTagSwappedItem
{
BYTE
tag
;
const
void
*
pvStructInfo
;
CryptEncodeObjectFunc
encodeFunc
;
};
/* Sort of a wacky hack, it encodes something using the struct
* AsnEncodeTagSwappedItem's encodeFunc, then replaces the tag byte with the tag
* given in the struct AsnEncodeTagSwappedItem.
*/
static
BOOL
WINAPI
CRYPT_AsnEncodeSwapTag
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
BOOL
ret
;
const
struct
AsnEncodeTagSwappedItem
*
item
=
pvStructInfo
;
ret
=
item
->
encodeFunc
(
dwCertEncodingType
,
lpszStructType
,
item
->
pvStructInfo
,
pbEncoded
,
pcbEncoded
);
if
(
ret
&&
pbEncoded
)
*
pbEncoded
=
item
->
tag
;
return
ret
;
}
BOOL
WINAPI
WVTAsn1SpcSpOpusInfoEncode
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
{
BOOL
ret
=
FALSE
;
TRACE
(
"(0x%08x, %s, %p, %p, %p)
\n
"
,
dwCertEncodingType
,
debugstr_a
(
lpszStructType
),
pvStructInfo
,
pbEncoded
,
pcbEncoded
);
__TRY
{
const
SPC_SP_OPUS_INFO
*
info
=
pvStructInfo
;
if
(
info
->
pMoreInfo
&&
info
->
pMoreInfo
->
dwLinkChoice
!=
SPC_URL_LINK_CHOICE
&&
info
->
pMoreInfo
->
dwLinkChoice
!=
SPC_MONIKER_LINK_CHOICE
&&
info
->
pMoreInfo
->
dwLinkChoice
!=
SPC_FILE_LINK_CHOICE
)
SetLastError
(
E_INVALIDARG
);
else
if
(
info
->
pPublisherInfo
&&
info
->
pPublisherInfo
->
dwLinkChoice
!=
SPC_URL_LINK_CHOICE
&&
info
->
pPublisherInfo
->
dwLinkChoice
!=
SPC_MONIKER_LINK_CHOICE
&&
info
->
pPublisherInfo
->
dwLinkChoice
!=
SPC_FILE_LINK_CHOICE
)
SetLastError
(
E_INVALIDARG
);
else
{
struct
AsnEncodeSequenceItem
items
[
3
]
=
{
{
0
}
};
struct
AsnConstructedItem
constructed
[
3
]
=
{
{
0
}
};
struct
AsnEncodeTagSwappedItem
swapped
;
DWORD
cItem
=
0
,
cConstructed
=
0
;
if
(
info
->
pwszProgramName
)
{
swapped
.
tag
=
ASN_CONTEXT
;
swapped
.
pvStructInfo
=
info
->
pwszProgramName
;
swapped
.
encodeFunc
=
CRYPT_AsnEncodeBMPString
;
constructed
[
cConstructed
].
tag
=
0
;
constructed
[
cConstructed
].
pvStructInfo
=
&
swapped
;
constructed
[
cConstructed
].
encodeFunc
=
CRYPT_AsnEncodeSwapTag
;
items
[
cItem
].
pvStructInfo
=
&
constructed
[
cConstructed
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeConstructed
;
cConstructed
++
;
cItem
++
;
}
if
(
info
->
pMoreInfo
)
{
constructed
[
cConstructed
].
tag
=
1
;
constructed
[
cConstructed
].
pvStructInfo
=
info
->
pMoreInfo
;
constructed
[
cConstructed
].
encodeFunc
=
WVTAsn1SpcLinkEncode
;
items
[
cItem
].
pvStructInfo
=
&
constructed
[
cConstructed
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeConstructed
;
cConstructed
++
;
cItem
++
;
}
if
(
info
->
pPublisherInfo
)
{
constructed
[
cConstructed
].
tag
=
2
;
constructed
[
cConstructed
].
pvStructInfo
=
info
->
pPublisherInfo
;
constructed
[
cConstructed
].
encodeFunc
=
WVTAsn1SpcLinkEncode
;
items
[
cItem
].
pvStructInfo
=
&
constructed
[
cConstructed
];
items
[
cItem
].
encodeFunc
=
CRYPT_AsnEncodeConstructed
;
cConstructed
++
;
cItem
++
;
}
ret
=
CRYPT_AsnEncodeSequence
(
X509_ASN_ENCODING
,
items
,
cItem
,
pbEncoded
,
pcbEncoded
);
}
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
STATUS_ACCESS_VIOLATION
);
}
__ENDTRY
return
ret
;
}
static
BOOL
CRYPT_AsnEncodeInteger
(
DWORD
dwCertEncodingType
,
LPCSTR
lpszStructType
,
const
void
*
pvStructInfo
,
BYTE
*
pbEncoded
,
DWORD
*
pcbEncoded
)
...
...
dlls/wintrust/tests/asn.c
View file @
9e7c5626
...
...
@@ -810,7 +810,6 @@ static void test_encodeSpOpusInfo(void)
memset
(
&
info
,
0
,
sizeof
(
info
));
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
@@ -821,7 +820,6 @@ static void test_encodeSpOpusInfo(void)
info
.
pwszProgramName
=
progName
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
@@ -837,14 +835,12 @@ static void test_encodeSpOpusInfo(void)
SetLastError
(
0xdeadbeef
);
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
moreInfo
.
dwLinkChoice
=
SPC_URL_LINK_CHOICE
;
moreInfo
.
pwszUrl
=
winehq
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
@@ -858,7 +854,6 @@ static void test_encodeSpOpusInfo(void)
info
.
pPublisherInfo
=
&
moreInfo
;
ret
=
pCryptEncodeObjectEx
(
X509_ASN_ENCODING
,
SPC_SP_OPUS_INFO_STRUCT
,
(
LPBYTE
)
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
&
buf
,
&
size
);
todo_wine
ok
(
ret
,
"CryptEncodeObjectEx failed: %08x
\n
"
,
GetLastError
());
if
(
ret
)
{
...
...
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