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
a5082b25
Commit
a5082b25
authored
Sep 03, 2005
by
Juan Lang
Committed by
Alexandre Julliard
Sep 03, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Correct a bunch of lurking asn.1 decode bugs.
parent
932ecb24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
11 deletions
+9
-11
encode.c
dlls/crypt32/encode.c
+0
-0
encode.c
dlls/crypt32/tests/encode.c
+9
-11
No files found.
dlls/crypt32/encode.c
View file @
a5082b25
This diff is collapsed.
Click to expand it.
dlls/crypt32/tests/encode.c
View file @
a5082b25
...
...
@@ -840,6 +840,8 @@ static const WCHAR url[] = { 'h','t','t','p',':','/','/','w','i','n','e',
static
const
BYTE
encodedURL
[]
=
{
0x30
,
0x13
,
0x86
,
0x11
,
0x68
,
0x74
,
0x74
,
0x70
,
0x3a
,
0x2f
,
0x2f
,
0x77
,
0x69
,
0x6e
,
0x65
,
0x68
,
0x71
,
0x2e
,
0x6f
,
0x72
,
0x67
};
static
const
WCHAR
nihongoURL
[]
=
{
'h'
,
't'
,
't'
,
'p'
,
':'
,
'/'
,
'/'
,
0x226f
,
0x575b
,
0
};
static
const
WCHAR
dnsName
[]
=
{
'w'
,
'i'
,
'n'
,
'e'
,
'h'
,
'q'
,
'.'
,
'o'
,
'r'
,
'g'
,
0
};
static
const
BYTE
encodedDnsName
[]
=
{
0x30
,
0x0c
,
0x82
,
0x0a
,
0x77
,
0x69
,
0x6e
,
0x65
,
0x68
,
0x71
,
0x2e
,
0x6f
,
0x72
,
0x67
};
...
...
@@ -849,7 +851,6 @@ static const BYTE encodedIPAddr[] = { 0x30, 0x06, 0x87, 0x04, 0x7f, 0x00, 0x00,
static
void
test_encodeAltName
(
DWORD
dwEncoding
)
{
static
const
WCHAR
nihongo
[]
=
{
0x226f
,
0x575b
,
0
};
CERT_ALT_NAME_INFO
info
=
{
0
};
CERT_ALT_NAME_ENTRY
entry
=
{
0
};
BYTE
*
buf
=
NULL
;
...
...
@@ -897,11 +898,15 @@ static void test_encodeAltName(DWORD dwEncoding)
LocalFree
(
buf
);
}
/* Now with the URL containing an invalid IA5 char */
U
(
entry
).
pwszURL
=
(
LPWSTR
)
nihongo
;
U
(
entry
).
pwszURL
=
(
LPWSTR
)
nihongo
URL
;
ret
=
CryptEncodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
&
info
,
CRYPT_ENCODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_INVALID_IA5_STRING
,
"Expected CRYPT_E_INVALID_IA5_STRING, got %08lx
\n
"
,
GetLastError
());
/* The first invalid character is at index 7 */
ok
(
GET_CERT_ALT_NAME_VALUE_ERR_INDEX
(
size
)
==
7
,
"Expected invalid char at index 7, got %ld
\n
"
,
GET_CERT_ALT_NAME_VALUE_ERR_INDEX
(
size
));
/* Now with the URL missing a scheme */
U
(
entry
).
pwszURL
=
(
LPWSTR
)
dnsName
;
ret
=
CryptEncodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
&
info
,
...
...
@@ -1960,16 +1965,13 @@ static void test_decodeCertToBeSigned(DWORD dwEncoding)
/* The following certs all fail with CRYPT_E_ASN1_CORRUPT, because at a
* minimum a cert must have a non-zero serial number, an issuer, and a
* subject.
* It's hard to match the errors precisely sometimes, so accept one
* that only wine gives as long as it fails
*/
for
(
i
=
0
;
i
<
sizeof
(
corruptCerts
)
/
sizeof
(
corruptCerts
[
0
]);
i
++
)
{
ret
=
CryptDecodeObjectEx
(
dwEncoding
,
X509_CERT_TO_BE_SIGNED
,
corruptCerts
[
i
],
corruptCerts
[
i
][
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
size
);
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
),
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
),
"Expected CRYPT_E_ASN1_CORRUPT, got %08lx
\n
"
,
GetLastError
());
}
/* Now check with serial number, subject and issuer specified */
...
...
@@ -2205,11 +2207,7 @@ static void test_decodeCRLToBeSigned(DWORD dwEncoding)
ret
=
CryptDecodeObjectEx
(
dwEncoding
,
X509_CERT_CRL_TO_BE_SIGNED
,
corruptCRLs
[
i
],
corruptCRLs
[
i
][
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
size
);
/* It's hard to match the errors precisely sometimes, so accept one
* that only wine gives as long as it fails
*/
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
),
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
),
"Expected CRYPT_E_ASN1_CORRUPT, got %08lx
\n
"
,
GetLastError
());
}
/* at a minimum, a CRL must contain an issuer: */
...
...
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