From e01ae46cac0163df520f94b29245691a007929aa Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Thu, 22 Jan 2009 09:52:28 +0100 Subject: [PATCH] secur32: Remove superfluous pointer casts. --- dlls/secur32/ntlm.c | 15 +++++++-------- dlls/secur32/schannel.c | 14 +++++++------- dlls/secur32/util.c | 2 +- 3 files changed, 15 insertions(+), 16 deletions(-) diff --git a/dlls/secur32/ntlm.c b/dlls/secur32/ntlm.c index bc44a454a5d..38c5134f35b 100644 --- a/dlls/secur32/ntlm.c +++ b/dlls/secur32/ntlm.c @@ -181,8 +181,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleW( if(pAuthData != NULL) { - PSEC_WINNT_AUTH_IDENTITY_W auth_data = - (PSEC_WINNT_AUTH_IDENTITY_W)pAuthData; + PSEC_WINNT_AUTH_IDENTITY_W auth_data = pAuthData; TRACE("Username is %s\n", debugstr_wn(auth_data->User, auth_data->UserLength)); TRACE("Domain name is %s\n", debugstr_wn(auth_data->Domain, auth_data->DomainLength)); @@ -262,8 +261,8 @@ static SECURITY_STATUS SEC_ENTRY ntlm_AcquireCredentialsHandleA( if(pAuthData != NULL) { - identity = (PSEC_WINNT_AUTH_IDENTITY_A)pAuthData; - + identity = pAuthData; + if(identity->Flags == SEC_WINNT_AUTH_IDENTITY_ANSI) { pAuthDataW = HeapAlloc(GetProcessHeap(), 0, @@ -585,12 +584,12 @@ static SECURITY_STATUS SEC_ENTRY ntlm_InitializeSecurityContextW( TRACE("Converting password to unicode.\n"); passwd_lenW = MultiByteToWideChar(CP_ACP, 0, - password ? (LPCSTR)password : (LPCSTR)ntlm_cred->password, + password ? password : ntlm_cred->password, password ? pwlen : ntlm_cred->pwlen, NULL, 0); unicode_password = HeapAlloc(GetProcessHeap(), 0, passwd_lenW * sizeof(SEC_WCHAR)); - MultiByteToWideChar(CP_ACP, 0, password ? (LPCSTR)password : (LPCSTR)ntlm_cred->password, + MultiByteToWideChar(CP_ACP, 0, password ? password : ntlm_cred->password, password ? pwlen : ntlm_cred->pwlen, unicode_password, passwd_lenW); SECUR32_CreateNTLMv1SessionKey((PBYTE)unicode_password, @@ -1523,7 +1522,7 @@ static SECURITY_STATUS ntlm_CreateSignature(PNegoHelper helper, PSecBufferDesc p for( i = 0; i < pMessage->cBuffers; ++i ) { if(pMessage->pBuffers[i].BufferType & SECBUFFER_DATA) - HMACMD5Update(&hmac_md5_ctx, (BYTE *)pMessage->pBuffers[i].pvBuffer, + HMACMD5Update(&hmac_md5_ctx, pMessage->pBuffers[i].pvBuffer, pMessage->pBuffers[i].cbBuffer); } @@ -1770,7 +1769,7 @@ static SECURITY_STATUS SEC_ENTRY ntlm_EncryptMessage(PCtxtHandle phContext, { ntlm_CreateSignature(helper, pMessage, token_idx, NTLM_SEND, FALSE); SECUR32_arc4Process(helper->crypt.ntlm2.send_a4i, - (BYTE *)pMessage->pBuffers[data_idx].pvBuffer, + pMessage->pBuffers[data_idx].pvBuffer, pMessage->pBuffers[data_idx].cbBuffer); if(helper->neg_flags & NTLMSSP_NEGOTIATE_KEY_EXCHANGE) diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index 9b102fbb492..fbf2a62169f 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -132,7 +132,7 @@ static ULONG_PTR schan_alloc_handle(void *object, enum schan_handle_type type) ERR("Handle %d(%p) is in the free list, but has type %#x.\n", (handle-schan_handle_table), handle, handle->type); return SCHAN_INVALID_HANDLE; } - schan_free_handles = (struct schan_handle *)handle->object; + schan_free_handles = handle->object; handle->object = object; handle->type = type; @@ -215,7 +215,7 @@ static SECURITY_STATUS schan_QueryCredentialsAttributes( case SECPKG_ATTR_CIPHER_STRENGTHS: if (pBuffer) { - SecPkgCred_CipherStrengths *r = (SecPkgCred_CipherStrengths*)pBuffer; + SecPkgCred_CipherStrengths *r = pBuffer; /* FIXME: get from CryptoAPI */ FIXME("SECPKG_ATTR_CIPHER_STRENGTHS: semi-stub\n"); @@ -432,7 +432,7 @@ static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleA( debugstr_a(pszPrincipal), debugstr_a(pszPackage), fCredentialUse, pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry); return schan_AcquireCredentialsHandle(fCredentialUse, - (PSCHANNEL_CRED)pAuthData, phCredential, ptsExpiry); + pAuthData, phCredential, ptsExpiry); } static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleW( @@ -444,7 +444,7 @@ static SECURITY_STATUS SEC_ENTRY schan_AcquireCredentialsHandleW( debugstr_w(pszPrincipal), debugstr_w(pszPackage), fCredentialUse, pLogonID, pAuthData, pGetKeyFn, pGetKeyArgument, phCredential, ptsExpiry); return schan_AcquireCredentialsHandle(fCredentialUse, - (PSCHANNEL_CRED)pAuthData, phCredential, ptsExpiry); + pAuthData, phCredential, ptsExpiry); } static SECURITY_STATUS SEC_ENTRY schan_FreeCredentialsHandle( @@ -565,7 +565,7 @@ static char *schan_get_buffer(const struct schan_transport *t, struct schan_buff static ssize_t schan_pull(gnutls_transport_ptr_t transport, void *buff, size_t buff_len) { - struct schan_transport *t = (struct schan_transport *)transport; + struct schan_transport *t = transport; char *b; TRACE("Pull %zu bytes\n", buff_len); @@ -587,7 +587,7 @@ static ssize_t schan_pull(gnutls_transport_ptr_t transport, void *buff, size_t b static ssize_t schan_push(gnutls_transport_ptr_t transport, const void *buff, size_t buff_len) { - struct schan_transport *t = (struct schan_transport *)transport; + struct schan_transport *t = transport; char *b; TRACE("Push %zu bytes\n", buff_len); @@ -851,7 +851,7 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( { case SECPKG_ATTR_STREAM_SIZES: { - SecPkgContext_StreamSizes *stream_sizes = (SecPkgContext_StreamSizes *)buffer; + SecPkgContext_StreamSizes *stream_sizes = buffer; gnutls_mac_algorithm_t mac = pgnutls_mac_get(ctx->session); size_t mac_size = pgnutls_mac_get_key_size(mac); gnutls_cipher_algorithm_t cipher = pgnutls_cipher_get(ctx->session); diff --git a/dlls/secur32/util.c b/dlls/secur32/util.c index 15d3a2a1b25..a226bf5e87b 100644 --- a/dlls/secur32/util.c +++ b/dlls/secur32/util.c @@ -129,7 +129,7 @@ SECURITY_STATUS SECUR32_CreateNTLMv1SessionKey(PBYTE password, int len, PBYTE se TRACE("(%p, %p)\n", password, session_key); MD4Init(&ctx); - MD4Update(&ctx, (const unsigned char*) password, len); + MD4Update(&ctx, password, len); MD4Final(&ctx); memcpy(ntlm_hash, ctx.digest, 0x10); -- 2.11.4.GIT