diff --git a/dlls/secur32/tests/Makefile.in b/dlls/secur32/tests/Makefile.in index f7afa7b7685..d06cee95136 100644 --- a/dlls/secur32/tests/Makefile.in +++ b/dlls/secur32/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = secur32.dll -IMPORTS = advapi32 ws2_32 +IMPORTS = crypt32 advapi32 ws2_32 C_SRCS = \ main.c \ diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index 4dc8717bb9d..4abe35e630d 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -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 = pCertEnumCertificatesInStore(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); - pCertFreeCertificateContext(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); }