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
c2921eda
Commit
c2921eda
authored
Oct 09, 2008
by
Juan Lang
Committed by
Alexandre Julliard
Oct 10, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
crypt32: Fix some test failures on Win9x.
parent
a8c44d9a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
17 deletions
+33
-17
encode.c
dlls/crypt32/tests/encode.c
+33
-17
No files found.
dlls/crypt32/tests/encode.c
View file @
c2921eda
...
@@ -225,18 +225,22 @@ static void test_decodeInt(DWORD dwEncoding)
...
@@ -225,18 +225,22 @@ static void test_decodeInt(DWORD dwEncoding)
/* check with NULL integer buffer */
/* check with NULL integer buffer */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
NULL
,
0
,
0
,
NULL
,
NULL
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
NULL
,
0
,
0
,
NULL
,
NULL
,
&
bufSize
);
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_EOD
||
"Expected CRYPT_E_ASN1_EOD, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_BAD_ARG
/* Win9x */
),
"Expected CRYPT_E_ASN1_EOD or OSS_BAD_ARG, got %08x
\n
"
,
GetLastError
());
/* check with a valid, but too large, integer */
/* check with a valid, but too large, integer */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
bigInt
,
bigInt
[
1
]
+
2
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
bigInt
,
bigInt
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_LARGE
,
ok
((
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_LARGE
)
||
broken
(
ret
)
/* Win9x */
,
"Expected CRYPT_E_ASN1_LARGE, got %d
\n
"
,
GetLastError
());
"Expected CRYPT_E_ASN1_LARGE, got %d
\n
"
,
GetLastError
());
/* check with a DER-encoded string */
/* check with a DER-encoded string */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
testStr
,
testStr
[
1
]
+
2
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_INTEGER
,
testStr
,
testStr
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
||
"Expected CRYPT_E_ASN1_BADTAG, got %d
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_PDU_MISMATCH
/* Win9x */
),
"Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x
\n
"
,
GetLastError
());
for
(
i
=
0
;
i
<
sizeof
(
ints
)
/
sizeof
(
ints
[
0
]);
i
++
)
for
(
i
=
0
;
i
<
sizeof
(
ints
)
/
sizeof
(
ints
[
0
]);
i
++
)
{
{
/* When the output buffer is NULL, this always succeeds */
/* When the output buffer is NULL, this always succeeds */
...
@@ -525,8 +529,10 @@ static void testTimeDecoding(DWORD dwEncoding, LPCSTR structType,
...
@@ -525,8 +529,10 @@ static void testTimeDecoding(DWORD dwEncoding, LPCSTR structType,
compareTime
(
&
time
->
sysTime
,
&
ft
);
compareTime
(
&
time
->
sysTime
,
&
ft
);
}
}
else
else
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
||
"Expected CRYPT_E_ASN1_BADTAG, got 0x%08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_PDU_MISMATCH
/* Win9x */
),
"Expected CRYPT_E_ASN1_BADTAG or OSS_PDU_MISMATCH, got %08x
\n
"
,
GetLastError
());
}
}
static
const
BYTE
bin20
[]
=
{
static
const
BYTE
bin20
[]
=
{
...
@@ -645,8 +651,10 @@ static void test_decodeFiletime(DWORD dwEncoding)
...
@@ -645,8 +651,10 @@ static void test_decodeFiletime(DWORD dwEncoding)
size
=
sizeof
(
ft1
);
size
=
sizeof
(
ft1
);
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_CHOICE_OF_TIME
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_CHOICE_OF_TIME
,
bogusTimes
[
i
],
bogusTimes
[
i
][
1
]
+
2
,
0
,
NULL
,
&
ft1
,
&
size
);
bogusTimes
[
i
],
bogusTimes
[
i
][
1
]
+
2
,
0
,
NULL
,
&
ft1
,
&
size
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
"Expected CRYPT_E_ASN1_CORRUPT, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_DATA_ERROR
/* Win9x */
),
"Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x
\n
"
,
GetLastError
());
}
}
}
}
...
@@ -1487,13 +1495,17 @@ static void test_decodeAltName(DWORD dwEncoding)
...
@@ -1487,13 +1495,17 @@ static void test_decodeAltName(DWORD dwEncoding)
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
unimplementedType
,
sizeof
(
unimplementedType
),
CRYPT_DECODE_ALLOC_FLAG
,
unimplementedType
,
sizeof
(
unimplementedType
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_BADTAG
||
"Expected CRYPT_E_ASN1_BADTAG, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_DATA_ERROR
/* Win9x */
),
"Expected CRYPT_E_ASN1_BADTAG or OSS_DATA_ERROR, got %08x
\n
"
,
GetLastError
());
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
bogusType
,
sizeof
(
bogusType
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
bogusType
,
sizeof
(
bogusType
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
"Expected CRYPT_E_ASN1_CORRUPT, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_DATA_ERROR
/* Win9x */
),
"Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x
\n
"
,
GetLastError
());
/* Now expected cases */
/* Now expected cases */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
emptySequence
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_ALTERNATE_NAME
,
emptySequence
,
emptySequence
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
emptySequence
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
...
@@ -2147,8 +2159,10 @@ static void test_decodeBasicConstraints(DWORD dwEncoding)
...
@@ -2147,8 +2159,10 @@ static void test_decodeBasicConstraints(DWORD dwEncoding)
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
inverted
,
inverted
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
inverted
,
inverted
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
"Expected CRYPT_E_ASN1_CORRUPT, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_DATA_ERROR
/* Win9x */
),
"Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x
\n
"
,
GetLastError
());
ok
(
!
buf
,
"Expected buf to be set to NULL
\n
"
);
ok
(
!
buf
,
"Expected buf to be set to NULL
\n
"
);
/* Check with a non-DER bool */
/* Check with a non-DER bool */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
...
@@ -2167,8 +2181,10 @@ static void test_decodeBasicConstraints(DWORD dwEncoding)
...
@@ -2167,8 +2181,10 @@ static void test_decodeBasicConstraints(DWORD dwEncoding)
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS2
,
(
LPBYTE
)
encodedCommonName
,
encodedCommonName
[
1
]
+
2
,
(
LPBYTE
)
encodedCommonName
,
encodedCommonName
[
1
]
+
2
,
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
(
BYTE
*
)
&
buf
,
&
bufSize
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
,
ok
(
!
ret
&&
(
GetLastError
()
==
CRYPT_E_ASN1_CORRUPT
||
"Expected CRYPT_E_ASN1_CORRUPT, got %08x
\n
"
,
GetLastError
());
GetLastError
()
==
OSS_DATA_ERROR
/* Win9x */
),
"Expected CRYPT_E_ASN1_CORRUPT or OSS_DATA_ERROR, got %08x
\n
"
,
GetLastError
());
/* Now check with the more complex CERT_BASIC_CONSTRAINTS_INFO */
/* Now check with the more complex CERT_BASIC_CONSTRAINTS_INFO */
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS
,
ret
=
pCryptDecodeObjectEx
(
dwEncoding
,
X509_BASIC_CONSTRAINTS
,
emptyConstraint
,
sizeof
(
emptyConstraint
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
emptyConstraint
,
sizeof
(
emptyConstraint
),
CRYPT_DECODE_ALLOC_FLAG
,
NULL
,
...
...
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