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
76507e0e
Commit
76507e0e
authored
Jun 14, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 14, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
secur32/tests: Don't load crypt32.dll function dynamically.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6e186062
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
42 deletions
+21
-42
Makefile.in
dlls/secur32/tests/Makefile.in
+1
-1
schannel.c
dlls/secur32/tests/schannel.c
+20
-41
No files found.
dlls/secur32/tests/Makefile.in
View file @
76507e0e
TESTDLL
=
secur32.dll
IMPORTS
=
advapi32 ws2_32
IMPORTS
=
crypt32
advapi32 ws2_32
C_SRCS
=
\
main.c
\
...
...
dlls/secur32/tests/schannel.c
View file @
76507e0e
...
...
@@ -29,7 +29,7 @@
#include "wine/test.h"
static
HMODULE
secdll
,
crypt32dll
;
static
HMODULE
secdll
;
static
ACQUIRE_CREDENTIALS_HANDLE_FN_A
pAcquireCredentialsHandleA
;
static
ENUMERATE_SECURITY_PACKAGES_FN_A
pEnumerateSecurityPackagesA
;
...
...
@@ -42,11 +42,6 @@ static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext;
static
DECRYPT_MESSAGE_FN
pDecryptMessage
;
static
ENCRYPT_MESSAGE_FN
pEncryptMessage
;
static
PCCERT_CONTEXT
(
WINAPI
*
pCertCreateCertificateContext
)(
DWORD
,
const
BYTE
*
,
DWORD
);
static
BOOL
(
WINAPI
*
pCertFreeCertificateContext
)(
PCCERT_CONTEXT
);
static
BOOL
(
WINAPI
*
pCertSetCertificateContextProperty
)(
PCCERT_CONTEXT
,
DWORD
,
DWORD
,
const
void
*
);
static
PCCERT_CONTEXT
(
WINAPI
*
pCertEnumCertificatesInStore
)(
HCERTSTORE
,
PCCERT_CONTEXT
);
static
const
BYTE
bigCert
[]
=
{
0x30
,
0x7a
,
0x02
,
0x01
,
0x01
,
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
,
0x30
,
0x22
,
...
...
@@ -114,7 +109,6 @@ static CHAR unisp_name_a[] = UNISP_NAME_A;
static
void
InitFunctionPtrs
(
void
)
{
crypt32dll
=
LoadLibraryA
(
"crypt32.dll"
);
secdll
=
LoadLibraryA
(
"secur32.dll"
);
if
(
!
secdll
)
secdll
=
LoadLibraryA
(
"security.dll"
);
...
...
@@ -135,11 +129,6 @@ static void InitFunctionPtrs(void)
GET_PROC
(
secdll
,
EncryptMessage
);
}
GET_PROC
(
crypt32dll
,
CertFreeCertificateContext
);
GET_PROC
(
crypt32dll
,
CertSetCertificateContextProperty
);
GET_PROC
(
crypt32dll
,
CertCreateCertificateContext
);
GET_PROC
(
crypt32dll
,
CertEnumCertificatesInStore
);
#undef GET_PROC
}
...
...
@@ -323,7 +312,7 @@ static void testAcquireSecurityContext(void)
HCRYPTKEY
key
;
CRYPT_KEY_PROV_INFO
keyProvInfo
;
if
(
!
pAcquireCredentialsHandleA
||
!
pCertCreateCertificateContext
||
if
(
!
pAcquireCredentialsHandleA
||
!
pEnumerateSecurityPackagesA
||
!
pFreeContextBuffer
||
!
pFreeCredentialsHandle
)
{
...
...
@@ -359,10 +348,8 @@ static void testAcquireSecurityContext(void)
keyProvInfo
.
rgProvParam
=
NULL
;
keyProvInfo
.
dwKeySpec
=
AT_SIGNATURE
;
certs
[
0
]
=
pCertCreateCertificateContext
(
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
));
certs
[
1
]
=
pCertCreateCertificateContext
(
X509_ASN_ENCODING
,
selfSignedCert
,
sizeof
(
selfSignedCert
));
certs
[
0
]
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
bigCert
,
sizeof
(
bigCert
));
certs
[
1
]
=
CertCreateCertificateContext
(
X509_ASN_ENCODING
,
selfSignedCert
,
sizeof
(
selfSignedCert
));
SetLastError
(
0xdeadbeef
);
ret
=
CryptAcquireContextW
(
&
csp
,
cspNameW
,
MS_DEF_PROV_W
,
PROV_RSA_FULL
,
...
...
@@ -484,21 +471,18 @@ static void testAcquireSecurityContext(void)
"or SEC_E_INTERNAL_ERROR, got %08x
\n
"
,
st
);
/* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */
if
(
pCertSetCertificateContextProperty
)
{
ret
=
pCertSetCertificateContextProperty
(
certs
[
1
],
CERT_KEY_PROV_INFO_PROP_ID
,
0
,
&
keyProvInfo
);
schanCred
.
dwVersion
=
SCH_CRED_V3
;
ok
(
ret
,
"CertSetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
st
=
pAcquireCredentialsHandleA
(
NULL
,
unisp_name_a
,
SECPKG_CRED_OUTBOUND
,
NULL
,
&
schanCred
,
NULL
,
NULL
,
&
cred
,
NULL
);
ok
(
st
==
SEC_E_UNKNOWN_CREDENTIALS
||
st
==
SEC_E_INTERNAL_ERROR
/* WinNT */
,
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x
\n
"
,
st
);
st
=
pAcquireCredentialsHandleA
(
NULL
,
unisp_name_a
,
SECPKG_CRED_INBOUND
,
NULL
,
&
schanCred
,
NULL
,
NULL
,
&
cred
,
NULL
);
ok
(
st
==
SEC_E_UNKNOWN_CREDENTIALS
||
st
==
SEC_E_INTERNAL_ERROR
/* WinNT */
,
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x
\n
"
,
st
);
}
ret
=
CertSetCertificateContextProperty
(
certs
[
1
],
CERT_KEY_PROV_INFO_PROP_ID
,
0
,
&
keyProvInfo
);
schanCred
.
dwVersion
=
SCH_CRED_V3
;
ok
(
ret
,
"CertSetCertificateContextProperty failed: %08x
\n
"
,
GetLastError
());
st
=
pAcquireCredentialsHandleA
(
NULL
,
unisp_name_a
,
SECPKG_CRED_OUTBOUND
,
NULL
,
&
schanCred
,
NULL
,
NULL
,
&
cred
,
NULL
);
ok
(
st
==
SEC_E_UNKNOWN_CREDENTIALS
||
st
==
SEC_E_INTERNAL_ERROR
/* WinNT */
,
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x
\n
"
,
st
);
st
=
pAcquireCredentialsHandleA
(
NULL
,
unisp_name_a
,
SECPKG_CRED_INBOUND
,
NULL
,
&
schanCred
,
NULL
,
NULL
,
&
cred
,
NULL
);
ok
(
st
==
SEC_E_UNKNOWN_CREDENTIALS
||
st
==
SEC_E_INTERNAL_ERROR
/* WinNT */
,
"Expected SEC_E_UNKNOWN_CREDENTIALS or SEC_E_INTERNAL_ERROR, got %08x
\n
"
,
st
);
ret
=
CryptAcquireContextW
(
&
csp
,
cspNameW
,
MS_DEF_PROV_W
,
PROV_RSA_FULL
,
CRYPT_NEWKEYSET
);
...
...
@@ -601,11 +585,8 @@ static void testAcquireSecurityContext(void)
CryptReleaseContext
(
csp
,
0
);
CryptAcquireContextW
(
&
csp
,
cspNameW
,
MS_DEF_PROV_W
,
PROV_RSA_FULL
,
CRYPT_DELETEKEYSET
);
if
(
pCertFreeCertificateContext
)
{
pCertFreeCertificateContext
(
certs
[
0
]);
pCertFreeCertificateContext
(
certs
[
1
]);
}
CertFreeCertificateContext
(
certs
[
0
]);
CertFreeCertificateContext
(
certs
[
1
]);
}
static
void
test_remote_cert
(
PCCERT_CONTEXT
remote_cert
)
...
...
@@ -616,7 +597,7 @@ static void test_remote_cert(PCCERT_CONTEXT remote_cert)
ok
(
remote_cert
->
hCertStore
!=
NULL
,
"hCertStore == NULL
\n
"
);
while
((
iter
=
p
CertEnumCertificatesInStore
(
remote_cert
->
hCertStore
,
iter
)))
{
while
((
iter
=
CertEnumCertificatesInStore
(
remote_cert
->
hCertStore
,
iter
)))
{
if
(
iter
==
remote_cert
)
incl_remote
=
TRUE
;
cert_cnt
++
;
...
...
@@ -903,7 +884,7 @@ todo_wine
ok
(
status
==
SEC_E_OK
,
"QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) failed: %08x
\n
"
,
status
);
if
(
status
==
SEC_E_OK
)
{
test_remote_cert
(
cert
);
p
CertFreeCertificateContext
(
cert
);
CertFreeCertificateContext
(
cert
);
}
status
=
pQueryContextAttributesA
(
&
context
,
SECPKG_ATTR_CONNECTION_INFO
,
(
void
*
)
&
conn_info
);
...
...
@@ -1008,6 +989,4 @@ START_TEST(schannel)
if
(
secdll
)
FreeLibrary
(
secdll
);
if
(
crypt32dll
)
FreeLibrary
(
crypt32dll
);
}
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