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
160b9149
Commit
160b9149
authored
Sep 03, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Sep 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve CryptAlgIdToOID/CryptOIDToAlgId tests, and prevent a crash in
CryptOIDToAlgId.
parent
f7413fd6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
13 deletions
+29
-13
main.c
dlls/crypt32/main.c
+6
-3
main.c
dlls/crypt32/tests/main.c
+23
-10
No files found.
dlls/crypt32/main.c
View file @
160b9149
...
...
@@ -294,10 +294,13 @@ DWORD WINAPI CertOIDToAlgId(LPCSTR pszObjId)
{
int
i
;
for
(
i
=
0
;
i
<
sizeof
(
oidToAlgID
)
/
sizeof
(
oidToAlgID
[
0
]);
i
++
)
if
(
pszObjId
)
{
if
(
!
strcmp
(
pszObjId
,
oidToAlgID
[
i
].
oid
))
return
oidToAlgID
[
i
].
algID
;
for
(
i
=
0
;
i
<
sizeof
(
oidToAlgID
)
/
sizeof
(
oidToAlgID
[
0
]);
i
++
)
{
if
(
!
strcmp
(
pszObjId
,
oidToAlgID
[
i
].
oid
))
return
oidToAlgID
[
i
].
algID
;
}
}
return
0
;
}
dlls/crypt32/tests/main.c
View file @
160b9149
...
...
@@ -87,12 +87,21 @@ static const struct OIDToAlgID algIDToOID[] = {
static
void
testOIDToAlgID
(
void
)
{
int
i
;
DWORD
alg
;
/* Test with a bogus one */
SetLastError
(
0xdeadbeef
);
alg
=
CertOIDToAlgId
(
"1.2.3"
);
ok
(
!
alg
&&
GetLastError
()
==
0xdeadbeef
,
"Didn't expect last error (%08lx) to be set
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
sizeof
(
oidToAlgID
)
/
sizeof
(
oidToAlgID
[
0
]);
i
++
)
{
DWORD
alg
=
CertOIDToAlgId
(
oidToAlgID
[
i
].
oid
);
ok
(
alg
==
oidToAlgID
[
i
].
algID
,
alg
=
CertOIDToAlgId
(
oidToAlgID
[
i
].
oid
);
/* Not all Windows installations support all these, so make sure it's
* at least not the wrong one.
*/
ok
(
alg
==
0
||
alg
==
oidToAlgID
[
i
].
algID
,
"Expected %ld, got %ld
\n
"
,
oidToAlgID
[
i
].
algID
,
alg
);
}
}
...
...
@@ -100,16 +109,20 @@ static void testOIDToAlgID(void)
static
void
testAlgIDToOID
(
void
)
{
int
i
;
LPCSTR
oid
;
/* Test with a bogus one */
SetLastError
(
0xdeadbeef
);
oid
=
CertAlgIdToOID
(
ALG_CLASS_SIGNATURE
|
ALG_TYPE_ANY
|
80
);
ok
(
!
oid
&&
GetLastError
()
==
0xdeadbeef
,
"Didn't expect last error (%08lx) to be set
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
sizeof
(
algIDToOID
)
/
sizeof
(
algIDToOID
[
0
]);
i
++
)
{
LPCSTR
oid
=
CertAlgIdToOID
(
algIDToOID
[
i
].
algID
);
if
((
!
oid
||
!
algIDToOID
[
i
].
oid
)
&&
oid
!=
algIDToOID
[
i
].
oid
&&
algIDToOID
[
i
].
algID
)
printf
(
"Expected %s, got %s
\n
"
,
algIDToOID
[
i
].
oid
,
oid
);
else
if
(
oid
&&
algIDToOID
[
i
].
oid
&&
strcmp
(
oid
,
algIDToOID
[
i
].
oid
))
printf
(
"Expected %s, got %s
\n
"
,
algIDToOID
[
i
].
oid
,
oid
);
oid
=
CertAlgIdToOID
(
algIDToOID
[
i
].
algID
);
/* Allow failure, not every version of Windows supports every algo */
if
(
oid
)
ok
(
!
strcmp
(
oid
,
algIDToOID
[
i
].
oid
),
"Expected %s, got %s
\n
"
,
algIDToOID
[
i
].
oid
,
oid
);
}
}
...
...
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