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
5885eb3c
Commit
5885eb3c
authored
Aug 02, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 03, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Fix typo in key context property test, and the problems it hid.
parent
90824039
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
41 deletions
+32
-41
cert.c
dlls/crypt32/cert.c
+8
-2
cert.c
dlls/crypt32/tests/cert.c
+24
-39
No files found.
dlls/crypt32/cert.c
View file @
5885eb3c
...
...
@@ -476,8 +476,14 @@ static BOOL WINAPI CertContext_SetProperty(void *context, DWORD dwPropId,
{
const
CERT_KEY_CONTEXT
*
keyContext
=
(
const
CERT_KEY_CONTEXT
*
)
pvData
;
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
(
const
BYTE
*
)
keyContext
,
keyContext
->
cbSize
);
if
(
keyContext
->
cbSize
!=
sizeof
(
CERT_KEY_CONTEXT
))
{
SetLastError
(
E_INVALIDARG
);
ret
=
FALSE
;
}
else
ret
=
ContextPropertyList_SetProperty
(
properties
,
dwPropId
,
(
const
BYTE
*
)
keyContext
,
keyContext
->
cbSize
);
}
else
{
...
...
dlls/crypt32/tests/cert.c
View file @
5885eb3c
...
...
@@ -334,7 +334,6 @@ static void testCertProperties(void)
BYTE
hash
[
20
]
=
{
0
},
hashProperty
[
20
];
CRYPT_DATA_BLOB
blob
;
CERT_KEY_CONTEXT
keyContext
;
HCRYPTPROV
csp
;
ok
(
context
!=
NULL
,
"CertCreateCertificateContext failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -442,50 +441,38 @@ static void testCertProperties(void)
context
->
pCertInfo
->
SubjectPublicKeyInfo
.
PublicKey
.
cbData
,
CALG_MD5
,
context
,
CERT_SUBJECT_PUBLIC_KEY_MD5_HASH_PROP_ID
);
/* Test key
identifier
s and handles and such */
/* Test key
context
s and handles and such */
size
=
0
;
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_IDENTIFIER_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_DATA
,
"Expected
ERROR_INVALID_DATA
, got %08x
\n
"
,
GetLastError
());
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected
CRYPT_E_NOT_FOUND
, got %08x
\n
"
,
GetLastError
());
size
=
sizeof
(
CERT_KEY_CONTEXT
);
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_IDENTIFIER_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_DATA
,
"Expected
ERROR_INVALID_DATA
, got %08x
\n
"
,
GetLastError
());
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_IDENTIFIER_PROP_ID
,
&
keyContext
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_DATA
,
"Expected
ERROR_INVALID_DATA
, got %08x
\n
"
,
GetLastError
());
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
NULL
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected
CRYPT_E_NOT_FOUND
, got %08x
\n
"
,
GetLastError
());
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
&
keyContext
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected
CRYPT_E_NOT_FOUND
, got %08x
\n
"
,
GetLastError
());
/* Key context with an invalid size */
keyContext
.
cbSize
=
0
;
ret
=
CertSetCertificateContextProperty
(
context
,
CERT_KEY_IDENTIFIER_PROP_ID
,
0
,
&
keyContext
);
ok
(
ret
,
"CertSetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
ret
=
CertSetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
0
,
&
keyContext
);
ok
(
!
ret
&&
GetLastError
()
==
E_INVALIDARG
,
"Expected E_INVALIDARG, got %08x
\n
"
,
GetLastError
());
size
=
sizeof
(
keyContext
);
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_IDENTIFIER_PROP_ID
,
&
keyContext
,
&
size
);
ok
(
ret
,
"CertGetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
ret
=
CertGetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
&
keyContext
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_NOT_FOUND
,
"Expected CRYPT_E_NOT_FOUND, got %08x
\n
"
,
GetLastError
());
keyContext
.
cbSize
=
sizeof
(
keyContext
);
keyContext
.
hCryptProv
=
0
;
keyContext
.
dwKeySpec
=
AT_SIGNATURE
;
/* Crash
ret = CertSetCertificateContextProperty(context,
CERT_KEY_IDENTIFIER_PROP_ID, 0, &keyContext);
ret = CertSetCertificateContextProperty(context,
CERT_KEY_IDENTIFIER_PROP_ID, CERT_STORE_NO_CRYPT_RELEASE_FLAG,
&keyContext);
*/
ret
=
CryptAcquireContextW
(
&
csp
,
cspNameW
,
MS_DEF_PROV_W
,
PROV_RSA_FULL
,
CRYPT_NEWKEYSET
);
ok
(
ret
,
"CryptAcquireContextW failed: %08x
\n
"
,
GetLastError
());
keyContext
.
hCryptProv
=
csp
;
ret
=
CertSetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
0
,
&
keyContext
);
ok
(
ret
,
"CertSetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
ret
=
CertSetCertificateContextProperty
(
context
,
CERT_KEY_CONTEXT_PROP_ID
,
0
,
&
keyContext
);
ok
(
ret
,
"CertSetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
/* Now that that's set, the key prov handle property is also gettable.
*/
size
=
sizeof
(
DWORD
);
...
...
@@ -506,8 +493,6 @@ static void testCertProperties(void)
GetLastError
());
ok
(
keyContext
.
hCryptProv
==
0
,
"Expected no hCryptProv
\n
"
);
CryptReleaseContext
(
csp
,
0
);
CertFreeCertificateContext
(
context
);
}
...
...
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