FreeRDP
Loading...
Searching...
No Matches
libwinpr/sspi/sspi.h
1
19
20#ifndef WINPR_SSPI_PRIVATE_H
21#define WINPR_SSPI_PRIVATE_H
22
23#include <winpr/sspi.h>
24
25/* Macro converting a ANSII character to a little endian WCHAR */
26#if defined(__BIG_ENDIAN__)
27#define W(c) (((WCHAR)(char)c) << 8)
28#else
29#define W(c) (((WCHAR)(char)c))
30#endif
31
32#define SCHANNEL_CB_MAX_TOKEN 0x00006000
33
34typedef struct
35{
36 DWORD flags;
37 ULONG fCredentialUse;
38 SEC_GET_KEY_FN pGetKeyFn;
39 void* pvGetKeyArgument;
40 SEC_WINNT_AUTH_IDENTITY identity;
41 SEC_WINPR_NTLM_SETTINGS_V2* ntlmSettingsV2;
43
44void sspi_CredentialsFree(SSPI_CREDENTIALS* credentials);
45
46WINPR_ATTR_MALLOC(sspi_CredentialsFree, 1)
47SSPI_CREDENTIALS* sspi_CredentialsNew(void);
48
49PSecBuffer sspi_FindSecBuffer(PSecBufferDesc pMessage, ULONG BufferType);
50
51void sspi_SecureHandleFree(SecHandle* handle);
52
53WINPR_ATTR_MALLOC(sspi_SecureHandleFree, 1)
54SecHandle* sspi_SecureHandleAlloc(void);
55
56void sspi_SecureHandleInvalidate(SecHandle* handle);
57
58WINPR_ATTR_NODISCARD
59void* sspi_SecureHandleGetLowerPointer(SecHandle* handle);
60
61void sspi_SecureHandleSetLowerPointer(SecHandle* handle, void* pointer);
62
63WINPR_ATTR_NODISCARD
64void* sspi_SecureHandleGetUpperPointer(SecHandle* handle);
65
66void sspi_SecureHandleSetUpperPointer(SecHandle* handle, void* pointer);
67
68/* Package identity of a SecHandle (1-based; 0 == unset). The order MUST match
69 * SecPkgInfo{A,W}_LIST and SecurityFunctionTable{A,W}_NAME_LIST in sspi_winpr.c;
70 * that is asserted at compile time there. */
71typedef enum WINPR_C23_ENUM_TYPE(uint32_t)
72{
73 SSPI_PACKAGE_NONE = 0,
74 SSPI_PACKAGE_NTLM,
75 SSPI_PACKAGE_KERBEROS,
76 SSPI_PACKAGE_NEGOTIATE,
77 SSPI_PACKAGE_CREDSSP,
78 SSPI_PACKAGE_SCHANNEL,
79 SSPI_PACKAGE_TSSSP,
80 SSPI_PACKAGE_COUNT /* number of identifiers, SSPI_PACKAGE_NONE included; keep last */
81} SSPI_PACKAGE_ID;
82
83/* Typed access to the package identity. Shares the upper-pointer slot and its encoding
84 * with sspi_SecureHandleGet/SetUpperPointer, but never forms a pointer from the
85 * identifier, so no integer-to-pointer conversion appears at any call site. */
86WINPR_ATTR_NODISCARD SSPI_PACKAGE_ID sspi_SecureHandleGetPackageId(SecHandle* handle);
87void sspi_SecureHandleSetPackageId(SecHandle* handle, SSPI_PACKAGE_ID id);
88
89enum SecurityFunctionTableIndex
90{
91 EnumerateSecurityPackagesIndex = 1,
92 Reserved1Index = 2,
93 QueryCredentialsAttributesIndex = 3,
94 AcquireCredentialsHandleIndex = 4,
95 FreeCredentialsHandleIndex = 5,
96 Reserved2Index = 6,
97 InitializeSecurityContextIndex = 7,
98 AcceptSecurityContextIndex = 8,
99 CompleteAuthTokenIndex = 9,
100 DeleteSecurityContextIndex = 10,
101 ApplyControlTokenIndex = 11,
102 QueryContextAttributesIndex = 12,
103 ImpersonateSecurityContextIndex = 13,
104 RevertSecurityContextIndex = 14,
105 MakeSignatureIndex = 15,
106 VerifySignatureIndex = 16,
107 FreeContextBufferIndex = 17,
108 QuerySecurityPackageInfoIndex = 18,
109 Reserved3Index = 19,
110 Reserved4Index = 20,
111 ExportSecurityContextIndex = 21,
112 ImportSecurityContextIndex = 22,
113 AddCredentialsIndex = 23,
114 Reserved8Index = 24,
115 QuerySecurityContextTokenIndex = 25,
116 EncryptMessageIndex = 26,
117 DecryptMessageIndex = 27,
118 SetContextAttributesIndex = 28,
119 SetCredentialsAttributesIndex = 29
120};
121
122WINPR_ATTR_NODISCARD
123BOOL IsSecurityStatusError(SECURITY_STATUS status);
124
125#include "sspi_gss.h"
126#include "sspi_winpr.h"
127
128#endif /* WINPR_SSPI_PRIVATE_H */