FreeRDP
Loading...
Searching...
No Matches
libwinpr/sspi/sspi.h
1
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 = 1,
75 SSPI_PACKAGE_KERBEROS = 2,
76 SSPI_PACKAGE_NEGOTIATE = 3,
77 SSPI_PACKAGE_CREDSSP = 4,
78 SSPI_PACKAGE_SCHANNEL = 5,
79 SSPI_PACKAGE_COUNT /* number of identifiers, SSPI_PACKAGE_NONE included; keep last */
80} SSPI_PACKAGE_ID;
81
82/* Typed access to the package identity. Shares the upper-pointer slot and its encoding
83 * with sspi_SecureHandleGet/SetUpperPointer, but never forms a pointer from the
84 * identifier, so no integer-to-pointer conversion appears at any call site. */
85WINPR_ATTR_NODISCARD SSPI_PACKAGE_ID sspi_SecureHandleGetPackageId(SecHandle* handle);
86void sspi_SecureHandleSetPackageId(SecHandle* handle, SSPI_PACKAGE_ID id);
87
88enum SecurityFunctionTableIndex
89{
90 EnumerateSecurityPackagesIndex = 1,
91 Reserved1Index = 2,
92 QueryCredentialsAttributesIndex = 3,
93 AcquireCredentialsHandleIndex = 4,
94 FreeCredentialsHandleIndex = 5,
95 Reserved2Index = 6,
96 InitializeSecurityContextIndex = 7,
97 AcceptSecurityContextIndex = 8,
98 CompleteAuthTokenIndex = 9,
99 DeleteSecurityContextIndex = 10,
100 ApplyControlTokenIndex = 11,
101 QueryContextAttributesIndex = 12,
102 ImpersonateSecurityContextIndex = 13,
103 RevertSecurityContextIndex = 14,
104 MakeSignatureIndex = 15,
105 VerifySignatureIndex = 16,
106 FreeContextBufferIndex = 17,
107 QuerySecurityPackageInfoIndex = 18,
108 Reserved3Index = 19,
109 Reserved4Index = 20,
110 ExportSecurityContextIndex = 21,
111 ImportSecurityContextIndex = 22,
112 AddCredentialsIndex = 23,
113 Reserved8Index = 24,
114 QuerySecurityContextTokenIndex = 25,
115 EncryptMessageIndex = 26,
116 DecryptMessageIndex = 27,
117 SetContextAttributesIndex = 28,
118 SetCredentialsAttributesIndex = 29
119};
120
121WINPR_ATTR_NODISCARD
122BOOL IsSecurityStatusError(SECURITY_STATUS status);
123
124#include "sspi_gss.h"
125#include "sspi_winpr.h"
126
127#endif /* WINPR_SSPI_PRIVATE_H */