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
988e8a78
Commit
988e8a78
authored
Oct 15, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 15, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Moved CertAddCertificateContextToStore to cert.c.
parent
97861a52
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
128 additions
and
128 deletions
+128
-128
cert.c
dlls/crypt32/cert.c
+128
-0
store.c
dlls/crypt32/store.c
+0
-128
No files found.
dlls/crypt32/cert.c
View file @
988e8a78
...
@@ -121,6 +121,134 @@ static const context_vtbl_t cert_vtbl = {
...
@@ -121,6 +121,134 @@ static const context_vtbl_t cert_vtbl = {
Cert_free
Cert_free
};
};
BOOL
WINAPI
CertAddCertificateContextToStore
(
HCERTSTORE
hCertStore
,
PCCERT_CONTEXT
pCertContext
,
DWORD
dwAddDisposition
,
PCCERT_CONTEXT
*
ppStoreContext
)
{
WINECRYPT_CERTSTORE
*
store
=
hCertStore
;
BOOL
ret
=
TRUE
;
PCCERT_CONTEXT
toAdd
=
NULL
,
existing
=
NULL
;
TRACE
(
"(%p, %p, %08x, %p)
\n
"
,
hCertStore
,
pCertContext
,
dwAddDisposition
,
ppStoreContext
);
switch
(
dwAddDisposition
)
{
case
CERT_STORE_ADD_ALWAYS
:
break
;
case
CERT_STORE_ADD_NEW
:
case
CERT_STORE_ADD_REPLACE_EXISTING
:
case
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES
:
case
CERT_STORE_ADD_USE_EXISTING
:
case
CERT_STORE_ADD_NEWER
:
case
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES
:
{
BYTE
hashToAdd
[
20
];
DWORD
size
=
sizeof
(
hashToAdd
);
ret
=
CertGetCertificateContextProperty
(
pCertContext
,
CERT_HASH_PROP_ID
,
hashToAdd
,
&
size
);
if
(
ret
)
{
CRYPT_HASH_BLOB
blob
=
{
sizeof
(
hashToAdd
),
hashToAdd
};
existing
=
CertFindCertificateInStore
(
hCertStore
,
pCertContext
->
dwCertEncodingType
,
0
,
CERT_FIND_SHA1_HASH
,
&
blob
,
NULL
);
}
break
;
}
default:
FIXME
(
"Unimplemented add disposition %d
\n
"
,
dwAddDisposition
);
SetLastError
(
E_INVALIDARG
);
ret
=
FALSE
;
}
switch
(
dwAddDisposition
)
{
case
CERT_STORE_ADD_ALWAYS
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEW
:
if
(
existing
)
{
TRACE
(
"found matching certificate, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_REPLACE_EXISTING
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
if
(
existing
)
Context_CopyProperties
(
toAdd
,
existing
);
break
;
case
CERT_STORE_ADD_USE_EXISTING
:
if
(
existing
)
{
Context_CopyProperties
(
existing
,
pCertContext
);
if
(
ppStoreContext
)
*
ppStoreContext
=
CertDuplicateCertificateContext
(
existing
);
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEWER
:
if
(
existing
)
{
if
(
CompareFileTime
(
&
existing
->
pCertInfo
->
NotBefore
,
&
pCertContext
->
pCertInfo
->
NotBefore
)
>=
0
)
{
TRACE
(
"existing certificate is newer, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES
:
if
(
existing
)
{
if
(
CompareFileTime
(
&
existing
->
pCertInfo
->
NotBefore
,
&
pCertContext
->
pCertInfo
->
NotBefore
)
>=
0
)
{
TRACE
(
"existing certificate is newer, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
{
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
Context_CopyProperties
(
toAdd
,
existing
);
}
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
}
if
(
toAdd
)
{
if
(
store
)
ret
=
store
->
vtbl
->
certs
.
addContext
(
store
,
(
void
*
)
toAdd
,
(
void
*
)
existing
,
(
const
void
**
)
ppStoreContext
);
else
if
(
ppStoreContext
)
*
ppStoreContext
=
CertDuplicateCertificateContext
(
toAdd
);
CertFreeCertificateContext
(
toAdd
);
}
CertFreeCertificateContext
(
existing
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
BOOL
WINAPI
CertAddCertificateLinkToStore
(
HCERTSTORE
hCertStore
,
BOOL
WINAPI
CertAddCertificateLinkToStore
(
HCERTSTORE
hCertStore
,
PCCERT_CONTEXT
pCertContext
,
DWORD
dwAddDisposition
,
PCCERT_CONTEXT
pCertContext
,
DWORD
dwAddDisposition
,
PCCERT_CONTEXT
*
ppCertContext
)
PCCERT_CONTEXT
*
ppCertContext
)
...
...
dlls/crypt32/store.c
View file @
988e8a78
...
@@ -892,134 +892,6 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv,
...
@@ -892,134 +892,6 @@ HCERTSTORE WINAPI CertOpenSystemStoreW(HCRYPTPROV_LEGACY hProv,
CERT_SYSTEM_STORE_CURRENT_USER
,
szSubSystemProtocol
);
CERT_SYSTEM_STORE_CURRENT_USER
,
szSubSystemProtocol
);
}
}
BOOL
WINAPI
CertAddCertificateContextToStore
(
HCERTSTORE
hCertStore
,
PCCERT_CONTEXT
pCertContext
,
DWORD
dwAddDisposition
,
PCCERT_CONTEXT
*
ppStoreContext
)
{
WINECRYPT_CERTSTORE
*
store
=
hCertStore
;
BOOL
ret
=
TRUE
;
PCCERT_CONTEXT
toAdd
=
NULL
,
existing
=
NULL
;
TRACE
(
"(%p, %p, %08x, %p)
\n
"
,
hCertStore
,
pCertContext
,
dwAddDisposition
,
ppStoreContext
);
switch
(
dwAddDisposition
)
{
case
CERT_STORE_ADD_ALWAYS
:
break
;
case
CERT_STORE_ADD_NEW
:
case
CERT_STORE_ADD_REPLACE_EXISTING
:
case
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES
:
case
CERT_STORE_ADD_USE_EXISTING
:
case
CERT_STORE_ADD_NEWER
:
case
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES
:
{
BYTE
hashToAdd
[
20
];
DWORD
size
=
sizeof
(
hashToAdd
);
ret
=
CertGetCertificateContextProperty
(
pCertContext
,
CERT_HASH_PROP_ID
,
hashToAdd
,
&
size
);
if
(
ret
)
{
CRYPT_HASH_BLOB
blob
=
{
sizeof
(
hashToAdd
),
hashToAdd
};
existing
=
CertFindCertificateInStore
(
hCertStore
,
pCertContext
->
dwCertEncodingType
,
0
,
CERT_FIND_SHA1_HASH
,
&
blob
,
NULL
);
}
break
;
}
default:
FIXME
(
"Unimplemented add disposition %d
\n
"
,
dwAddDisposition
);
SetLastError
(
E_INVALIDARG
);
ret
=
FALSE
;
}
switch
(
dwAddDisposition
)
{
case
CERT_STORE_ADD_ALWAYS
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEW
:
if
(
existing
)
{
TRACE
(
"found matching certificate, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_REPLACE_EXISTING
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_REPLACE_EXISTING_INHERIT_PROPERTIES
:
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
if
(
existing
)
Context_CopyProperties
(
toAdd
,
existing
);
break
;
case
CERT_STORE_ADD_USE_EXISTING
:
if
(
existing
)
{
Context_CopyProperties
(
existing
,
pCertContext
);
if
(
ppStoreContext
)
*
ppStoreContext
=
CertDuplicateCertificateContext
(
existing
);
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEWER
:
if
(
existing
)
{
if
(
CompareFileTime
(
&
existing
->
pCertInfo
->
NotBefore
,
&
pCertContext
->
pCertInfo
->
NotBefore
)
>=
0
)
{
TRACE
(
"existing certificate is newer, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
case
CERT_STORE_ADD_NEWER_INHERIT_PROPERTIES
:
if
(
existing
)
{
if
(
CompareFileTime
(
&
existing
->
pCertInfo
->
NotBefore
,
&
pCertContext
->
pCertInfo
->
NotBefore
)
>=
0
)
{
TRACE
(
"existing certificate is newer, not adding
\n
"
);
SetLastError
(
CRYPT_E_EXISTS
);
ret
=
FALSE
;
}
else
{
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
Context_CopyProperties
(
toAdd
,
existing
);
}
}
else
toAdd
=
CertDuplicateCertificateContext
(
pCertContext
);
break
;
}
if
(
toAdd
)
{
if
(
store
)
ret
=
store
->
vtbl
->
certs
.
addContext
(
store
,
(
void
*
)
toAdd
,
(
void
*
)
existing
,
(
const
void
**
)
ppStoreContext
);
else
if
(
ppStoreContext
)
*
ppStoreContext
=
CertDuplicateCertificateContext
(
toAdd
);
CertFreeCertificateContext
(
toAdd
);
}
CertFreeCertificateContext
(
existing
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
PCCERT_CONTEXT
WINAPI
CertEnumCertificatesInStore
(
HCERTSTORE
hCertStore
,
PCCERT_CONTEXT
WINAPI
CertEnumCertificatesInStore
(
HCERTSTORE
hCertStore
,
PCCERT_CONTEXT
pPrev
)
PCCERT_CONTEXT
pPrev
)
{
{
...
...
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