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
b04c4aa6
Commit
b04c4aa6
authored
Feb 14, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Feb 16, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Vista doesn't actually add duplicate usage identifiers; fix tests and…
crypt32: Vista doesn't actually add duplicate usage identifiers; fix tests and change Wine to match.
parent
b579eac2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
20 deletions
+36
-20
cert.c
dlls/crypt32/cert.c
+31
-17
cert.c
dlls/crypt32/tests/cert.c
+5
-3
No files found.
dlls/crypt32/cert.c
View file @
b04c4aa6
...
...
@@ -1902,29 +1902,43 @@ BOOL WINAPI CertAddEnhancedKeyUsageIdentifier(PCCERT_CONTEXT pCertContext,
CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG
,
usage
,
&
size
);
if
(
ret
)
{
PCERT_ENHKEY_USAGE
newUsage
=
CryptMemAlloc
(
size
+
sizeof
(
LPSTR
)
+
strlen
(
pszUsageIdentifier
)
+
1
)
;
DWORD
i
;
BOOL
exists
=
FALSE
;
if
(
newUsage
)
/* Make sure usage doesn't already exist */
for
(
i
=
0
;
!
exists
&&
i
<
usage
->
cUsageIdentifier
;
i
++
)
{
LPSTR
nextOID
;
DWORD
i
;
if
(
!
strcmp
(
usage
->
rgpszUsageIdentifier
[
i
],
pszUsageIdentifier
))
exists
=
TRUE
;
}
if
(
!
exists
)
{
PCERT_ENHKEY_USAGE
newUsage
=
CryptMemAlloc
(
size
+
sizeof
(
LPSTR
)
+
strlen
(
pszUsageIdentifier
)
+
1
);
newUsage
->
rgpszUsageIdentifier
=
(
LPSTR
*
)((
LPBYTE
)
newUsage
+
sizeof
(
CERT_ENHKEY_USAGE
));
nextOID
=
(
LPSTR
)((
LPBYTE
)
newUsage
->
rgpszUsageIdentifier
+
(
usage
->
cUsageIdentifier
+
1
)
*
sizeof
(
LPSTR
));
for
(
i
=
0
;
i
<
usage
->
cUsageIdentifier
;
i
++
)
if
(
newUsage
)
{
LPSTR
nextOID
;
newUsage
->
rgpszUsageIdentifier
=
(
LPSTR
*
)
((
LPBYTE
)
newUsage
+
sizeof
(
CERT_ENHKEY_USAGE
));
nextOID
=
(
LPSTR
)((
LPBYTE
)
newUsage
->
rgpszUsageIdentifier
+
(
usage
->
cUsageIdentifier
+
1
)
*
sizeof
(
LPSTR
));
for
(
i
=
0
;
i
<
usage
->
cUsageIdentifier
;
i
++
)
{
newUsage
->
rgpszUsageIdentifier
[
i
]
=
nextOID
;
strcpy
(
nextOID
,
usage
->
rgpszUsageIdentifier
[
i
]);
nextOID
+=
strlen
(
nextOID
)
+
1
;
}
newUsage
->
rgpszUsageIdentifier
[
i
]
=
nextOID
;
strcpy
(
nextOID
,
usage
->
rgpszUsageIdentifier
[
i
]);
nextOID
+=
strlen
(
nextOID
)
+
1
;
strcpy
(
nextOID
,
pszUsageIdentifier
);
newUsage
->
cUsageIdentifier
=
i
+
1
;
ret
=
CertSetEnhancedKeyUsage
(
pCertContext
,
newUsage
);
CryptMemFree
(
newUsage
);
}
newUsage
->
rgpszUsageIdentifier
[
i
]
=
nextOID
;
strcpy
(
nextOID
,
pszUsageIdentifier
);
newUsage
->
cUsageIdentifier
=
i
+
1
;
ret
=
CertSetEnhancedKeyUsage
(
pCertContext
,
newUsage
);
CryptMemFree
(
newUsage
);
else
ret
=
FALSE
;
}
}
CryptMemFree
(
usage
);
...
...
dlls/crypt32/tests/cert.c
View file @
b04c4aa6
...
...
@@ -2053,7 +2053,9 @@ static void testKeyUsage(void)
if
(
pUsage
->
cUsageIdentifier
)
ok
(
!
strcmp
(
pUsage
->
rgpszUsageIdentifier
[
0
],
oid
),
"Expected %s, got %s
\n
"
,
oid
,
pUsage
->
rgpszUsageIdentifier
[
0
]);
/* Yep, I can re-add the same usage identifier */
/* Re-adding the same usage identifier succeeds, though it only adds
* a duplicate usage identifier on versions prior to Vista
*/
ret
=
CertAddEnhancedKeyUsageIdentifier
(
context
,
oid
);
ok
(
ret
,
"CertAddEnhancedKeyUsageIdentifier failed: %08x
\n
"
,
GetLastError
());
...
...
@@ -2061,8 +2063,8 @@ static void testKeyUsage(void)
ret
=
CertGetEnhancedKeyUsage
(
context
,
0
,
pUsage
,
&
size
);
ok
(
ret
&&
GetLastError
()
==
0
,
"CertGetEnhancedKeyUsage failed: %08x
\n
"
,
GetLastError
());
ok
(
pUsage
->
cUsageIdentifier
==
2
,
"Expected 2 identifiers, got %d
\n
"
,
pUsage
->
cUsageIdentifier
);
ok
(
pUsage
->
cUsageIdentifier
==
1
||
pUsage
->
cUsageIdentifier
==
2
,
"Expected 1 or 2 identifiers, got %d
\n
"
,
pUsage
->
cUsageIdentifier
);
if
(
pUsage
->
cUsageIdentifier
)
ok
(
!
strcmp
(
pUsage
->
rgpszUsageIdentifier
[
0
],
oid
),
"Expected %s, got %s
\n
"
,
oid
,
pUsage
->
rgpszUsageIdentifier
[
0
]);
...
...
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