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
1d8d0dd0
Commit
1d8d0dd0
authored
Nov 08, 2005
by
Saulius Krasuckas
Committed by
Alexandre Julliard
Nov 08, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Crypt32 tests loadable on Win98.
parent
75506229
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
10 deletions
+33
-10
cert.c
dlls/crypt32/tests/cert.c
+33
-10
No files found.
dlls/crypt32/tests/cert.c
View file @
1d8d0dd0
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
*/
#include <assert.h>
#include <stdio.h>
#include <stdio.h>
#include <stdarg.h>
#include <stdarg.h>
#include <windef.h>
#include <windef.h>
...
@@ -40,6 +41,26 @@ struct CertPropIDHeader
...
@@ -40,6 +41,26 @@ struct CertPropIDHeader
DWORD
cb
;
DWORD
cb
;
};
};
static
BOOL
(
WINAPI
*
pCryptVerifyCertificateSignatureEx
)
(
HCRYPTPROV
,
DWORD
,
DWORD
,
void
*
,
DWORD
,
void
*
,
DWORD
,
void
*
);
#define CRYPT_GET_PROC(func) \
p ## func = (void *)GetProcAddress(hCrypt32, #func); \
if(!p ## func) \
trace("GetProcAddress(hCrypt32, \"%s\") failed\n", #func); \
static
void
init_function_pointers
(
void
)
{
HMODULE
hCrypt32
;
pCryptVerifyCertificateSignatureEx
=
NULL
;
hCrypt32
=
GetModuleHandleA
(
"crypt32.dll"
);
assert
(
hCrypt32
);
CRYPT_GET_PROC
(
CryptVerifyCertificateSignatureEx
);
}
static
void
testCryptHashCert
(
void
)
static
void
testCryptHashCert
(
void
)
{
{
static
const
BYTE
emptyHash
[]
=
{
0xda
,
0x39
,
0xa3
,
0xee
,
0x5e
,
0x6b
,
0x4b
,
static
const
BYTE
emptyHash
[]
=
{
0xda
,
0x39
,
0xa3
,
0xee
,
0x5e
,
0x6b
,
0x4b
,
...
@@ -1448,21 +1469,21 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
...
@@ -1448,21 +1469,21 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
DWORD
size
=
0
;
DWORD
size
=
0
;
BOOL
ret
;
BOOL
ret
;
ret
=
CryptVerifyCertificateSignatureEx
(
0
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ret
=
p
CryptVerifyCertificateSignatureEx
(
0
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
GetLastError
());
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
0
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
GetLastError
());
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
0
,
NULL
,
0
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
0
,
NULL
,
0
,
NULL
,
0
,
NULL
);
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
GetLastError
());
/* This crashes
/* This crashes
ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
ret =
p
CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, NULL, 0, NULL, 0, NULL);
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, NULL, 0, NULL, 0, NULL);
*/
*/
info
.
ToBeSigned
.
cbData
=
toBeSigned
->
cbData
;
info
.
ToBeSigned
.
cbData
=
toBeSigned
->
cbData
;
...
@@ -1480,25 +1501,25 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
...
@@ -1480,25 +1501,25 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
CRYPT_DATA_BLOB
certBlob
=
{
0
,
NULL
};
CRYPT_DATA_BLOB
certBlob
=
{
0
,
NULL
};
PCERT_PUBLIC_KEY_INFO
pubKeyInfo
=
NULL
;
PCERT_PUBLIC_KEY_INFO
pubKeyInfo
=
NULL
;
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
ok
(
!
ret
&&
GetLastError
()
==
CRYPT_E_ASN1_EOD
,
"Expected CRYPT_E_ASN1_EOD, got %08lx
\n
"
,
GetLastError
());
"Expected CRYPT_E_ASN1_EOD, got %08lx
\n
"
,
GetLastError
());
certBlob
.
cbData
=
1
;
certBlob
.
cbData
=
1
;
certBlob
.
pbData
=
(
void
*
)
0xdeadbeef
;
certBlob
.
pbData
=
(
void
*
)
0xdeadbeef
;
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
STATUS_ACCESS_VIOLATION
,
ok
(
!
ret
&&
GetLastError
()
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08lx
\n
"
,
GetLastError
());
"Expected STATUS_ACCESS_VIOLATION, got %08lx
\n
"
,
GetLastError
());
certBlob
.
cbData
=
size
;
certBlob
.
cbData
=
size
;
certBlob
.
pbData
=
cert
;
certBlob
.
pbData
=
cert
;
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
0
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ok
(
!
ret
&&
GetLastError
()
==
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
HRESULT_FROM_WIN32
(
ERROR_INVALID_PARAMETER
),
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
GetLastError
());
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL
,
NULL
,
0
,
NULL
);
CRYPT_VERIFY_CERT_SIGN_ISSUER_NULL
,
NULL
,
0
,
NULL
);
ok
(
!
ret
&&
GetLastError
()
==
ok
(
!
ret
&&
GetLastError
()
==
...
@@ -1506,7 +1527,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
...
@@ -1506,7 +1527,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
"Expected HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER), got %08lx
\n
"
,
GetLastError
());
GetLastError
());
/* This crashes
/* This crashes
ret = CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
ret =
p
CryptVerifyCertificateSignatureEx(csp, X509_ASN_ENCODING,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB, &certBlob,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, NULL, 0, NULL);
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY, NULL, 0, NULL);
*/
*/
...
@@ -1520,7 +1541,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
...
@@ -1520,7 +1541,7 @@ static void testVerifyCertSig(HCRYPTPROV csp, const CRYPT_DATA_BLOB *toBeSigned,
ok
(
ret
,
"CryptExportKey failed: %08lx
\n
"
,
GetLastError
());
ok
(
ret
,
"CryptExportKey failed: %08lx
\n
"
,
GetLastError
());
if
(
ret
)
if
(
ret
)
{
{
ret
=
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
ret
=
p
CryptVerifyCertificateSignatureEx
(
csp
,
X509_ASN_ENCODING
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
CRYPT_VERIFY_CERT_SIGN_SUBJECT_BLOB
,
&
certBlob
,
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY
,
pubKeyInfo
,
0
,
NULL
);
CRYPT_VERIFY_CERT_SIGN_ISSUER_PUBKEY
,
pubKeyInfo
,
0
,
NULL
);
ok
(
ret
,
"CryptVerifyCertificateSignatureEx failed: %08lx
\n
"
,
ok
(
ret
,
"CryptVerifyCertificateSignatureEx failed: %08lx
\n
"
,
...
@@ -1559,6 +1580,8 @@ static void testCertSigs(void)
...
@@ -1559,6 +1580,8 @@ static void testCertSigs(void)
START_TEST
(
cert
)
START_TEST
(
cert
)
{
{
init_function_pointers
();
testCryptHashCert
();
testCryptHashCert
();
/* various combinations of CertOpenStore */
/* various combinations of CertOpenStore */
...
...
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