FreeRDP
sspi.c File Reference
#include <winpr/platform.h>
#include <winpr/config.h>
#include <winpr/sspi.h>
#include <winpr/crt.h>
#include <winpr/synch.h>
#include <winpr/wlog.h>
#include <winpr/library.h>
#include <winpr/environment.h>
#include "sspi.h"

Macros

#define _NO_KSECDD_IMPORT_   1
 

Functions

static BOOL CALLBACK InitializeSspiModuleInt (PINIT_ONCE once, PVOID param, PVOID *context)
 
const char * GetSecurityStatusString (SECURITY_STATUS status)
 
BOOL IsSecurityStatusError (SECURITY_STATUS status)
 
SecurityFunctionTableW *SEC_ENTRY InitSecurityInterfaceExW (DWORD flags)
 
SecurityFunctionTableA *SEC_ENTRY InitSecurityInterfaceExA (DWORD flags)
 
SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW (ULONG *pcPackages, PSecPkgInfoW *ppPackageInfo)
 
SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesA (ULONG *pcPackages, PSecPkgInfoA *ppPackageInfo)
 
SecurityFunctionTableW *SEC_ENTRY sspi_InitSecurityInterfaceW (void)
 
SecurityFunctionTableA *SEC_ENTRY sspi_InitSecurityInterfaceA (void)
 
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoW (SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo)
 
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoA (SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo)
 
SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleW (SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
 
SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleA (SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
 
SECURITY_STATUS SEC_ENTRY sspi_ExportSecurityContext (PCtxtHandle phContext, ULONG fFlags, PSecBuffer pPackedContext, HANDLE *pToken)
 
SECURITY_STATUS SEC_ENTRY sspi_FreeCredentialsHandle (PCredHandle phCredential)
 
SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextW (SEC_WCHAR *pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextA (SEC_CHAR *pszPackage, PSecBuffer pPackedContext, HANDLE pToken, PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesW (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesA (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_AcceptSecurityContext (PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsTimeStamp)
 
SECURITY_STATUS SEC_ENTRY sspi_ApplyControlToken (PCtxtHandle phContext, PSecBufferDesc pInput)
 
SECURITY_STATUS SEC_ENTRY sspi_CompleteAuthToken (PCtxtHandle phContext, PSecBufferDesc pToken)
 
SECURITY_STATUS SEC_ENTRY sspi_DeleteSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY sspi_FreeContextBuffer (void *pvContextBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_ImpersonateSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextW (PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
 
SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextA (PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, PULONG pfContextAttr, PTimeStamp ptsExpiry)
 
SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityContextToken (PCtxtHandle phContext, HANDLE *phToken)
 
SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer, ULONG cbBuffer)
 
SECURITY_STATUS SEC_ENTRY sspi_RevertSecurityContext (PCtxtHandle phContext)
 
SECURITY_STATUS SEC_ENTRY sspi_DecryptMessage (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
 
SECURITY_STATUS SEC_ENTRY sspi_EncryptMessage (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
 
SECURITY_STATUS SEC_ENTRY sspi_MakeSignature (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
 
SECURITY_STATUS SEC_ENTRY sspi_VerifySignature (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP)
 
WINPR_PRAGMA_DIAG_POP void sspi_FreeAuthIdentity (SEC_WINNT_AUTH_IDENTITY *identity)
 

Variables

WINPR_PRAGMA_DIAG_POP WINPR_PRAGMA_DIAG_PUSH static WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES wLog * g_Log = NULL
 
static INIT_ONCE g_Initialized = INIT_ONCE_STATIC_INIT
 
static SecurityFunctionTableWg_SspiW = NULL
 
static SecurityFunctionTableAg_SspiA = NULL
 

Macro Definition Documentation

◆ _NO_KSECDD_IMPORT_

#define _NO_KSECDD_IMPORT_   1

FreeRDP: A Remote Desktop Protocol Implementation Security Support Provider Interface (SSPI)

Copyright 2012-2014 Marc-Andre Moreau marca.nosp@m.ndre.nosp@m..more.nosp@m.au@g.nosp@m.mail..nosp@m.com

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Function Documentation

◆ GetSecurityStatusString()

const char* GetSecurityStatusString ( SECURITY_STATUS  status)
Here is the call graph for this function:

◆ InitializeSspiModuleInt()

static BOOL CALLBACK InitializeSspiModuleInt ( PINIT_ONCE  once,
PVOID  param,
PVOID *  context 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitSecurityInterfaceExA()

SecurityFunctionTableA* SEC_ENTRY InitSecurityInterfaceExA ( DWORD  flags)
Here is the call graph for this function:

◆ InitSecurityInterfaceExW()

SecurityFunctionTableW* SEC_ENTRY InitSecurityInterfaceExW ( DWORD  flags)
Here is the call graph for this function:

◆ IsSecurityStatusError()

BOOL IsSecurityStatusError ( SECURITY_STATUS  status)
Here is the caller graph for this function:

◆ sspi_AcceptSecurityContext()

SECURITY_STATUS SEC_ENTRY sspi_AcceptSecurityContext ( PCredHandle  phCredential,
PCtxtHandle  phContext,
PSecBufferDesc  pInput,
ULONG  fContextReq,
ULONG  TargetDataRep,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
PULONG  pfContextAttr,
PTimeStamp  ptsTimeStamp 
)
Here is the call graph for this function:

◆ sspi_AcquireCredentialsHandleA()

SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleA ( SEC_CHAR pszPrincipal,
SEC_CHAR pszPackage,
ULONG  fCredentialUse,
void *  pvLogonID,
void *  pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
void *  pvGetKeyArgument,
PCredHandle  phCredential,
PTimeStamp  ptsExpiry 
)
Here is the call graph for this function:

◆ sspi_AcquireCredentialsHandleW()

SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleW ( SEC_WCHAR pszPrincipal,
SEC_WCHAR pszPackage,
ULONG  fCredentialUse,
void *  pvLogonID,
void *  pAuthData,
SEC_GET_KEY_FN  pGetKeyFn,
void *  pvGetKeyArgument,
PCredHandle  phCredential,
PTimeStamp  ptsExpiry 
)
Here is the call graph for this function:

◆ sspi_ApplyControlToken()

SECURITY_STATUS SEC_ENTRY sspi_ApplyControlToken ( PCtxtHandle  phContext,
PSecBufferDesc  pInput 
)
Here is the call graph for this function:

◆ sspi_CompleteAuthToken()

SECURITY_STATUS SEC_ENTRY sspi_CompleteAuthToken ( PCtxtHandle  phContext,
PSecBufferDesc  pToken 
)
Here is the call graph for this function:

◆ sspi_DecryptMessage()

SECURITY_STATUS SEC_ENTRY sspi_DecryptMessage ( PCtxtHandle  phContext,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo,
PULONG  pfQOP 
)
Here is the call graph for this function:

◆ sspi_DeleteSecurityContext()

SECURITY_STATUS SEC_ENTRY sspi_DeleteSecurityContext ( PCtxtHandle  phContext)
Here is the call graph for this function:

◆ sspi_EncryptMessage()

SECURITY_STATUS SEC_ENTRY sspi_EncryptMessage ( PCtxtHandle  phContext,
ULONG  fQOP,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo 
)
Here is the call graph for this function:

◆ sspi_EnumerateSecurityPackagesA()

SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesA ( ULONG *  pcPackages,
PSecPkgInfoA ppPackageInfo 
)
Here is the call graph for this function:

◆ sspi_EnumerateSecurityPackagesW()

SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW ( ULONG *  pcPackages,
PSecPkgInfoW ppPackageInfo 
)

Standard SSPI API

Here is the call graph for this function:

◆ sspi_ExportSecurityContext()

SECURITY_STATUS SEC_ENTRY sspi_ExportSecurityContext ( PCtxtHandle  phContext,
ULONG  fFlags,
PSecBuffer  pPackedContext,
HANDLE *  pToken 
)
Here is the call graph for this function:

◆ sspi_FreeAuthIdentity()

WINPR_PRAGMA_DIAG_POP void sspi_FreeAuthIdentity ( SEC_WINNT_AUTH_IDENTITY identity)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ sspi_FreeContextBuffer()

SECURITY_STATUS SEC_ENTRY sspi_FreeContextBuffer ( void *  pvContextBuffer)
Here is the call graph for this function:

◆ sspi_FreeCredentialsHandle()

SECURITY_STATUS SEC_ENTRY sspi_FreeCredentialsHandle ( PCredHandle  phCredential)
Here is the call graph for this function:

◆ sspi_ImpersonateSecurityContext()

SECURITY_STATUS SEC_ENTRY sspi_ImpersonateSecurityContext ( PCtxtHandle  phContext)
Here is the call graph for this function:

◆ sspi_ImportSecurityContextA()

SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextA ( SEC_CHAR pszPackage,
PSecBuffer  pPackedContext,
HANDLE  pToken,
PCtxtHandle  phContext 
)
Here is the call graph for this function:

◆ sspi_ImportSecurityContextW()

SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextW ( SEC_WCHAR pszPackage,
PSecBuffer  pPackedContext,
HANDLE  pToken,
PCtxtHandle  phContext 
)
Here is the call graph for this function:

◆ sspi_InitializeSecurityContextA()

SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextA ( PCredHandle  phCredential,
PCtxtHandle  phContext,
SEC_CHAR pszTargetName,
ULONG  fContextReq,
ULONG  Reserved1,
ULONG  TargetDataRep,
PSecBufferDesc  pInput,
ULONG  Reserved2,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
PULONG  pfContextAttr,
PTimeStamp  ptsExpiry 
)
Here is the call graph for this function:

◆ sspi_InitializeSecurityContextW()

SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextW ( PCredHandle  phCredential,
PCtxtHandle  phContext,
SEC_WCHAR pszTargetName,
ULONG  fContextReq,
ULONG  Reserved1,
ULONG  TargetDataRep,
PSecBufferDesc  pInput,
ULONG  Reserved2,
PCtxtHandle  phNewContext,
PSecBufferDesc  pOutput,
PULONG  pfContextAttr,
PTimeStamp  ptsExpiry 
)
Here is the call graph for this function:

◆ sspi_InitSecurityInterfaceA()

SecurityFunctionTableA* SEC_ENTRY sspi_InitSecurityInterfaceA ( void  )
Here is the call graph for this function:

◆ sspi_InitSecurityInterfaceW()

SecurityFunctionTableW* SEC_ENTRY sspi_InitSecurityInterfaceW ( void  )
Here is the call graph for this function:

◆ sspi_MakeSignature()

SECURITY_STATUS SEC_ENTRY sspi_MakeSignature ( PCtxtHandle  phContext,
ULONG  fQOP,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo 
)
Here is the call graph for this function:

◆ sspi_QueryContextAttributesA()

SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void *  pBuffer 
)
Here is the call graph for this function:

◆ sspi_QueryContextAttributesW()

SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void *  pBuffer 
)
Here is the call graph for this function:

◆ sspi_QueryCredentialsAttributesA()

SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesA ( PCredHandle  phCredential,
ULONG  ulAttribute,
void *  pBuffer 
)
Here is the call graph for this function:

◆ sspi_QueryCredentialsAttributesW()

SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesW ( PCredHandle  phCredential,
ULONG  ulAttribute,
void *  pBuffer 
)
Here is the call graph for this function:

◆ sspi_QuerySecurityContextToken()

SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityContextToken ( PCtxtHandle  phContext,
HANDLE *  phToken 
)
Here is the call graph for this function:

◆ sspi_QuerySecurityPackageInfoA()

SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoA ( SEC_CHAR pszPackageName,
PSecPkgInfoA ppPackageInfo 
)
Here is the call graph for this function:

◆ sspi_QuerySecurityPackageInfoW()

SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoW ( SEC_WCHAR pszPackageName,
PSecPkgInfoW ppPackageInfo 
)
Here is the call graph for this function:

◆ sspi_RevertSecurityContext()

SECURITY_STATUS SEC_ENTRY sspi_RevertSecurityContext ( PCtxtHandle  phContext)
Here is the call graph for this function:

◆ sspi_SetContextAttributesA()

SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesA ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void *  pBuffer,
ULONG  cbBuffer 
)
Here is the call graph for this function:

◆ sspi_SetContextAttributesW()

SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesW ( PCtxtHandle  phContext,
ULONG  ulAttribute,
void *  pBuffer,
ULONG  cbBuffer 
)
Here is the call graph for this function:

◆ sspi_VerifySignature()

SECURITY_STATUS SEC_ENTRY sspi_VerifySignature ( PCtxtHandle  phContext,
PSecBufferDesc  pMessage,
ULONG  MessageSeqNo,
PULONG  pfQOP 
)
Here is the call graph for this function:

Variable Documentation

◆ g_Initialized

INIT_ONCE g_Initialized = INIT_ONCE_STATIC_INIT
static

◆ g_Log

◆ g_SspiA

SecurityFunctionTableA* g_SspiA = NULL
static

◆ g_SspiW

SecurityFunctionTableW* g_SspiW = NULL
static