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
807b11b3
Commit
807b11b3
authored
Sep 12, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Sep 12, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
When decoding a signed cert, make sure it's really a cert.
parent
e4b2a0bb
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
1 deletion
+27
-1
cert.c
dlls/crypt32/cert.c
+14
-1
cert.c
dlls/crypt32/tests/cert.c
+13
-0
No files found.
dlls/crypt32/cert.c
View file @
807b11b3
...
...
@@ -1786,6 +1786,7 @@ static PWINE_CERT_CONTEXT CRYPT_CreateCertificateContext(
{
PWINE_CERT_CONTEXT
cert
=
NULL
;
BOOL
ret
;
PCERT_SIGNED_CONTENT_INFO
signedCert
=
NULL
;
PCERT_INFO
certInfo
=
NULL
;
DWORD
size
=
0
;
...
...
@@ -1795,13 +1796,25 @@ static PWINE_CERT_CONTEXT CRYPT_CreateCertificateContext(
/* First try to decode it as a signed cert. */
ret
=
CryptDecodeObjectEx
(
X509_ASN_ENCODING
,
X509_CERT
,
pbCertEncoded
,
cbCertEncoded
,
CRYPT_DECODE_ALLOC_FLAG
|
CRYPT_DECODE_NOCOPY_FLAG
,
NULL
,
(
BYTE
*
)
&
certInfo
,
&
size
);
(
BYTE
*
)
&
signedCert
,
&
size
);
if
(
ret
)
{
size
=
0
;
ret
=
CryptDecodeObjectEx
(
X509_ASN_ENCODING
,
X509_CERT_TO_BE_SIGNED
,
signedCert
->
ToBeSigned
.
pbData
,
signedCert
->
ToBeSigned
.
cbData
,
CRYPT_DECODE_ALLOC_FLAG
|
CRYPT_DECODE_NOCOPY_FLAG
,
NULL
,
(
BYTE
*
)
&
certInfo
,
&
size
);
LocalFree
(
signedCert
);
}
/* Failing that, try it as an unsigned cert */
if
(
!
ret
)
{
size
=
0
;
ret
=
CryptDecodeObjectEx
(
X509_ASN_ENCODING
,
X509_CERT_TO_BE_SIGNED
,
pbCertEncoded
,
cbCertEncoded
,
CRYPT_DECODE_ALLOC_FLAG
|
CRYPT_DECODE_NOCOPY_FLAG
,
NULL
,
(
BYTE
*
)
&
certInfo
,
&
size
);
}
if
(
ret
)
{
BYTE
*
data
=
NULL
;
...
...
dlls/crypt32/tests/cert.c
View file @
807b11b3
...
...
@@ -110,6 +110,12 @@ static const BYTE serializedCert[] = { 0x20, 0x00, 0x00, 0x00,
0x00
,
0x03
,
0x01
,
0x00
,
0xa3
,
0x16
,
0x30
,
0x14
,
0x30
,
0x12
,
0x06
,
0x03
,
0x55
,
0x1d
,
0x13
,
0x01
,
0x01
,
0xff
,
0x04
,
0x08
,
0x30
,
0x06
,
0x01
,
0x01
,
0xff
,
0x02
,
0x01
,
0x01
};
static
const
BYTE
signedCRL
[]
=
{
0x30
,
0x45
,
0x30
,
0x2c
,
0x30
,
0x02
,
0x06
,
0x00
,
0x30
,
0x15
,
0x31
,
0x13
,
0x30
,
0x11
,
0x06
,
0x03
,
0x55
,
0x04
,
0x03
,
0x13
,
0x0a
,
0x4a
,
0x75
,
0x61
,
0x6e
,
0x20
,
0x4c
,
0x61
,
0x6e
,
0x67
,
0x00
,
0x18
,
0x0f
,
0x31
,
0x36
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x31
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x30
,
0x5a
,
0x30
,
0x02
,
0x06
,
0x00
,
0x03
,
0x11
,
0x00
,
0x0f
,
0x0e
,
0x0d
,
0x0c
,
0x0b
,
0x0a
,
0x09
,
0x08
,
0x07
,
0x06
,
0x05
,
0x04
,
0x03
,
0x02
,
0x01
,
0x00
};
static
void
testMemStore
(
void
)
{
...
...
@@ -167,6 +173,13 @@ static void testMemStore(void)
ok
(
ret
,
"CertDeleteCertificateFromStore failed: %08lx
\n
"
,
GetLastError
());
}
/* try adding a "signed" CRL as a cert */
ret
=
CertAddEncodedCertificateToStore
(
store1
,
X509_ASN_ENCODING
,
signedCRL
,
sizeof
(
signedCRL
),
CERT_STORE_ADD_ALWAYS
,
&
context
);
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
||
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
),
"Expected CRYPT_E_ASN1_BADTAG or CRYPT_E_ASN1_CORRUPT, got %08lx
\n
"
,
GetLastError
());
/* add a cert to store1 */
ret
=
CertAddEncodedCertificateToStore
(
store1
,
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
)
-
1
,
CERT_STORE_ADD_ALWAYS
,
&
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