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
6eddbf18
Commit
6eddbf18
authored
Oct 17, 2013
by
Jacek Caban
Committed by
Alexandre Julliard
Oct 17, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Store properties directly in link contexts and get rid of Context_GetProperties.
parent
275ac93e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
71 deletions
+45
-71
cert.c
dlls/crypt32/cert.c
+0
-0
context.c
dlls/crypt32/context.c
+3
-12
crl.c
dlls/crypt32/crl.c
+20
-30
crypt32_private.h
dlls/crypt32/crypt32_private.h
+0
-5
ctl.c
dlls/crypt32/ctl.c
+22
-24
No files found.
dlls/crypt32/cert.c
View file @
6eddbf18
This diff is collapsed.
Click to expand it.
dlls/crypt32/context.c
View file @
6eddbf18
...
...
@@ -64,6 +64,7 @@ context_t *Context_CreateLinkContext(unsigned int contextSize, context_t *linked
context
->
vtbl
=
linked
->
vtbl
;
context
->
ref
=
1
;
context
->
linked
=
linked
;
context
->
properties
=
linked
->
properties
;
Context_AddRef
(
linked
);
TRACE
(
"returning %p
\n
"
,
context
);
...
...
@@ -76,16 +77,6 @@ void Context_AddRef(context_t *context)
TRACE
(
"(%p) ref=%d
\n
"
,
context
,
context
->
ref
);
}
CONTEXT_PROPERTY_LIST
*
Context_GetProperties
(
const
void
*
context
)
{
BASE_CONTEXT
*
ptr
=
BASE_CONTEXT_FROM_CONTEXT
(
context
);
while
(
ptr
&&
ptr
->
linked
)
ptr
=
ptr
->
linked
;
return
ptr
->
properties
;
}
BOOL
Context_Release
(
context_t
*
context
)
{
BOOL
ret
=
TRUE
;
...
...
@@ -116,8 +107,8 @@ void Context_CopyProperties(const void *to, const void *from)
{
CONTEXT_PROPERTY_LIST
*
toProperties
,
*
fromProperties
;
toProperties
=
Context_GetProperties
(
to
)
;
fromProperties
=
Context_GetProperties
(
from
)
;
toProperties
=
context_from_ptr
(
to
)
->
properties
;
fromProperties
=
context_from_ptr
(
from
)
->
properties
;
assert
(
toProperties
&&
fromProperties
);
ContextPropertyList_Copy
(
toProperties
,
fromProperties
);
}
...
...
dlls/crypt32/crl.c
View file @
6eddbf18
...
...
@@ -375,22 +375,15 @@ BOOL WINAPI CertFreeCRLContext(PCCRL_CONTEXT pCrlContext)
DWORD
WINAPI
CertEnumCRLContextProperties
(
PCCRL_CONTEXT
pCRLContext
,
DWORD
dwPropId
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
pCRLContext
);
DWORD
ret
;
TRACE
(
"(%p, %d)
\n
"
,
pCRLContext
,
dwPropId
);
if
(
properties
)
ret
=
ContextPropertyList_EnumPropIDs
(
properties
,
dwPropId
);
else
ret
=
0
;
return
ret
;
return
ContextPropertyList_EnumPropIDs
(
crl_from_ptr
(
pCRLContext
)
->
base
.
properties
,
dwPropId
);
}
static
BOOL
CRLContext_SetProperty
(
PCCRL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CRLContext_SetProperty
(
crl_t
*
crl
,
DWORD
dwPropId
,
DWORD
dwFlags
,
const
void
*
pvData
);
static
BOOL
CRLContext_GetHashProp
(
PCCRL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CRLContext_GetHashProp
(
crl_t
*
crl
,
DWORD
dwPropId
,
ALG_ID
algID
,
const
BYTE
*
toHash
,
DWORD
toHashLen
,
void
*
pvData
,
DWORD
*
pcbData
)
{
...
...
@@ -400,22 +393,21 @@ static BOOL CRLContext_GetHashProp(PCCRL_CONTEXT context, DWORD dwPropId,
{
CRYPT_DATA_BLOB
blob
=
{
*
pcbData
,
pvData
};
ret
=
CRLContext_SetProperty
(
c
ontext
,
dwPropId
,
0
,
&
blob
);
ret
=
CRLContext_SetProperty
(
c
rl
,
dwPropId
,
0
,
&
blob
);
}
return
ret
;
}
static
BOOL
CRLContext_GetProperty
(
PCCRL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CRLContext_GetProperty
(
crl_t
*
crl
,
DWORD
dwPropId
,
void
*
pvData
,
DWORD
*
pcbData
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
context
);
BOOL
ret
;
CRYPT_DATA_BLOB
blob
;
TRACE
(
"(%p, %d, %p, %p)
\n
"
,
c
ontext
,
dwPropId
,
pvData
,
pcbData
);
TRACE
(
"(%p, %d, %p, %p)
\n
"
,
c
rl
,
dwPropId
,
pvData
,
pcbData
);
if
(
properties
)
ret
=
ContextPropertyList_FindProperty
(
properties
,
dwPropId
,
&
blob
);
if
(
crl
->
base
.
properties
)
ret
=
ContextPropertyList_FindProperty
(
crl
->
base
.
properties
,
dwPropId
,
&
blob
);
else
ret
=
FALSE
;
if
(
ret
)
...
...
@@ -440,13 +432,13 @@ static BOOL CRLContext_GetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
switch
(
dwPropId
)
{
case
CERT_SHA1_HASH_PROP_ID
:
ret
=
CRLContext_GetHashProp
(
c
ontext
,
dwPropId
,
CALG_SHA1
,
c
ontext
->
pbCrlEncoded
,
context
->
cbCrlEncoded
,
pvData
,
ret
=
CRLContext_GetHashProp
(
c
rl
,
dwPropId
,
CALG_SHA1
,
c
rl
->
ctx
.
pbCrlEncoded
,
crl
->
ctx
.
cbCrlEncoded
,
pvData
,
pcbData
);
break
;
case
CERT_MD5_HASH_PROP_ID
:
ret
=
CRLContext_GetHashProp
(
c
ontext
,
dwPropId
,
CALG_MD5
,
c
ontext
->
pbCrlEncoded
,
context
->
cbCrlEncoded
,
pvData
,
ret
=
CRLContext_GetHashProp
(
c
rl
,
dwPropId
,
CALG_MD5
,
c
rl
->
ctx
.
pbCrlEncoded
,
crl
->
ctx
.
cbCrlEncoded
,
pvData
,
pcbData
);
break
;
default:
...
...
@@ -498,25 +490,23 @@ BOOL WINAPI CertGetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
}
break
;
default:
ret
=
CRLContext_GetProperty
(
pCRLContext
,
dwPropId
,
pvData
,
pcbData
);
ret
=
CRLContext_GetProperty
(
crl_from_ptr
(
pCRLContext
),
dwPropId
,
pvData
,
pcbData
);
}
return
ret
;
}
static
BOOL
CRLContext_SetProperty
(
PCCRL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CRLContext_SetProperty
(
crl_t
*
crl
,
DWORD
dwPropId
,
DWORD
dwFlags
,
const
void
*
pvData
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
context
);
BOOL
ret
;
TRACE
(
"(%p, %d, %08x, %p)
\n
"
,
c
ontext
,
dwPropId
,
dwFlags
,
pvData
);
TRACE
(
"(%p, %d, %08x, %p)
\n
"
,
c
rl
,
dwPropId
,
dwFlags
,
pvData
);
if
(
!
properties
)
if
(
!
crl
->
base
.
properties
)
ret
=
FALSE
;
else
if
(
!
pvData
)
{
ContextPropertyList_RemoveProperty
(
properties
,
dwPropId
);
ContextPropertyList_RemoveProperty
(
crl
->
base
.
properties
,
dwPropId
);
ret
=
TRUE
;
}
else
...
...
@@ -543,12 +533,12 @@ static BOOL CRLContext_SetProperty(PCCRL_CONTEXT context, DWORD dwPropId,
{
PCRYPT_DATA_BLOB
blob
=
(
PCRYPT_DATA_BLOB
)
pvData
;
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
ret
=
ContextPropertyList_SetProperty
(
crl
->
base
.
properties
,
dwPropId
,
blob
->
pbData
,
blob
->
cbData
);
break
;
}
case
CERT_DATE_STAMP_PROP_ID
:
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
ret
=
ContextPropertyList_SetProperty
(
crl
->
base
.
properties
,
dwPropId
,
pvData
,
sizeof
(
FILETIME
));
break
;
default:
...
...
@@ -580,7 +570,7 @@ BOOL WINAPI CertSetCRLContextProperty(PCCRL_CONTEXT pCRLContext,
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
ret
=
CRLContext_SetProperty
(
pCRLContext
,
dwPropId
,
dwFlags
,
pvData
);
ret
=
CRLContext_SetProperty
(
crl_from_ptr
(
pCRLContext
)
,
dwPropId
,
dwFlags
,
pvData
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
ret
;
}
...
...
dlls/crypt32/crypt32_private.h
View file @
6eddbf18
...
...
@@ -402,11 +402,6 @@ context_t *Context_CreateLinkContext(unsigned contextSize, context_t *linked) DE
/* Copies properties from fromContext to toContext. */
void
Context_CopyProperties
(
const
void
*
to
,
const
void
*
from
)
DECLSPEC_HIDDEN
;
/* Returns context's properties, or the linked context's properties if context
* is a link context.
*/
CONTEXT_PROPERTY_LIST
*
Context_GetProperties
(
const
void
*
context
)
DECLSPEC_HIDDEN
;
void
Context_AddRef
(
context_t
*
)
DECLSPEC_HIDDEN
;
/* Decrements context's ref count. If context is a link context, releases its
...
...
dlls/crypt32/ctl.c
View file @
6eddbf18
...
...
@@ -508,22 +508,22 @@ BOOL WINAPI CertFreeCTLContext(PCCTL_CONTEXT pCTLContext)
DWORD
WINAPI
CertEnumCTLContextProperties
(
PCCTL_CONTEXT
pCTLContext
,
DWORD
dwPropId
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
pCTLContext
);
ctl_t
*
ctl
=
ctl_from_ptr
(
pCTLContext
);
DWORD
ret
;
TRACE
(
"(%p, %d)
\n
"
,
pCTLContext
,
dwPropId
);
if
(
properties
)
ret
=
ContextPropertyList_EnumPropIDs
(
properties
,
dwPropId
);
if
(
ctl
->
base
.
properties
)
ret
=
ContextPropertyList_EnumPropIDs
(
ctl
->
base
.
properties
,
dwPropId
);
else
ret
=
0
;
return
ret
;
}
static
BOOL
CTLContext_SetProperty
(
PCCTL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CTLContext_SetProperty
(
ctl_t
*
ctl
,
DWORD
dwPropId
,
DWORD
dwFlags
,
const
void
*
pvData
);
static
BOOL
CTLContext_GetHashProp
(
PCCTL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CTLContext_GetHashProp
(
ctl_t
*
ctl
,
DWORD
dwPropId
,
ALG_ID
algID
,
const
BYTE
*
toHash
,
DWORD
toHashLen
,
void
*
pvData
,
DWORD
*
pcbData
)
{
...
...
@@ -533,22 +533,21 @@ static BOOL CTLContext_GetHashProp(PCCTL_CONTEXT context, DWORD dwPropId,
{
CRYPT_DATA_BLOB
blob
=
{
*
pcbData
,
pvData
};
ret
=
CTLContext_SetProperty
(
c
ontext
,
dwPropId
,
0
,
&
blob
);
ret
=
CTLContext_SetProperty
(
c
tl
,
dwPropId
,
0
,
&
blob
);
}
return
ret
;
}
static
BOOL
CTLContext_GetProperty
(
PCCTL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CTLContext_GetProperty
(
ctl_t
*
ctl
,
DWORD
dwPropId
,
void
*
pvData
,
DWORD
*
pcbData
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
context
);
BOOL
ret
;
CRYPT_DATA_BLOB
blob
;
TRACE
(
"(%p, %d, %p, %p)
\n
"
,
c
ontext
,
dwPropId
,
pvData
,
pcbData
);
TRACE
(
"(%p, %d, %p, %p)
\n
"
,
c
tl
,
dwPropId
,
pvData
,
pcbData
);
if
(
properties
)
ret
=
ContextPropertyList_FindProperty
(
properties
,
dwPropId
,
&
blob
);
if
(
ctl
->
base
.
properties
)
ret
=
ContextPropertyList_FindProperty
(
ctl
->
base
.
properties
,
dwPropId
,
&
blob
);
else
ret
=
FALSE
;
if
(
ret
)
...
...
@@ -573,12 +572,12 @@ static BOOL CTLContext_GetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
switch
(
dwPropId
)
{
case
CERT_SHA1_HASH_PROP_ID
:
ret
=
CTLContext_GetHashProp
(
c
ontext
,
dwPropId
,
CALG_SHA1
,
c
ontext
->
pbCtlEncoded
,
context
->
cbCtlEncoded
,
pvData
,
pcbData
);
ret
=
CTLContext_GetHashProp
(
c
tl
,
dwPropId
,
CALG_SHA1
,
c
tl
->
ctx
.
pbCtlEncoded
,
ctl
->
ctx
.
cbCtlEncoded
,
pvData
,
pcbData
);
break
;
case
CERT_MD5_HASH_PROP_ID
:
ret
=
CTLContext_GetHashProp
(
c
ontext
,
dwPropId
,
CALG_MD5
,
c
ontext
->
pbCtlEncoded
,
context
->
cbCtlEncoded
,
pvData
,
pcbData
);
ret
=
CTLContext_GetHashProp
(
c
tl
,
dwPropId
,
CALG_MD5
,
c
tl
->
ctx
.
pbCtlEncoded
,
ctl
->
ctx
.
cbCtlEncoded
,
pvData
,
pcbData
);
break
;
default:
SetLastError
(
CRYPT_E_NOT_FOUND
);
...
...
@@ -629,25 +628,24 @@ BOOL WINAPI CertGetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
}
break
;
default:
ret
=
CTLContext_GetProperty
(
pCTLContext
,
dwPropId
,
pvData
,
ret
=
CTLContext_GetProperty
(
ctl_from_ptr
(
pCTLContext
)
,
dwPropId
,
pvData
,
pcbData
);
}
return
ret
;
}
static
BOOL
CTLContext_SetProperty
(
PCCTL_CONTEXT
context
,
DWORD
dwPropId
,
static
BOOL
CTLContext_SetProperty
(
ctl_t
*
ctl
,
DWORD
dwPropId
,
DWORD
dwFlags
,
const
void
*
pvData
)
{
CONTEXT_PROPERTY_LIST
*
properties
=
Context_GetProperties
(
context
);
BOOL
ret
;
TRACE
(
"(%p, %d, %08x, %p)
\n
"
,
c
ontext
,
dwPropId
,
dwFlags
,
pvData
);
TRACE
(
"(%p, %d, %08x, %p)
\n
"
,
c
tl
,
dwPropId
,
dwFlags
,
pvData
);
if
(
!
properties
)
if
(
!
ctl
->
base
.
properties
)
ret
=
FALSE
;
else
if
(
!
pvData
)
{
ContextPropertyList_RemoveProperty
(
properties
,
dwPropId
);
ContextPropertyList_RemoveProperty
(
ctl
->
base
.
properties
,
dwPropId
);
ret
=
TRUE
;
}
else
...
...
@@ -674,12 +672,12 @@ static BOOL CTLContext_SetProperty(PCCTL_CONTEXT context, DWORD dwPropId,
{
PCRYPT_DATA_BLOB
blob
=
(
PCRYPT_DATA_BLOB
)
pvData
;
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
ret
=
ContextPropertyList_SetProperty
(
ctl
->
base
.
properties
,
dwPropId
,
blob
->
pbData
,
blob
->
cbData
);
break
;
}
case
CERT_DATE_STAMP_PROP_ID
:
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
ret
=
ContextPropertyList_SetProperty
(
ctl
->
base
.
properties
,
dwPropId
,
pvData
,
sizeof
(
FILETIME
));
break
;
default:
...
...
@@ -711,7 +709,7 @@ BOOL WINAPI CertSetCTLContextProperty(PCCTL_CONTEXT pCTLContext,
SetLastError
(
E_INVALIDARG
);
return
FALSE
;
}
ret
=
CTLContext_SetProperty
(
pCTLContext
,
dwPropId
,
dwFlags
,
pvData
);
ret
=
CTLContext_SetProperty
(
ctl_from_ptr
(
pCTLContext
)
,
dwPropId
,
dwFlags
,
pvData
);
TRACE
(
"returning %d
\n
"
,
ret
);
return
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