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
8f488a71
Commit
8f488a71
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: CertComparePublicKeyInfo should not try to decode a non-RSA public key.
Signed-off-by:
Dmitry Timoshkov
<
dmitry@baikal.ru
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d34dc5fa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
cert.c
dlls/crypt32/cert.c
+7
-0
cert.c
dlls/crypt32/tests/cert.c
+0
-6
No files found.
dlls/crypt32/cert.c
View file @
8f488a71
...
...
@@ -28,6 +28,7 @@
#include "winternl.h"
#define CRYPT_OID_INFO_HAS_EXTRA_FIELDS
#include "wincrypt.h"
#include "snmp.h"
#include "bcrypt.h"
#include "winnls.h"
#include "rpc.h"
...
...
@@ -1242,6 +1243,12 @@ BOOL WINAPI CertComparePublicKeyInfo(DWORD dwCertEncodingType,
TRACE
(
"(%08x, %p, %p)
\n
"
,
dwCertEncodingType
,
pPublicKey1
,
pPublicKey2
);
/* RSA public key data should start with ASN_SEQUENCE,
* otherwise it's not a RSA_CSP_PUBLICKEYBLOB.
*/
if
(
!
pPublicKey1
->
PublicKey
.
cbData
||
pPublicKey1
->
PublicKey
.
pbData
[
0
]
!=
ASN_SEQUENCE
)
dwCertEncodingType
=
0
;
switch
(
GET_CERT_ENCODING_TYPE
(
dwCertEncodingType
))
{
case
0
:
/* Seems to mean "raw binary bits" */
...
...
dlls/crypt32/tests/cert.c
View file @
8f488a71
...
...
@@ -3210,7 +3210,6 @@ static void testComparePublicKeyInfo(void)
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 */
...
...
@@ -3219,14 +3218,12 @@ todo_wine
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
);
...
...
@@ -3238,7 +3235,6 @@ todo_wine
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
;
...
...
@@ -3297,11 +3293,9 @@ todo_wine
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 */
...
...
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