Commit 76507e0e authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

secur32/tests: Don't load crypt32.dll function dynamically.

parent 6e186062
TESTDLL = secur32.dll TESTDLL = secur32.dll
IMPORTS = advapi32 ws2_32 IMPORTS = crypt32 advapi32 ws2_32
C_SRCS = \ C_SRCS = \
main.c \ main.c \
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "wine/test.h" #include "wine/test.h"
static HMODULE secdll, crypt32dll; static HMODULE secdll;
static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA; static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA;
static ENUMERATE_SECURITY_PACKAGES_FN_A pEnumerateSecurityPackagesA; static ENUMERATE_SECURITY_PACKAGES_FN_A pEnumerateSecurityPackagesA;
...@@ -42,11 +42,6 @@ static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext; ...@@ -42,11 +42,6 @@ static DELETE_SECURITY_CONTEXT_FN pDeleteSecurityContext;
static DECRYPT_MESSAGE_FN pDecryptMessage; static DECRYPT_MESSAGE_FN pDecryptMessage;
static ENCRYPT_MESSAGE_FN pEncryptMessage; 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, 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, 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, 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; ...@@ -114,7 +109,6 @@ static CHAR unisp_name_a[] = UNISP_NAME_A;
static void InitFunctionPtrs(void) static void InitFunctionPtrs(void)
{ {
crypt32dll = LoadLibraryA("crypt32.dll");
secdll = LoadLibraryA("secur32.dll"); secdll = LoadLibraryA("secur32.dll");
if(!secdll) if(!secdll)
secdll = LoadLibraryA("security.dll"); secdll = LoadLibraryA("security.dll");
...@@ -135,11 +129,6 @@ static void InitFunctionPtrs(void) ...@@ -135,11 +129,6 @@ static void InitFunctionPtrs(void)
GET_PROC(secdll, EncryptMessage); GET_PROC(secdll, EncryptMessage);
} }
GET_PROC(crypt32dll, CertFreeCertificateContext);
GET_PROC(crypt32dll, CertSetCertificateContextProperty);
GET_PROC(crypt32dll, CertCreateCertificateContext);
GET_PROC(crypt32dll, CertEnumCertificatesInStore);
#undef GET_PROC #undef GET_PROC
} }
...@@ -323,7 +312,7 @@ static void testAcquireSecurityContext(void) ...@@ -323,7 +312,7 @@ static void testAcquireSecurityContext(void)
HCRYPTKEY key; HCRYPTKEY key;
CRYPT_KEY_PROV_INFO keyProvInfo; CRYPT_KEY_PROV_INFO keyProvInfo;
if (!pAcquireCredentialsHandleA || !pCertCreateCertificateContext || if (!pAcquireCredentialsHandleA ||
!pEnumerateSecurityPackagesA || !pFreeContextBuffer || !pEnumerateSecurityPackagesA || !pFreeContextBuffer ||
!pFreeCredentialsHandle) !pFreeCredentialsHandle)
{ {
...@@ -359,10 +348,8 @@ static void testAcquireSecurityContext(void) ...@@ -359,10 +348,8 @@ static void testAcquireSecurityContext(void)
keyProvInfo.rgProvParam = NULL; keyProvInfo.rgProvParam = NULL;
keyProvInfo.dwKeySpec = AT_SIGNATURE; keyProvInfo.dwKeySpec = AT_SIGNATURE;
certs[0] = pCertCreateCertificateContext(X509_ASN_ENCODING, bigCert, certs[0] = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, sizeof(bigCert));
sizeof(bigCert)); certs[1] = CertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert, sizeof(selfSignedCert));
certs[1] = pCertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert,
sizeof(selfSignedCert));
SetLastError(0xdeadbeef); SetLastError(0xdeadbeef);
ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
...@@ -484,9 +471,7 @@ static void testAcquireSecurityContext(void) ...@@ -484,9 +471,7 @@ static void testAcquireSecurityContext(void)
"or SEC_E_INTERNAL_ERROR, got %08x\n", st); "or SEC_E_INTERNAL_ERROR, got %08x\n", st);
/* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */ /* Good cert, with CRYPT_KEY_PROV_INFO set before it's had a key loaded. */
if (pCertSetCertificateContextProperty) ret = CertSetCertificateContextProperty(certs[1],
{
ret = pCertSetCertificateContextProperty(certs[1],
CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo); CERT_KEY_PROV_INFO_PROP_ID, 0, &keyProvInfo);
schanCred.dwVersion = SCH_CRED_V3; schanCred.dwVersion = SCH_CRED_V3;
ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError()); ok(ret, "CertSetCertificateContextProperty failed: %08x\n", GetLastError());
...@@ -498,7 +483,6 @@ static void testAcquireSecurityContext(void) ...@@ -498,7 +483,6 @@ static void testAcquireSecurityContext(void)
NULL, &schanCred, NULL, NULL, &cred, NULL); NULL, &schanCred, NULL, NULL, &cred, NULL);
ok(st == SEC_E_UNKNOWN_CREDENTIALS || st == SEC_E_INTERNAL_ERROR /* WinNT */, 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); "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, ret = CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL,
CRYPT_NEWKEYSET); CRYPT_NEWKEYSET);
...@@ -601,11 +585,8 @@ static void testAcquireSecurityContext(void) ...@@ -601,11 +585,8 @@ static void testAcquireSecurityContext(void)
CryptReleaseContext(csp, 0); CryptReleaseContext(csp, 0);
CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_DELETEKEYSET); CryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_DELETEKEYSET);
if (pCertFreeCertificateContext) CertFreeCertificateContext(certs[0]);
{ CertFreeCertificateContext(certs[1]);
pCertFreeCertificateContext(certs[0]);
pCertFreeCertificateContext(certs[1]);
}
} }
static void test_remote_cert(PCCERT_CONTEXT remote_cert) static void test_remote_cert(PCCERT_CONTEXT remote_cert)
...@@ -616,7 +597,7 @@ 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"); ok(remote_cert->hCertStore != NULL, "hCertStore == NULL\n");
while((iter = pCertEnumCertificatesInStore(remote_cert->hCertStore, iter))) { while((iter = CertEnumCertificatesInStore(remote_cert->hCertStore, iter))) {
if(iter == remote_cert) if(iter == remote_cert)
incl_remote = TRUE; incl_remote = TRUE;
cert_cnt++; cert_cnt++;
...@@ -903,7 +884,7 @@ todo_wine ...@@ -903,7 +884,7 @@ todo_wine
ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) failed: %08x\n", status); ok(status == SEC_E_OK, "QueryContextAttributesW(SECPKG_ATTR_REMOTE_CERT_CONTEXT) failed: %08x\n", status);
if(status == SEC_E_OK) { if(status == SEC_E_OK) {
test_remote_cert(cert); test_remote_cert(cert);
pCertFreeCertificateContext(cert); CertFreeCertificateContext(cert);
} }
status = pQueryContextAttributesA(&context, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info); status = pQueryContextAttributesA(&context, SECPKG_ATTR_CONNECTION_INFO, (void*)&conn_info);
...@@ -1008,6 +989,4 @@ START_TEST(schannel) ...@@ -1008,6 +989,4 @@ START_TEST(schannel)
if(secdll) if(secdll)
FreeLibrary(secdll); FreeLibrary(secdll);
if(crypt32dll)
FreeLibrary(crypt32dll);
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment