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
4f2fae1d
Commit
4f2fae1d
authored
Aug 28, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Test and implement pfnAddCert2Chain.
parent
8c34271a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
1 deletion
+68
-1
register.c
dlls/wintrust/register.c
+1
-1
softpub.c
dlls/wintrust/tests/softpub.c
+28
-0
wintrust_main.c
dlls/wintrust/wintrust_main.c
+37
-0
wintrust_priv.h
dlls/wintrust/wintrust_priv.h
+2
-0
No files found.
dlls/wintrust/register.c
View file @
4f2fae1d
...
...
@@ -838,7 +838,7 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
pPfns
->
pfnFree
=
WINTRUST_Free
;
pPfns
->
pfnAddStore2Chain
=
WINTRUST_AddStore
;
pPfns
->
pfnAddSgnr2Chain
=
WINTRUST_AddSgnr
;
pPfns
->
pfnAddCert2Chain
=
NULL
;
pPfns
->
pfnAddCert2Chain
=
WINTRUST_AddCert
;
pPfns
->
pfnAddPrivData2Chain
=
NULL
;
pPfns
->
psUIpfns
=
NULL
;
pPfns
->
pfnInitialize
=
(
PFN_PROVIDER_INIT_CALL
)
WINTRUST_ReadProviderFromReg
(
GuidString
,
Initialization
);
...
...
dlls/wintrust/tests/softpub.c
View file @
4f2fae1d
...
...
@@ -130,6 +130,8 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
ok
(
data
.
pasSigners
!=
NULL
,
"Expected pasSigners to be allocated
\n
"
);
if
(
data
.
pasSigners
)
{
PCCERT_CONTEXT
cert
;
ok
(
!
memcmp
(
&
data
.
pasSigners
[
0
],
&
sgnr
,
sizeof
(
sgnr
)),
"Unexpected data in signer
\n
"
);
/* Adds into the location specified by the index */
...
...
@@ -156,6 +158,32 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
/* Crash
ret = funcs->pfnAddCert2Chain(NULL, 0, FALSE, 0, NULL);
ret = funcs->pfnAddCert2Chain(&data, 0, FALSE, 0, NULL);
*/
cert
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
v1CertWithPubKey
,
sizeof
(
v1CertWithPubKey
));
if
(
cert
)
{
/* Notes on behavior that are hard to test:
* 1. If pasSigners is invalid, pfnAddCert2Chain crashes
* 2. An invalid signer index isn't checked.
*/
ret
=
funcs
->
pfnAddCert2Chain
(
&
data
,
0
,
FALSE
,
0
,
cert
);
ok
(
ret
,
"pfnAddCert2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
pasSigners
[
0
].
csCertChain
==
1
,
"Expected 1 cert, got %d
\n
"
,
data
.
pasSigners
[
0
].
csCertChain
);
ok
(
data
.
pasSigners
[
0
].
pasCertChain
!=
NULL
,
"Expected pasCertChain to be allocated
\n
"
);
if
(
data
.
pasSigners
[
0
].
pasCertChain
)
ok
(
data
.
pasSigners
[
0
].
pasCertChain
[
0
].
pCert
==
cert
,
"Unexpected cert
\n
"
);
CertFreeCertificateContext
(
cert
);
}
else
skip
(
"CertCreateCertificateContext failed: %08x
\n
"
,
GetLastError
());
}
}
...
...
dlls/wintrust/wintrust_main.c
View file @
4f2fae1d
...
...
@@ -303,3 +303,40 @@ BOOL WINAPI WINTRUST_AddSgnr(CRYPT_PROVIDER_DATA *data,
SetLastError
(
ERROR_OUTOFMEMORY
);
return
ret
;
}
BOOL
WINAPI
WINTRUST_AddCert
(
CRYPT_PROVIDER_DATA
*
data
,
DWORD
idxSigner
,
BOOL
fCounterSigner
,
DWORD
idxCounterSigner
,
PCCERT_CONTEXT
pCert2Add
)
{
BOOL
ret
=
FALSE
;
if
(
fCounterSigner
)
{
FIXME
(
"unimplemented for counter signers
\n
"
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
data
->
pasSigners
[
idxSigner
].
csCertChain
)
data
->
pasSigners
[
idxSigner
].
pasCertChain
=
WINTRUST_ReAlloc
(
data
->
pasSigners
[
idxSigner
].
pasCertChain
,
(
data
->
pasSigners
[
idxSigner
].
csCertChain
+
1
)
*
sizeof
(
CRYPT_PROVIDER_CERT
));
else
{
data
->
pasSigners
[
idxSigner
].
pasCertChain
=
WINTRUST_Alloc
(
sizeof
(
CRYPT_PROVIDER_CERT
));
data
->
pasSigners
[
idxSigner
].
csCertChain
=
0
;
}
if
(
data
->
pasSigners
[
idxSigner
].
pasCertChain
)
{
CRYPT_PROVIDER_CERT
*
cert
=
&
data
->
pasSigners
[
idxSigner
].
pasCertChain
[
data
->
pasSigners
[
idxSigner
].
csCertChain
];
cert
->
cbStruct
=
sizeof
(
CRYPT_PROVIDER_CERT
);
cert
->
pCert
=
CertDuplicateCertificateContext
(
pCert2Add
);
data
->
pasSigners
[
idxSigner
].
csCertChain
++
;
ret
=
TRUE
;
}
else
SetLastError
(
ERROR_OUTOFMEMORY
);
return
ret
;
}
dlls/wintrust/wintrust_priv.h
View file @
4f2fae1d
...
...
@@ -24,5 +24,7 @@ void WINAPI WINTRUST_Free(void *p);
BOOL
WINAPI
WINTRUST_AddStore
(
CRYPT_PROVIDER_DATA
*
data
,
HCERTSTORE
store
);
BOOL
WINAPI
WINTRUST_AddSgnr
(
CRYPT_PROVIDER_DATA
*
data
,
BOOL
fCounterSigner
,
DWORD
idxSigner
,
CRYPT_PROVIDER_SGNR
*
sgnr
);
BOOL
WINAPI
WINTRUST_AddCert
(
CRYPT_PROVIDER_DATA
*
data
,
DWORD
idxSigner
,
BOOL
fCounterSigner
,
DWORD
idxCounterSigner
,
PCCERT_CONTEXT
pCert2Add
);
#endif
/* ndef __WINTRUST_PRIV_H__ */
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