FreeRDP
sspi_export.c
1 
20 #include <winpr/platform.h>
21 #include <winpr/wtypes.h>
22 #include <winpr/config.h>
23 
24 #ifdef _WIN32
25 #define SEC_ENTRY __stdcall
26 #define SSPI_EXPORT __declspec(dllexport)
27 #else
28 #include <winpr/winpr.h>
29 #define SEC_ENTRY
30 #define SSPI_EXPORT WINPR_API
31 #endif
32 
33 #ifdef _WIN32
34 typedef long LONG;
35 typedef unsigned long ULONG;
36 #endif
37 typedef LONG SECURITY_STATUS;
38 
39 WINPR_PRAGMA_DIAG_PUSH
40 WINPR_PRAGMA_DIAG_IGNORED_MISSING_PROTOTYPES
41 
42 #ifdef SSPI_DLL
43 
48 /* Package Management */
49 
50 extern SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesW(void*, void*);
51 
52 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(void* pcPackages,
53  void* ppPackageInfo)
54 {
55  return sspi_EnumerateSecurityPackagesW(pcPackages, ppPackageInfo);
56 }
57 
58 extern SECURITY_STATUS SEC_ENTRY sspi_EnumerateSecurityPackagesA(void*, void*);
59 
60 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(void* pcPackages,
61  void* ppPackageInfo)
62 {
63  return sspi_EnumerateSecurityPackagesA(pcPackages, ppPackageInfo);
64 }
65 
66 extern void* SEC_ENTRY sspi_InitSecurityInterfaceW(void);
67 
68 SSPI_EXPORT void* SEC_ENTRY InitSecurityInterfaceW(void)
69 {
70  return sspi_InitSecurityInterfaceW();
71 }
72 
73 extern void* SEC_ENTRY sspi_InitSecurityInterfaceA(void);
74 
75 SSPI_EXPORT void* SEC_ENTRY InitSecurityInterfaceA(void)
76 {
77  return sspi_InitSecurityInterfaceA();
78 }
79 
80 extern SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoW(void*, void*);
81 
82 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(void* pszPackageName,
83  void* ppPackageInfo)
84 {
85  return sspi_QuerySecurityPackageInfoW(pszPackageName, ppPackageInfo);
86 }
87 
88 extern SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityPackageInfoA(void*, void*);
89 
90 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(void* pszPackageName,
91  void* ppPackageInfo)
92 {
93  return sspi_QuerySecurityPackageInfoA(pszPackageName, ppPackageInfo);
94 }
95 
96 /* Credential Management */
97 
98 extern SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleW(void*, void*, ULONG, void*, void*,
99  void*, void*, void*, void*);
100 
101 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
102  void* pszPrincipal, void* pszPackage, ULONG fCredentialUse, void* pvLogonID, void* pAuthData,
103  void* pGetKeyFn, void* pvGetKeyArgument, void* phCredential, void* ptsExpiry)
104 {
105  return sspi_AcquireCredentialsHandleW(pszPrincipal, pszPackage, fCredentialUse, pvLogonID,
106  pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
107  ptsExpiry);
108 }
109 
110 extern SECURITY_STATUS SEC_ENTRY sspi_AcquireCredentialsHandleA(void*, void*, ULONG, void*, void*,
111  void*, void*, void*, void*);
112 
113 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
114  void* pszPrincipal, void* pszPackage, ULONG fCredentialUse, void* pvLogonID, void* pAuthData,
115  void* pGetKeyFn, void* pvGetKeyArgument, void* phCredential, void* ptsExpiry)
116 {
117  return sspi_AcquireCredentialsHandleA(pszPrincipal, pszPackage, fCredentialUse, pvLogonID,
118  pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential,
119  ptsExpiry);
120 }
121 
122 extern SECURITY_STATUS SEC_ENTRY sspi_ExportSecurityContext(void*, ULONG, void*, void**);
123 
124 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY ExportSecurityContext(void* phContext, ULONG fFlags,
125  void* pPackedContext, void** pToken)
126 {
127  return sspi_ExportSecurityContext(phContext, fFlags, pPackedContext, pToken);
128 }
129 
130 extern SECURITY_STATUS SEC_ENTRY sspi_FreeCredentialsHandle(void*);
131 
132 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(void* phCredential)
133 {
134  return sspi_FreeCredentialsHandle(phCredential);
135 }
136 
137 extern SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextW(void*, void*, void*, void*);
138 
139 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(void* pszPackage, void* pPackedContext,
140  void* pToken, void* phContext)
141 {
142  return sspi_ImportSecurityContextW(pszPackage, pPackedContext, pToken, phContext);
143 }
144 
145 extern SECURITY_STATUS SEC_ENTRY sspi_ImportSecurityContextA(void*, void*, void*, void*);
146 
147 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(void* pszPackage, void* pPackedContext,
148  void* pToken, void* phContext)
149 {
150  return sspi_ImportSecurityContextA(pszPackage, pPackedContext, pToken, phContext);
151 }
152 
153 extern SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesW(void*, ULONG, void*);
154 
155 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(void* phCredential,
156  ULONG ulAttribute, void* pBuffer)
157 {
158  return sspi_QueryCredentialsAttributesW(phCredential, ulAttribute, pBuffer);
159 }
160 
161 extern SECURITY_STATUS SEC_ENTRY sspi_QueryCredentialsAttributesA(void*, ULONG, void*);
162 
163 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(void* phCredential,
164  ULONG ulAttribute, void* pBuffer)
165 {
166  return sspi_QueryCredentialsAttributesA(phCredential, ulAttribute, pBuffer);
167 }
168 
169 /* Context Management */
170 
171 extern SECURITY_STATUS SEC_ENTRY sspi_AcceptSecurityContext(void*, void*, void*, ULONG, ULONG,
172  void*, void*, void*, void*);
173 
174 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(void* phCredential, void* phContext,
175  void* pInput, ULONG fContextReq,
176  ULONG TargetDataRep, void* phNewContext,
177  void* pOutput, void* pfContextAttr,
178  void* ptsTimeStamp)
179 {
180  return sspi_AcceptSecurityContext(phCredential, phContext, pInput, fContextReq, TargetDataRep,
181  phNewContext, pOutput, pfContextAttr, ptsTimeStamp);
182 }
183 
184 extern SECURITY_STATUS SEC_ENTRY sspi_ApplyControlToken(void*, void*);
185 
186 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY ApplyControlToken(void* phContext, void* pInput)
187 {
188  return sspi_ApplyControlToken(phContext, pInput);
189 }
190 
191 extern SECURITY_STATUS SEC_ENTRY sspi_CompleteAuthToken(void*, void*);
192 
193 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY CompleteAuthToken(void* phContext, void* pToken)
194 {
195  return sspi_CompleteAuthToken(phContext, pToken);
196 }
197 
198 extern SECURITY_STATUS SEC_ENTRY sspi_DeleteSecurityContext(void*);
199 
200 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(void* phContext)
201 {
202  return sspi_DeleteSecurityContext(phContext);
203 }
204 
205 extern SECURITY_STATUS SEC_ENTRY sspi_FreeContextBuffer(void*);
206 
207 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY FreeContextBuffer(void* pvContextBuffer)
208 {
209  return sspi_FreeContextBuffer(pvContextBuffer);
210 }
211 
212 extern SECURITY_STATUS SEC_ENTRY sspi_ImpersonateSecurityContext(void*);
213 
214 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(void* phContext)
215 {
216  return sspi_ImpersonateSecurityContext(phContext);
217 }
218 
219 extern SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextW(void*, void*, void*, ULONG, ULONG,
220  ULONG, void*, ULONG, void*, void*,
221  void*, void*);
222 
223 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
224  void* phCredential, void* phContext, void* pszTargetName, ULONG fContextReq, ULONG Reserved1,
225  ULONG TargetDataRep, void* pInput, ULONG Reserved2, void* phNewContext, void* pOutput,
226  void* pfContextAttr, void* ptsExpiry)
227 {
228  return sspi_InitializeSecurityContextW(phCredential, phContext, pszTargetName, fContextReq,
229  Reserved1, TargetDataRep, pInput, Reserved2,
230  phNewContext, pOutput, pfContextAttr, ptsExpiry);
231 }
232 
233 extern SECURITY_STATUS SEC_ENTRY sspi_InitializeSecurityContextA(void*, void*, void*, ULONG, ULONG,
234  ULONG, void*, ULONG, void*, void*,
235  void*, void*);
236 
237 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
238  void* phCredential, void* phContext, void* pszTargetName, ULONG fContextReq, ULONG Reserved1,
239  ULONG TargetDataRep, void* pInput, ULONG Reserved2, void* phNewContext, void* pOutput,
240  void* pfContextAttr, void* ptsExpiry)
241 {
242  return sspi_InitializeSecurityContextA(phCredential, phContext, pszTargetName, fContextReq,
243  Reserved1, TargetDataRep, pInput, Reserved2,
244  phNewContext, pOutput, pfContextAttr, ptsExpiry);
245 }
246 
247 extern SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesW(void*, ULONG, void*);
248 
249 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(void* phContext, ULONG ulAttribute,
250  void* pBuffer)
251 {
252  return sspi_QueryContextAttributesW(phContext, ulAttribute, pBuffer);
253 }
254 
255 extern SECURITY_STATUS SEC_ENTRY sspi_QueryContextAttributesA(void*, ULONG, void*);
256 
257 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(void* phContext, ULONG ulAttribute,
258  void* pBuffer)
259 {
260  return sspi_QueryContextAttributesA(phContext, ulAttribute, pBuffer);
261 }
262 
263 extern SECURITY_STATUS SEC_ENTRY sspi_QuerySecurityContextToken(void*, void**);
264 
265 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(void* phContext, void** phToken)
266 {
267  return sspi_QuerySecurityContextToken(phContext, phToken);
268 }
269 
270 extern SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesW(void*, ULONG, void*, ULONG);
271 
272 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY SetContextAttributesW(void* phContext, ULONG ulAttribute,
273  void* pBuffer, ULONG cbBuffer)
274 {
275  return sspi_SetContextAttributesW(phContext, ulAttribute, pBuffer, cbBuffer);
276 }
277 
278 extern SECURITY_STATUS SEC_ENTRY sspi_SetContextAttributesA(void*, ULONG, void*, ULONG);
279 
280 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY SetContextAttributesA(void* phContext, ULONG ulAttribute,
281  void* pBuffer, ULONG cbBuffer)
282 {
283  return sspi_SetContextAttributesA(phContext, ulAttribute, pBuffer, cbBuffer);
284 }
285 
286 extern SECURITY_STATUS SEC_ENTRY sspi_SetCredentialsAttributesW(void*, ULONG, void*, ULONG);
287 
288 static SECURITY_STATUS SEC_ENTRY SetCredentialsAttributesW(void* phCredential, ULONG ulAttribute,
289  void* pBuffer, ULONG cbBuffer)
290 {
291  return sspi_SetCredentialsAttributesW(phCredential, ulAttribute, pBuffer, cbBuffer);
292 }
293 
294 extern SECURITY_STATUS SEC_ENTRY sspi_SetCredentialsAttributesA(void*, ULONG, void*, ULONG);
295 
296 static SECURITY_STATUS SEC_ENTRY SetCredentialsAttributesA(void* phCredential, ULONG ulAttribute,
297  void* pBuffer, ULONG cbBuffer)
298 {
299  return sspi_SetCredentialsAttributesA(phCredential, ulAttribute, pBuffer, cbBuffer);
300 }
301 
302 extern SECURITY_STATUS SEC_ENTRY sspi_RevertSecurityContext(void*);
303 
304 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY RevertSecurityContext(void* phContext)
305 {
306  return sspi_RevertSecurityContext(phContext);
307 }
308 
309 /* Message Support */
310 
311 extern SECURITY_STATUS SEC_ENTRY sspi_DecryptMessage(void*, void*, ULONG, void*);
312 
313 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY DecryptMessage(void* phContext, void* pMessage,
314  ULONG MessageSeqNo, void* pfQOP)
315 {
316  return sspi_DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP);
317 }
318 
319 extern SECURITY_STATUS SEC_ENTRY sspi_EncryptMessage(void*, ULONG, void*, ULONG);
320 
321 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY EncryptMessage(void* phContext, ULONG fQOP, void* pMessage,
322  ULONG MessageSeqNo)
323 {
324  return sspi_EncryptMessage(phContext, fQOP, pMessage, MessageSeqNo);
325 }
326 
327 extern SECURITY_STATUS SEC_ENTRY sspi_MakeSignature(void*, ULONG, void*, ULONG);
328 
329 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY MakeSignature(void* phContext, ULONG fQOP, void* pMessage,
330  ULONG MessageSeqNo)
331 {
332  return sspi_MakeSignature(phContext, fQOP, pMessage, MessageSeqNo);
333 }
334 
335 extern SECURITY_STATUS SEC_ENTRY sspi_VerifySignature(void*, void*, ULONG, void*);
336 
337 SSPI_EXPORT SECURITY_STATUS SEC_ENTRY VerifySignature(void* phContext, void* pMessage,
338  ULONG MessageSeqNo, void* pfQOP)
339 {
340  return sspi_VerifySignature(phContext, pMessage, MessageSeqNo, pfQOP);
341 }
342 
343 #endif /* SSPI_DLL */
344 
345 WINPR_PRAGMA_DIAG_POP