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
d34dc5fa
Commit
d34dc5fa
authored
Oct 26, 2018
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Oct 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32/tests: Add more tests for CertComparePublicKeyInfo.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
81b0a38c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
60 additions
and
3 deletions
+60
-3
cert.c
dlls/crypt32/tests/cert.c
+60
-3
No files found.
dlls/crypt32/tests/cert.c
View file @
d34dc5fa
...
...
@@ -3196,9 +3196,12 @@ static void testComparePublicKeyInfo(void)
static
BYTE
bits1
[]
=
{
1
,
0
};
static
BYTE
bits2
[]
=
{
0
};
static
BYTE
bits3
[]
=
{
1
};
static
BYTE
bits4
[]
=
{
0x30
,
8
,
2
,
1
,
0x81
,
2
,
3
,
1
,
0
,
1
};
static
BYTE
bits5
[]
=
{
0x30
,
9
,
2
,
2
,
0
,
0x81
,
2
,
3
,
1
,
0
,
1
};
static
BYTE
bits6
[]
=
{
0x30
,
9
,
2
,
2
,
0
,
0x82
,
2
,
3
,
1
,
0
,
1
};
static
BYTE
bits4
[]
=
{
0x30
,
8
,
2
,
1
,
0x81
,
2
,
3
,
1
,
0
,
1
};
/* ASN_SEQUENCE */
static
BYTE
bits5
[]
=
{
0x30
,
9
,
2
,
2
,
0
,
0x81
,
2
,
3
,
1
,
0
,
1
};
/* ASN_SEQUENCE */
static
BYTE
bits6
[]
=
{
0x30
,
9
,
2
,
2
,
0
,
0x82
,
2
,
3
,
1
,
0
,
1
};
/* ASN_SEQUENCE */
static
BYTE
bits7
[]
=
{
0x04
,
8
,
2
,
1
,
0x81
,
2
,
3
,
1
,
0
,
1
};
/* ASN_OCTETSTRING */
static
BYTE
bits8
[]
=
{
0x04
,
9
,
2
,
2
,
0
,
0x81
,
2
,
3
,
1
,
0
,
1
};
/* ASN_OCTETSTRING */
static
BYTE
bits9
[]
=
{
0x04
,
9
,
2
,
2
,
0
,
0x82
,
2
,
3
,
1
,
0
,
1
};
/* ASN_OCTETSTRING */
/* crashes
ret = CertComparePublicKeyInfo(0, NULL, NULL);
...
...
@@ -3206,14 +3209,26 @@ static void testComparePublicKeyInfo(void)
/* Empty public keys compare */
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
/* Different OIDs appear to compare */
info1
.
Algorithm
.
pszObjId
=
oid_rsa_rsa
;
info2
.
Algorithm
.
pszObjId
=
oid_rsa_sha1rsa
;
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
info2
.
Algorithm
.
pszObjId
=
oid_x957_dsa
;
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
info1
.
PublicKey
.
cbData
=
sizeof
(
bits1
);
info1
.
PublicKey
.
pbData
=
bits1
;
info1
.
PublicKey
.
cUnusedBits
=
0
;
...
...
@@ -3222,6 +3237,10 @@ static void testComparePublicKeyInfo(void)
info2
.
PublicKey
.
cUnusedBits
=
0
;
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo failed: %08x
\n
"
,
GetLastError
());
info2
.
Algorithm
.
pszObjId
=
oid_rsa_rsa
;
info1
.
PublicKey
.
cbData
=
sizeof
(
bits4
);
info1
.
PublicKey
.
pbData
=
bits4
;
...
...
@@ -3233,6 +3252,7 @@ static void testComparePublicKeyInfo(void)
ok
(
!
ret
,
"CertComparePublicKeyInfo: as raw binary: keys should be unequal
\n
"
);
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
ret
,
"CertComparePublicKeyInfo: as ASN.1 encoded: keys should be equal
\n
"
);
info1
.
PublicKey
.
cUnusedBits
=
1
;
info2
.
PublicKey
.
cUnusedBits
=
5
;
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
...
...
@@ -3252,11 +3272,38 @@ static void testComparePublicKeyInfo(void)
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
/* Simple (non-comparing) case */
ok
(
!
ret
,
"Expected keys not to compare
\n
"
);
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"Expected keys not to compare
\n
"
);
info2
.
PublicKey
.
cbData
=
sizeof
(
bits1
);
info2
.
PublicKey
.
pbData
=
bits1
;
info2
.
PublicKey
.
cUnusedBits
=
0
;
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"Expected keys not to compare
\n
"
);
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"Expected keys not to compare
\n
"
);
info1
.
PublicKey
.
cbData
=
sizeof
(
bits7
);
info1
.
PublicKey
.
pbData
=
bits7
;
info1
.
PublicKey
.
cUnusedBits
=
0
;
info2
.
PublicKey
.
cbData
=
sizeof
(
bits8
);
info2
.
PublicKey
.
pbData
=
bits8
;
info2
.
PublicKey
.
cUnusedBits
=
0
;
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"CertComparePublicKeyInfo: as raw binary: keys should be unequal
\n
"
);
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"CertComparePublicKeyInfo: as ASN.1 encoded: keys should be unequal
\n
"
);
ret
=
CertComparePublicKeyInfo
(
0
,
&
info1
,
&
info1
);
ok
(
ret
,
"CertComparePublicKeyInfo: as raw binary: keys should be equal
\n
"
);
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info1
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo: as ASN.1 encoded: keys should be equal
\n
"
);
info1
.
PublicKey
.
cbData
--
;
/* kill one byte, make ASN.1 encoded data invalid */
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info1
);
todo_wine
ok
(
ret
,
"CertComparePublicKeyInfo: as ASN.1 encoded: keys should be equal
\n
"
);
/* ASN.1 encoded non-comparing case */
info1
.
PublicKey
.
cbData
=
sizeof
(
bits5
);
info1
.
PublicKey
.
pbData
=
bits5
;
...
...
@@ -3266,6 +3313,16 @@ static void testComparePublicKeyInfo(void)
info2
.
PublicKey
.
cUnusedBits
=
0
;
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"CertComparePublicKeyInfo: different keys should be unequal
\n
"
);
/* ASN.1 encoded non-comparing case */
info1
.
PublicKey
.
cbData
=
sizeof
(
bits8
);
info1
.
PublicKey
.
pbData
=
bits8
;
info1
.
PublicKey
.
cUnusedBits
=
0
;
info2
.
PublicKey
.
cbData
=
sizeof
(
bits9
);
info2
.
PublicKey
.
pbData
=
bits9
;
info2
.
PublicKey
.
cUnusedBits
=
0
;
ret
=
CertComparePublicKeyInfo
(
X509_ASN_ENCODING
,
&
info1
,
&
info2
);
ok
(
!
ret
,
"CertComparePublicKeyInfo: different keys should be unequal
\n
"
);
}
static
void
testHashPublicKeyInfo
(
void
)
...
...
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