#include <winpr/config.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
#include <ctype.h>
#include <winpr/assert.h>
#include <winpr/crt.h>
#include <winpr/sspi.h>
#include <winpr/print.h>
#include <winpr/tchar.h>
#include <winpr/sysinfo.h>
#include <winpr/registry.h>
#include "kerberos.h"
#include "../sspi.h"
#include "../../log.h"
|
static KRB_CONTEXT * | kerberos_ContextNew (void) |
|
static void | kerberos_ContextFree (KRB_CONTEXT *context) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_AcquireCredentialsHandleA (SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_AcquireCredentialsHandleW (SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_FreeCredentialsHandle (PCredHandle phCredential) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_QueryCredentialsAttributesW (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_QueryCredentialsAttributesA (PCredHandle phCredential, ULONG ulAttribute, void *pBuffer) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_InitializeSecurityContextA (PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_InitializeSecurityContextW (PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_AcceptSecurityContext (PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpity) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_DeleteSecurityContext (PCtxtHandle phContext) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_QueryContextAttributesA (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_QueryContextAttributesW (PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_EncryptMessage (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_DecryptMessage (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, ULONG *pfQOP) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_MakeSignature (PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo) |
|
static SECURITY_STATUS SEC_ENTRY | kerberos_VerifySignature (PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, ULONG *pfQOP) |
|
◆ TAG
◆ kerberos_AcceptSecurityContext()
◆ kerberos_AcquireCredentialsHandleA()
◆ kerberos_AcquireCredentialsHandleW()
◆ kerberos_ContextFree()
static void kerberos_ContextFree |
( |
KRB_CONTEXT * |
context | ) |
|
|
static |
◆ kerberos_ContextNew()
static KRB_CONTEXT* kerberos_ContextNew |
( |
void |
| ) |
|
|
static |
◆ kerberos_DecryptMessage()
◆ kerberos_DeleteSecurityContext()
◆ kerberos_EncryptMessage()
◆ kerberos_FreeCredentialsHandle()
◆ kerberos_InitializeSecurityContextA()
static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextA |
( |
PCredHandle |
phCredential, |
|
|
PCtxtHandle |
phContext, |
|
|
SEC_CHAR * |
pszTargetName, |
|
|
ULONG |
fContextReq, |
|
|
ULONG |
Reserved1, |
|
|
ULONG |
TargetDataRep, |
|
|
PSecBufferDesc |
pInput, |
|
|
ULONG |
Reserved2, |
|
|
PCtxtHandle |
phNewContext, |
|
|
PSecBufferDesc |
pOutput, |
|
|
ULONG * |
pfContextAttr, |
|
|
PTimeStamp |
ptsExpiry |
|
) |
| |
|
static |
◆ kerberos_InitializeSecurityContextW()
static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextW |
( |
PCredHandle |
phCredential, |
|
|
PCtxtHandle |
phContext, |
|
|
SEC_WCHAR * |
pszTargetName, |
|
|
ULONG |
fContextReq, |
|
|
ULONG |
Reserved1, |
|
|
ULONG |
TargetDataRep, |
|
|
PSecBufferDesc |
pInput, |
|
|
ULONG |
Reserved2, |
|
|
PCtxtHandle |
phNewContext, |
|
|
PSecBufferDesc |
pOutput, |
|
|
ULONG * |
pfContextAttr, |
|
|
PTimeStamp |
ptsExpiry |
|
) |
| |
|
static |
◆ kerberos_MakeSignature()
◆ kerberos_QueryContextAttributesA()
◆ kerberos_QueryContextAttributesW()
◆ kerberos_QueryCredentialsAttributesA()
◆ kerberos_QueryCredentialsAttributesW()
◆ kerberos_VerifySignature()
◆ g_SSPI_GSS_C_SPNEGO_KRB5
sspi_gss_OID_desc g_SSPI_GSS_C_SPNEGO_KRB5 |
|
static |
Initial value:= {
9, (void*)"\x2a\x86\x48\x86\xf7\x12\x01\x02\x02"
}
◆ KERBEROS_SecPkgInfoA
Initial value:= {
0x000F3BBF,
1,
0x0010,
0x0000BB80,
"Kerberos",
"Kerberos Security Package"
}
◆ KERBEROS_SecPkgInfoW
Initial value:= {
0x000F3BBF,
1,
0x0010,
0x0000BB80,
}
◆ KERBEROS_SecPkgInfoW_Comment
WCHAR KERBEROS_SecPkgInfoW_Comment[] |
|
static |
Initial value:= { 'K', 'e', 'r', 'b', 'e', 'r', 'o', 's', ' ',
'S', 'e', 'c', 'u', 'r', 'i', 't', 'y', ' ',
'P', 'a', 'c', 'k', 'a', 'g', 'e', '\0' }
◆ KERBEROS_SecPkgInfoW_Name
WCHAR KERBEROS_SecPkgInfoW_Name[] = { 'K', 'e', 'r', 'b', 'e', 'r', 'o', 's', '\0' } |
|
static |
◆ KERBEROS_SecurityFunctionTableA
◆ KERBEROS_SecurityFunctionTableW
◆ KRB_PACKAGE_NAME
const char* KRB_PACKAGE_NAME = "Kerberos" |
|
static |
◆ SSPI_GSS_C_SPNEGO_KRB5
static SECURITY_STATUS SEC_ENTRY kerberos_QueryCredentialsAttributesA(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: kerberos.c:479
static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextA(PCredHandle phCredential, PCtxtHandle phContext, SEC_CHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: kerberos.c:486
static SECURITY_STATUS SEC_ENTRY kerberos_InitializeSecurityContextW(PCredHandle phCredential, PCtxtHandle phContext, SEC_WCHAR *pszTargetName, ULONG fContextReq, ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput, ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpiry)
Definition: kerberos.c:591
static SECURITY_STATUS SEC_ENTRY kerberos_FreeCredentialsHandle(PCredHandle phCredential)
Definition: kerberos.c:449
static SECURITY_STATUS SEC_ENTRY kerberos_VerifySignature(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, ULONG *pfQOP)
Definition: kerberos.c:939
static SECURITY_STATUS SEC_ENTRY kerberos_MakeSignature(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
Definition: kerberos.c:895
static WCHAR KERBEROS_SecPkgInfoW_Comment[]
Definition: kerberos.c:69
static SECURITY_STATUS SEC_ENTRY kerberos_EncryptMessage(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo)
Definition: kerberos.c:749
static SECURITY_STATUS SEC_ENTRY kerberos_AcquireCredentialsHandleA(SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: kerberos.c:168
static WCHAR KERBEROS_SecPkgInfoW_Name[]
Definition: kerberos.c:67
static SECURITY_STATUS SEC_ENTRY kerberos_DeleteSecurityContext(PCtxtHandle phContext)
Definition: kerberos.c:690
static SECURITY_STATUS SEC_ENTRY kerberos_AcquireCredentialsHandleW(SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse, void *pvLogonID, void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry)
Definition: kerberos.c:423
static SECURITY_STATUS SEC_ENTRY kerberos_QueryCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void *pBuffer)
Definition: kerberos.c:466
static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesA(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: kerberos.c:702
static SECURITY_STATUS SEC_ENTRY kerberos_AcceptSecurityContext(PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput, ULONG fContextReq, ULONG TargetDataRep, PCtxtHandle phNewContext, PSecBufferDesc pOutput, ULONG *pfContextAttr, PTimeStamp ptsExpity)
Definition: kerberos.c:612
static SECURITY_STATUS SEC_ENTRY kerberos_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, ULONG *pfQOP)
Definition: kerberos.c:835
if availableBytes return NULL
Definition: TPCircularBuffer.h:109
static SECURITY_STATUS SEC_ENTRY kerberos_QueryContextAttributesW(PCtxtHandle phContext, ULONG ulAttribute, void *pBuffer)
Definition: kerberos.c:743