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
391f826d
Commit
391f826d
authored
Sep 10, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Sep 11, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Add a function to create a certificate chain engine potentially before…
crypt32: Add a function to create a certificate chain engine potentially before the root store is created.
parent
29ae673c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
32 deletions
+53
-32
chain.c
dlls/crypt32/chain.c
+46
-32
crypt32_private.h
dlls/crypt32/crypt32_private.h
+7
-0
No files found.
dlls/crypt32/chain.c
View file @
391f826d
...
...
@@ -104,12 +104,48 @@ static BOOL CRYPT_CheckRestrictedRoot(HCERTSTORE store)
return
ret
;
}
BOOL
WINAPI
CertCreateCertificateChainEngine
(
PCERT_CHAIN_ENGINE_CONFIG
pConfig
,
HCERTCHAINENGINE
*
phChainEngine
)
HCERTCHAINENGINE
CRYPT_CreateChainEngine
(
HCERTSTORE
root
,
PCERT_CHAIN_ENGINE_CONFIG
pConfig
)
{
static
const
WCHAR
caW
[]
=
{
'C'
,
'A'
,
0
};
static
const
WCHAR
myW
[]
=
{
'M'
,
'y'
,
0
};
static
const
WCHAR
trustW
[]
=
{
'T'
,
'r'
,
'u'
,
's'
,
't'
,
0
};
PCertificateChainEngine
engine
=
CryptMemAlloc
(
sizeof
(
CertificateChainEngine
));
if
(
engine
)
{
HCERTSTORE
worldStores
[
4
];
engine
->
ref
=
1
;
engine
->
hRoot
=
root
;
engine
->
hWorld
=
CertOpenStore
(
CERT_STORE_PROV_COLLECTION
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
worldStores
[
0
]
=
CertDuplicateStore
(
engine
->
hRoot
);
worldStores
[
1
]
=
CertOpenSystemStoreW
(
0
,
caW
);
worldStores
[
2
]
=
CertOpenSystemStoreW
(
0
,
myW
);
worldStores
[
3
]
=
CertOpenSystemStoreW
(
0
,
trustW
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
sizeof
(
worldStores
)
/
sizeof
(
worldStores
[
0
]),
worldStores
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
pConfig
->
cAdditionalStore
,
pConfig
->
rghAdditionalStore
);
CRYPT_CloseStores
(
sizeof
(
worldStores
)
/
sizeof
(
worldStores
[
0
]),
worldStores
);
engine
->
dwFlags
=
pConfig
->
dwFlags
;
engine
->
dwUrlRetrievalTimeout
=
pConfig
->
dwUrlRetrievalTimeout
;
engine
->
MaximumCachedCertificates
=
pConfig
->
MaximumCachedCertificates
;
if
(
pConfig
->
CycleDetectionModulus
)
engine
->
CycleDetectionModulus
=
pConfig
->
CycleDetectionModulus
;
else
engine
->
CycleDetectionModulus
=
DEFAULT_CYCLE_MODULUS
;
}
return
(
HCERTCHAINENGINE
)
engine
;
}
BOOL
WINAPI
CertCreateCertificateChainEngine
(
PCERT_CHAIN_ENGINE_CONFIG
pConfig
,
HCERTCHAINENGINE
*
phChainEngine
)
{
BOOL
ret
;
TRACE
(
"(%p, %p)
\n
"
,
pConfig
,
phChainEngine
);
...
...
@@ -123,39 +159,17 @@ BOOL WINAPI CertCreateCertificateChainEngine(PCERT_CHAIN_ENGINE_CONFIG pConfig,
ret
=
CRYPT_CheckRestrictedRoot
(
pConfig
->
hRestrictedRoot
);
if
(
ret
)
{
PCertificateChainEngine
engine
=
CryptMemAlloc
(
sizeof
(
CertificateChainEngine
))
;
HCERTSTORE
root
;
HCERTCHAINENGINE
engine
;
if
(
pConfig
->
hRestrictedRoot
)
root
=
CertDuplicateStore
(
pConfig
->
hRestrictedRoot
);
else
root
=
CertOpenSystemStoreW
(
0
,
rootW
);
engine
=
CRYPT_CreateChainEngine
(
root
,
pConfig
);
if
(
engine
)
{
HCERTSTORE
worldStores
[
4
];
engine
->
ref
=
1
;
if
(
pConfig
->
hRestrictedRoot
)
engine
->
hRoot
=
CertDuplicateStore
(
pConfig
->
hRestrictedRoot
);
else
engine
->
hRoot
=
CertOpenSystemStoreW
(
0
,
rootW
);
engine
->
hWorld
=
CertOpenStore
(
CERT_STORE_PROV_COLLECTION
,
0
,
0
,
CERT_STORE_CREATE_NEW_FLAG
,
NULL
);
worldStores
[
0
]
=
CertDuplicateStore
(
engine
->
hRoot
);
worldStores
[
1
]
=
CertOpenSystemStoreW
(
0
,
caW
);
worldStores
[
2
]
=
CertOpenSystemStoreW
(
0
,
myW
);
worldStores
[
3
]
=
CertOpenSystemStoreW
(
0
,
trustW
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
sizeof
(
worldStores
)
/
sizeof
(
worldStores
[
0
]),
worldStores
);
CRYPT_AddStoresToCollection
(
engine
->
hWorld
,
pConfig
->
cAdditionalStore
,
pConfig
->
rghAdditionalStore
);
CRYPT_CloseStores
(
sizeof
(
worldStores
)
/
sizeof
(
worldStores
[
0
]),
worldStores
);
engine
->
dwFlags
=
pConfig
->
dwFlags
;
engine
->
dwUrlRetrievalTimeout
=
pConfig
->
dwUrlRetrievalTimeout
;
engine
->
MaximumCachedCertificates
=
pConfig
->
MaximumCachedCertificates
;
if
(
pConfig
->
CycleDetectionModulus
)
engine
->
CycleDetectionModulus
=
pConfig
->
CycleDetectionModulus
;
else
engine
->
CycleDetectionModulus
=
DEFAULT_CYCLE_MODULUS
;
*
phChainEngine
=
(
HCERTCHAINENGINE
)
engine
;
*
phChainEngine
=
engine
;
ret
=
TRUE
;
}
else
...
...
dlls/crypt32/crypt32_private.h
View file @
391f826d
...
...
@@ -251,6 +251,13 @@ PWINECRYPT_CERTSTORE CRYPT_FileNameOpenStoreA(HCRYPTPROV hCryptProv,
PWINECRYPT_CERTSTORE
CRYPT_FileNameOpenStoreW
(
HCRYPTPROV
hCryptProv
,
DWORD
dwFlags
,
const
void
*
pvPara
);
/* Allocates and initializes a certificate chain engine, but without creating
* the root store. Instead, it uses root, and assumes the caller has done any
* checking necessary.
*/
HCERTCHAINENGINE
CRYPT_CreateChainEngine
(
HCERTSTORE
root
,
PCERT_CHAIN_ENGINE_CONFIG
pConfig
);
/* Helper function for store reading functions and
* CertAddSerializedElementToStore. Returns a context of the appropriate type
* if it can, or NULL otherwise. Doesn't validate any of the properties in
...
...
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