Module: wine Branch: master Commit: 87368bb623849b500e6238903ac7e6dffb018e5b URL: http://source.winehq.org/git/wine.git/?a=commit;h=87368bb623849b500e6238903a...
Author: Jacek Caban jacek@codeweavers.com Date: Wed Mar 12 18:35:10 2008 +0100
secur32: Improve SECPKG_ATTR_CIPHER_STRENGTHS stub.
---
dlls/secur32/schannel.c | 12 ++++++++---- dlls/secur32/tests/schannel.c | 15 +++++++++++++++ 2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index b74e54c..742cdb3 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -39,7 +39,7 @@ static SECURITY_STATUS schan_QueryCredentialsAttributes( if (pBuffer) { /* FIXME: get from CryptoAPI */ - FIXME("%d: stub\n", ulAttribute); + FIXME("SECPKG_ATTR_SUPPORTED_ALGS: stub\n"); ret = SEC_E_UNSUPPORTED_FUNCTION; } else @@ -48,9 +48,13 @@ static SECURITY_STATUS schan_QueryCredentialsAttributes( case SECPKG_ATTR_CIPHER_STRENGTHS: if (pBuffer) { + SecPkgCred_CipherStrengths *r = (SecPkgCred_CipherStrengths*)pBuffer; + /* FIXME: get from CryptoAPI */ - FIXME("%d: stub\n", ulAttribute); - ret = SEC_E_UNSUPPORTED_FUNCTION; + FIXME("SECPKG_ATTR_CIPHER_STRENGTHS: semi-stub\n"); + r->dwMinimumCipherStrength = 40; + r->dwMaximumCipherStrength = 168; + ret = SEC_E_OK; } else ret = SEC_E_INTERNAL_ERROR; @@ -59,7 +63,7 @@ static SECURITY_STATUS schan_QueryCredentialsAttributes( if (pBuffer) { /* FIXME: get from OpenSSL? */ - FIXME("%d: stub\n", ulAttribute); + FIXME("SECPKG_ATTR_SUPPORTED_PROTOCOLS: stub\n"); ret = SEC_E_UNSUPPORTED_FUNCTION; } else diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index b19590a..2fc793b 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -31,6 +31,7 @@ static HMODULE secdll, crypt32dll;
static ACQUIRE_CREDENTIALS_HANDLE_FN_A pAcquireCredentialsHandleA; static FREE_CREDENTIALS_HANDLE_FN pFreeCredentialsHandle; +static QUERY_CREDENTIALS_ATTRIBUTES_FN_A pQueryCredentialsAttributesA;
static PCCERT_CONTEXT (WINAPI *pCertCreateCertificateContext)(DWORD,const BYTE*,DWORD); static BOOL (WINAPI *pCertFreeCertificateContext)(PCCERT_CONTEXT); @@ -120,6 +121,7 @@ static void InitFunctionPtrs(void) { GET_PROC(secdll, AcquireCredentialsHandleA); GET_PROC(secdll, FreeCredentialsHandle); + GET_PROC(secdll, QueryCredentialsAttributesA); }
GET_PROC(advapi32dll, CryptAcquireContextW); @@ -134,6 +136,18 @@ static void InitFunctionPtrs(void) #undef GET_PROC }
+static void test_strength(PCredHandle handle) +{ + SecPkgCred_CipherStrengths strength = {-1,-1}; + SECURITY_STATUS st; + + st = pQueryCredentialsAttributesA(handle, SECPKG_ATTR_CIPHER_STRENGTHS, &strength); + ok(st == SEC_E_OK, "QueryCredentialsAttributesA failed: %u\n", GetLastError()); + ok(strength.dwMinimumCipherStrength, "dwMinimumCipherStrength not changed\n"); + ok(strength.dwMaximumCipherStrength, "dwMaximumCipherStrength not changed\n"); + trace("strength %d - %d\n", strength.dwMinimumCipherStrength, strength.dwMaximumCipherStrength); +} + static void testAcquireSecurityContext(void) { SECURITY_STATUS st; @@ -347,6 +361,7 @@ static void testAcquireSecurityContext(void) st = pAcquireCredentialsHandleA(NULL, unisp_name_a, SECPKG_CRED_INBOUND, NULL, &schanCred, NULL, NULL, &cred, NULL); ok(st == SEC_E_OK, "AcquireCredentialsHandleA failed: %08x\n", st); + test_strength(&cred); pFreeCredentialsHandle(&cred);
/* How about more than one cert? */