5f6f2a0d0ae82e6214ca919755e2ac162a9b3b6c
[reactos.git] / reactos / include / psdk / sspi.h
1 /*
2 * Copyright (C) 2004 Juan Lang
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18 #ifndef __WINE_SSPI_H__
19 #define __WINE_SSPI_H__
20
21 #include <wtypes.h>
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #define SEC_ENTRY WINAPI
28
29 typedef WCHAR SEC_WCHAR;
30 typedef CHAR SEC_CHAR;
31
32 #ifndef __SECSTATUS_DEFINED__
33 #define __SECSTATUS_DEFINED__
34 typedef LONG SECURITY_STATUS;
35 #endif
36
37 #define UNISP_NAME_A "Microsoft Unified Security Protocol Provider"
38 #define UNISP_NAME_W L"Microsoft Unified Security Protocol Provider"
39 #define UNISP_NAME WINELIB_NAME_AW(UNISP_NAME_)
40
41 #ifdef UNICODE
42 typedef SEC_WCHAR * SECURITY_PSTR;
43 typedef CONST SEC_WCHAR * SECURITY_PCSTR;
44 #else
45 typedef SEC_CHAR * SECURITY_PSTR;
46 typedef CONST SEC_CHAR * SECURITY_PCSTR;
47 #endif
48
49 #ifndef __SECHANDLE_DEFINED__
50 #define __SECHANDLE_DEFINED__
51 typedef struct _SecHandle
52 {
53 ULONG_PTR dwLower;
54 ULONG_PTR dwUpper;
55 } SecHandle, *PSecHandle;
56 #endif
57
58 #define SecInvalidateHandle(x) do { \
59 ((PSecHandle)(x))->dwLower = ((ULONG_PTR)((INT_PTR)-1)); \
60 ((PSecHandle)(x))->dwUpper = ((ULONG_PTR)((INT_PTR)-1)); \
61 } while (0)
62
63 #define SecIsValidHandle(x) \
64 ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)(INT_PTR)-1)) && \
65 (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)(INT_PTR)-1)))
66
67 typedef SecHandle CredHandle;
68 typedef PSecHandle PCredHandle;
69
70 typedef SecHandle CtxtHandle;
71 typedef PSecHandle PCtxtHandle;
72
73 typedef struct _SECURITY_INTEGER
74 {
75 ULONG LowPart;
76 LONG HighPart;
77 } SECURITY_INTEGER, *PSECURITY_INTEGER;
78 typedef SECURITY_INTEGER TimeStamp, *PTimeStamp;
79
80 typedef struct _SecPkgInfoA
81 {
82 ULONG fCapabilities;
83 unsigned short wVersion;
84 unsigned short wRPCID;
85 ULONG cbMaxToken;
86 SEC_CHAR *Name;
87 SEC_CHAR *Comment;
88 } SecPkgInfoA, *PSecPkgInfoA;
89
90 typedef struct _SecPkgInfoW
91 {
92 ULONG fCapabilities;
93 unsigned short wVersion;
94 unsigned short wRPCID;
95 ULONG cbMaxToken;
96 SEC_WCHAR *Name;
97 SEC_WCHAR *Comment;
98 } SecPkgInfoW, *PSecPkgInfoW;
99
100 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
101 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
102
103 /* fCapabilities field of SecPkgInfo */
104 #define SECPKG_FLAG_INTEGRITY 0x00000001
105 #define SECPKG_FLAG_PRIVACY 0x00000002
106 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
107 #define SECPKG_FLAG_DATAGRAM 0x00000008
108 #define SECPKG_FLAG_CONNECTION 0x00000010
109 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
110 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
111 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
112 #define SECPKG_FLAG_IMPERSONATION 0x00000100
113 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
114 #define SECPKG_FLAG_STREAM 0x00000400
115 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
116 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
117 #define SECPKG_FLAG_LOGON 0x00002000
118 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
119 #define SECPKG_FLAG_FRAGMENT 0x00008000
120 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
121 #define SECPKG_FLAG_DELEGATION 0x00020000
122 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
123
124 typedef struct _SecBuffer
125 {
126 ULONG cbBuffer;
127 ULONG BufferType;
128 void *pvBuffer;
129 } SecBuffer, *PSecBuffer;
130
131 /* values for BufferType */
132 #define SECBUFFER_EMPTY 0
133 #define SECBUFFER_DATA 1
134 #define SECBUFFER_TOKEN 2
135 #define SECBUFFER_PKG_PARAMS 3
136 #define SECBUFFER_MISSING 4
137 #define SECBUFFER_EXTRA 5
138 #define SECBUFFER_STREAM_TRAILER 6
139 #define SECBUFFER_STREAM_HEADER 7
140 #define SECBUFFER_NEGOTIATION_INFO 8
141 #define SECBUFFER_PADDING 9
142 #define SECBUFFER_STREAM 10
143 #define SECBUFFER_MECHLIST 11
144 #define SECBUFFER_MECHLIST_SIGNATURE 12
145 #define SECBUFFER_TARGET 13
146 #define SECBUFFER_CHANNEL_BINDINGS 14
147
148 #define SECBUFFER_ATTRMASK 0xf0000000
149 #define SECBUFFER_READONLY 0x80000000
150 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
151 #define SECBUFFER_RESERVED 0x60000000
152
153 typedef struct _SecBufferDesc
154 {
155 ULONG ulVersion;
156 ULONG cBuffers;
157 PSecBuffer pBuffers;
158 } SecBufferDesc, *PSecBufferDesc;
159
160 /* values for ulVersion */
161 #define SECBUFFER_VERSION 0
162
163 typedef void (SEC_ENTRY *SEC_GET_KEY_FN)(void *Arg, void *Principal,
164 ULONG KeyVer, void **Key, SECURITY_STATUS *Status);
165
166 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesA(PULONG pcPackages,
167 PSecPkgInfoA *ppPackageInfo);
168 SECURITY_STATUS SEC_ENTRY EnumerateSecurityPackagesW(PULONG pcPackages,
169 PSecPkgInfoW *ppPackageInfo);
170 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
171
172 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_A)(PULONG,
173 PSecPkgInfoA *);
174 typedef SECURITY_STATUS (SEC_ENTRY *ENUMERATE_SECURITY_PACKAGES_FN_W)(PULONG,
175 PSecPkgInfoW *);
176 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
177
178 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesA(
179 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
180 SECURITY_STATUS SEC_ENTRY QueryCredentialsAttributesW(
181 PCredHandle phCredential, ULONG ulAttribute, void *pBuffer);
182 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
183
184 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_A)
185 (PCredHandle, ULONG, PVOID);
186 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CREDENTIALS_ATTRIBUTES_FN_W)
187 (PCredHandle, ULONG, PVOID);
188 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
189
190 /* values for QueryCredentialsAttributes ulAttribute */
191 #define SECPKG_CRED_ATTR_NAMES 1
192
193 /* types for QueryCredentialsAttributes */
194 typedef struct _SecPkgCredentials_NamesA
195 {
196 SEC_CHAR *sUserName;
197 } SecPkgCredentials_NamesA, *PSecPkgCredentials_NamesA;
198
199 typedef struct _SecPkgCredentials_NamesW
200 {
201 SEC_WCHAR *sUserName;
202 } SecPkgCredentials_NamesW, *PSecPkgCredentials_NamesW;
203
204 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
205
206 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleA(
207 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialsUse,
208 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
209 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
210 SECURITY_STATUS SEC_ENTRY AcquireCredentialsHandleW(
211 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialsUse,
212 PLUID pvLogonID, PVOID pAuthData, SEC_GET_KEY_FN pGetKeyFn,
213 PVOID pvGetKeyArgument, PCredHandle phCredential, PTimeStamp ptsExpiry);
214 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
215
216 /* flags for fCredentialsUse */
217 #define SECPKG_CRED_INBOUND 0x00000001
218 #define SECPKG_CRED_OUTBOUND 0x00000002
219 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
220 #define SECPKG_CRED_DEFAULT 0x00000004
221 #define SECPKG_CRED_RESERVED 0xf0000000
222
223 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_A)(
224 SEC_CHAR *, SEC_CHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
225 PCredHandle, PTimeStamp);
226 typedef SECURITY_STATUS (SEC_ENTRY *ACQUIRE_CREDENTIALS_HANDLE_FN_W)(
227 SEC_WCHAR *, SEC_WCHAR *, ULONG, PLUID, PVOID, SEC_GET_KEY_FN, PVOID,
228 PCredHandle, PTimeStamp);
229 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
230
231 SECURITY_STATUS SEC_ENTRY FreeContextBuffer(PVOID pv);
232
233 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CONTEXT_BUFFER_FN)(PVOID);
234
235 SECURITY_STATUS SEC_ENTRY FreeCredentialsHandle(PCredHandle
236 phCredential);
237
238 #define FreeCredentialHandle FreeCredentialsHandle
239
240 typedef SECURITY_STATUS (SEC_ENTRY *FREE_CREDENTIALS_HANDLE_FN)(PCredHandle);
241
242 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextA(
243 PCredHandle phCredential, PCtxtHandle phContext,
244 SEC_CHAR *pszTargetName, ULONG fContextReq,
245 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
246 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
247 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
248 SECURITY_STATUS SEC_ENTRY InitializeSecurityContextW(
249 PCredHandle phCredential, PCtxtHandle phContext,
250 SEC_WCHAR *pszTargetName, ULONG fContextReq,
251 ULONG Reserved1, ULONG TargetDataRep, PSecBufferDesc pInput,
252 ULONG Reserved2, PCtxtHandle phNewContext, PSecBufferDesc pOutput,
253 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
254 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
255
256 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_A)
257 (PCredHandle, PCtxtHandle, SEC_CHAR *, ULONG, ULONG,
258 ULONG, PSecBufferDesc, ULONG, PCtxtHandle, PSecBufferDesc,
259 ULONG *, PTimeStamp);
260 typedef SECURITY_STATUS (SEC_ENTRY *INITIALIZE_SECURITY_CONTEXT_FN_W)
261 (PCredHandle, PCtxtHandle, SEC_WCHAR *, ULONG, ULONG,
262 ULONG, PSecBufferDesc, ULONG, PCtxtHandle, PSecBufferDesc,
263 ULONG *, PTimeStamp);
264 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
265
266 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
267 #define ISC_REQ_DELEGATE 0x00000001
268 #define ISC_REQ_MUTUAL_AUTH 0x00000002
269 #define ISC_REQ_REPLAY_DETECT 0x00000004
270 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
271 #define ISC_REQ_CONFIDENTIALITY 0x00000010
272 #define ISC_REQ_USE_SESSION_KEY 0x00000020
273 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
274 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
275 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
276 #define ISC_REQ_USE_DCE_STYLE 0x00000200
277 #define ISC_REQ_DATAGRAM 0x00000400
278 #define ISC_REQ_CONNECTION 0x00000800
279 #define ISC_REQ_CALL_LEVEL 0x00001000
280 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
281 #define ISC_REQ_EXTENDED_ERROR 0x00004000
282 #define ISC_REQ_STREAM 0x00008000
283 #define ISC_REQ_INTEGRITY 0x00010000
284 #define ISC_REQ_IDENTIFY 0x00020000
285 #define ISC_REQ_NULL_SESSION 0x00040000
286 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
287 #define ISC_REQ_RESERVED1 0x00100000
288 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
289
290 #define ISC_RET_DELEGATE 0x00000001
291 #define ISC_RET_MUTUAL_AUTH 0x00000002
292 #define ISC_RET_REPLAY_DETECT 0x00000004
293 #define ISC_RET_SEQUENCE_DETECT 0x00000008
294 #define ISC_RET_CONFIDENTIALITY 0x00000010
295 #define ISC_RET_USE_SESSION_KEY 0x00000020
296 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
297 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
298 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
299 #define ISC_RET_USED_DCE_STYLE 0x00000200
300 #define ISC_RET_DATAGRAM 0x00000400
301 #define ISC_RET_CONNECTION 0x00000800
302 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
303 #define ISC_RET_CALL_LEVEL 0x00002000
304 #define ISC_RET_EXTENDED_ERROR 0x00004000
305 #define ISC_RET_STREAM 0x00008000
306 #define ISC_RET_INTEGRITY 0x00010000
307 #define ISC_RET_IDENTIFY 0x00020000
308 #define ISC_RET_NULL_SESSION 0x00040000
309 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
310 #define ISC_RET_RESERVED1 0x00100000
311 #define ISC_RET_FRAGMENT_ONLY 0x00200000
312
313 SECURITY_STATUS SEC_ENTRY AcceptSecurityContext(
314 PCredHandle phCredential, PCtxtHandle phContext, PSecBufferDesc pInput,
315 ULONG fContextReq, ULONG TargetDataRep,
316 PCtxtHandle phNewContext, PSecBufferDesc pOutput,
317 ULONG *pfContextAttr, PTimeStamp ptsExpiry);
318
319 typedef SECURITY_STATUS (SEC_ENTRY *ACCEPT_SECURITY_CONTEXT_FN)(PCredHandle,
320 PCtxtHandle, PSecBufferDesc, ULONG, ULONG, PCtxtHandle,
321 PSecBufferDesc, ULONG *, PTimeStamp);
322
323 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
324 #define ASC_REQ_DELEGATE 0x00000001
325 #define ASC_REQ_MUTUAL_AUTH 0x00000002
326 #define ASC_REQ_REPLAY_DETECT 0x00000004
327 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
328 #define ASC_REQ_CONFIDENTIALITY 0x00000010
329 #define ASC_REQ_USE_SESSION_KEY 0x00000020
330 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
331 #define ASC_REQ_USE_DCE_STYLE 0x00000200
332 #define ASC_REQ_DATAGRAM 0x00000400
333 #define ASC_REQ_CONNECTION 0x00000800
334 #define ASC_REQ_CALL_LEVEL 0x00001000
335 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
336 #define ASC_REQ_EXTENDED_ERROR 0x00008000
337 #define ASC_REQ_STREAM 0x00010000
338 #define ASC_REQ_INTEGRITY 0x00020000
339 #define ASC_REQ_LICENSING 0x00040000
340 #define ASC_REQ_IDENTIFY 0x00080000
341 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
342 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
343 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
344 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
345 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
346
347 #define ASC_RET_DELEGATE 0x00000001
348 #define ASC_RET_MUTUAL_AUTH 0x00000002
349 #define ASC_RET_REPLAY_DETECT 0x00000004
350 #define ASC_RET_SEQUENCE_DETECT 0x00000008
351 #define ASC_RET_CONFIDENTIALITY 0x00000010
352 #define ASC_RET_USE_SESSION_KEY 0x00000020
353 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
354 #define ASC_RET_USED_DCE_STYLE 0x00000200
355 #define ASC_RET_DATAGRAM 0x00000400
356 #define ASC_RET_CONNECTION 0x00000800
357 #define ASC_RET_CALL_LEVEL 0x00002000
358 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
359 #define ASC_RET_EXTENDED_ERROR 0x00008000
360 #define ASC_RET_STREAM 0x00010000
361 #define ASC_RET_INTEGRITY 0x00020000
362 #define ASC_RET_LICENSING 0x00040000
363 #define ASC_RET_IDENTIFY 0x00080000
364 #define ASC_RET_NULL_SESSION 0x00100000
365 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
366 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
367 #define ASC_RET_FRAGMENT_ONLY 0x00800000
368 #define ASC_RET_NO_TOKEN 0x01000000
369
370 /*Vvalues for TargetDataRep */
371 #define SECURITY_NATIVE_DREP 0x00000010
372 #define SECURITY_NETWORK_DREP 0x00000000
373
374
375 SECURITY_STATUS SEC_ENTRY CompleteAuthToken(PCtxtHandle phContext,
376 PSecBufferDesc pToken);
377
378 typedef SECURITY_STATUS (SEC_ENTRY *COMPLETE_AUTH_TOKEN_FN)(PCtxtHandle,
379 PSecBufferDesc);
380
381 SECURITY_STATUS SEC_ENTRY DeleteSecurityContext(PCtxtHandle phContext);
382
383 typedef SECURITY_STATUS (SEC_ENTRY *DELETE_SECURITY_CONTEXT_FN)(PCtxtHandle);
384
385 SECURITY_STATUS SEC_ENTRY ApplyControlToken(PCtxtHandle phContext,
386 PSecBufferDesc pInput);
387
388 typedef SECURITY_STATUS (SEC_ENTRY *APPLY_CONTROL_TOKEN_FN)(PCtxtHandle,
389 PSecBufferDesc);
390
391 SECURITY_STATUS SEC_ENTRY QueryContextAttributesA(PCtxtHandle phContext,
392 ULONG ulAttribute, void *pBuffer);
393 SECURITY_STATUS SEC_ENTRY QueryContextAttributesW(PCtxtHandle phContext,
394 ULONG ulAttribute, void *pBuffer);
395 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
396
397 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
398 ULONG, void *);
399 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
400 ULONG, void *);
401 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
402
403 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
404 #define SECPKG_ATTR_SIZES 0
405 #define SECPKG_ATTR_NAMES 1
406 #define SECPKG_ATTR_LIFESPAN 2
407 #define SECPKG_ATTR_DCE_INFO 3
408 #define SECPKG_ATTR_STREAM_SIZES 4
409 #define SECPKG_ATTR_KEY_INFO 5
410 #define SECPKG_ATTR_AUTHORITY 6
411 #define SECPKG_ATTR_PROTO_INFO 7
412 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
413 #define SECPKG_ATTR_SESSION_KEY 9
414 #define SECPKG_ATTR_PACKAGE_INFO 10
415 #define SECPKG_ATTR_USER_FLAGS 11
416 #define SECPKG_ATTR_NEGOTIATION_INFO 12
417 #define SECPKG_ATTR_NATIVE_NAMES 13
418 #define SECPKG_ATTR_FLAGS 14
419 #define SECPKG_ATTR_USE_VALIDATED 15
420 #define SECPKG_ATTR_CREDENTIAL_NAME 16
421 #define SECPKG_ATTR_TARGET_INFORMATION 17
422 #define SECPKG_ATTR_ACCESS_TOKEN 18
423 #define SECPKG_ATTR_TARGET 19
424 #define SECPKG_ATTR_AUTHENTICATION_ID 20
425
426 /* types for QueryContextAttributes/SetContextAttributes */
427
428 typedef struct _SecPkgContext_Sizes
429 {
430 ULONG cbMaxToken;
431 ULONG cbMaxSignature;
432 ULONG cbBlockSize;
433 ULONG cbSecurityTrailer;
434 } SecPkgContext_Sizes, *PSecPkgContext_Sizes;
435
436 typedef struct _SecPkgContext_StreamSizes
437 {
438 ULONG cbHeader;
439 ULONG cbTrailer;
440 ULONG cbMaximumMessage;
441 ULONG cbBuffers;
442 ULONG cbBlockSize;
443 } SecPkgContext_StreamSizes, *PSecPkgContext_StreamSizes;
444
445 typedef struct _SecPkgContext_NamesA
446 {
447 SEC_CHAR *sUserName;
448 } SecPkgContext_NamesA, *PSecPkgContext_NamesA;
449
450 typedef struct _SecPkgContext_NamesW
451 {
452 SEC_WCHAR *sUserName;
453 } SecPkgContext_NamesW, *PSecPkgContext_NamesW;
454
455 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
456 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
457
458 typedef struct _SecPkgContext_Lifespan
459 {
460 TimeStamp tsStart;
461 TimeStamp tsExpiry;
462 } SecPkgContext_Lifespan, *PSecPkgContext_Lifespan;
463
464 typedef struct _SecPkgContext_DceInfo
465 {
466 ULONG AuthzSvc;
467 void *pPac;
468 } SecPkgContext_DceInfo, *PSecPkgContext_DceInfo;
469
470 typedef struct _SecPkgContext_KeyInfoA
471 {
472 SEC_CHAR *sSignatureAlgorithmName;
473 SEC_CHAR *sEncryptAlgorithmName;
474 ULONG KeySize;
475 ULONG SignatureAlgorithm;
476 ULONG EncryptAlgorithm;
477 } SecPkgContext_KeyInfoA, *PSecPkgContext_KeyInfoA;
478
479 typedef struct _SecPkgContext_KeyInfoW
480 {
481 SEC_WCHAR *sSignatureAlgorithmName;
482 SEC_WCHAR *sEncryptAlgorithmName;
483 ULONG KeySize;
484 ULONG SignatureAlgorithm;
485 ULONG EncryptAlgorithm;
486 } SecPkgContext_KeyInfoW, *PSecPkgContext_KeyInfoW;
487
488 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
489 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
490
491 typedef struct _SecPkgContext_AuthorityA
492 {
493 SEC_CHAR *sAuthorityName;
494 } SecPkgContext_AuthorityA, *PSecPkgContext_AuthorityA;
495
496 typedef struct _SecPkgContext_AuthorityW
497 {
498 SEC_WCHAR *sAuthorityName;
499 } SecPkgContext_AuthorityW, *PSecPkgContext_AuthorityW;
500
501 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
502 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
503
504 typedef struct _SecPkgContext_ProtoInfoA
505 {
506 SEC_CHAR *sProtocolName;
507 ULONG majorVersion;
508 ULONG minorVersion;
509 } SecPkgContext_ProtoInfoA, *PSecPkgContext_ProtoInfoA;
510
511 typedef struct _SecPkgContext_ProtoInfoW
512 {
513 SEC_WCHAR *sProtocolName;
514 ULONG majorVersion;
515 ULONG minorVersion;
516 } SecPkgContext_ProtoInfoW, *PSecPkgContext_ProtoInfoW;
517
518 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
519 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
520
521 typedef struct _SecPkgContext_PasswordExpiry
522 {
523 TimeStamp tsPasswordExpires;
524 } SecPkgContext_PasswordExpiry, *PSecPkgContext_PasswordExpiry;
525
526 typedef struct _SecPkgContext_SessionKey
527 {
528 ULONG SessionKeyLength;
529 unsigned char *SessionKey;
530 } SecPkgContext_SessionKey, *PSecPkgContext_SessionKey;
531
532 typedef struct _SecPkgContext_PackageInfoA
533 {
534 PSecPkgInfoA PackageInfo;
535 } SecPkgContext_PackageInfoA, *PSecPkgContext_PackageInfoA;
536
537 typedef struct _SecPkgContext_PackageInfoW
538 {
539 PSecPkgInfoW PackageInfo;
540 } SecPkgContext_PackageInfoW, *PSecPkgContext_PackageInfoW;
541
542 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
543 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
544
545 typedef struct _SecPkgContext_Flags
546 {
547 ULONG Flags;
548 } SecPkgContext_Flags, *PSecPkgContext_Flags;
549
550 typedef struct _SecPkgContext_UserFlags
551 {
552 ULONG UserFlags;
553 } SecPkgContext_UserFlags, *PSecPkgContext_UserFlags;
554
555 typedef struct _SecPkgContext_NegotiationInfoA
556 {
557 PSecPkgInfoA PackageInfo;
558 ULONG NegotiationState;
559 } SecPkgContext_NegotiationInfoA, *PSecPkgContext_NegotiationInfoA;
560
561 typedef struct _SecPkgContext_NegotiationInfoW
562 {
563 PSecPkgInfoW PackageInfo;
564 ULONG NegotiationState;
565 } SecPkgContext_NegotiationInfoW, *PSecPkgContext_NegotiationInfoW;
566
567 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
568 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
569
570 /* values for NegotiationState */
571 #define SECPKG_NEGOTIATION_COMPLETE 0
572 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
573 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
574 #define SECPKG_NEGOTIATION_DIRECT 3
575 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
576
577 typedef struct _SecPkgContext_NativeNamesA
578 {
579 SEC_CHAR *sClientName;
580 SEC_CHAR *sServerName;
581 } SecPkgContext_NativeNamesA, *PSecPkgContext_NativeNamesA;
582
583 typedef struct _SecPkgContext_NativeNamesW
584 {
585 SEC_WCHAR *sClientName;
586 SEC_WCHAR *sServerName;
587 } SecPkgContext_NativeNamesW, *PSecPkgContext_NativeNamesW;
588
589 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
590 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
591
592 typedef struct _SecPkgContext_CredentialNameA
593 {
594 ULONG CredentialType;
595 SEC_CHAR *sCredentialName;
596 } SecPkgContext_CredentialNameA, *PSecPkgContext_CredentialNameA;
597
598 typedef struct _SecPkgContext_CredentialNameW
599 {
600 ULONG CredentialType;
601 SEC_WCHAR *sCredentialName;
602 } SecPkgContext_CredentialNameW, *PSecPkgContext_CredentialNameW;
603
604 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
605 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
606
607 typedef struct _SecPkgContext_AccessToken
608 {
609 void *AccessToken;
610 } SecPkgContext_AccessToken, *PSecPkgContext_AccessToken;
611
612 typedef struct _SecPkgContext_TargetInformation
613 {
614 ULONG MarshalledTargetInfoLength;
615 unsigned char *MarshalledTargetInfo;
616 } SecPkgContext_TargetInformation, *PSecPkgContext_TargetInformation;
617
618 typedef struct _SecPkgContext_AuthzID
619 {
620 ULONG AuthzIDLength;
621 char *AuthzID;
622 } SecPkgContext_AuthzID, *PSecPkgContext_AuthzID;
623
624 typedef struct _SecPkgContext_Target
625 {
626 ULONG TargetLength;
627 char *Target;
628 } SecPkgContext_Target, *PSecPkgContext_Target;
629
630 SECURITY_STATUS SEC_ENTRY ImpersonateSecurityContext(PCtxtHandle phContext);
631
632 typedef SECURITY_STATUS (SEC_ENTRY *IMPERSONATE_SECURITY_CONTEXT_FN)
633 (PCtxtHandle);
634
635 SECURITY_STATUS SEC_ENTRY RevertSecurityContext(PCtxtHandle phContext);
636
637 typedef SECURITY_STATUS (SEC_ENTRY *REVERT_SECURITY_CONTEXT_FN)(PCtxtHandle);
638
639 SECURITY_STATUS SEC_ENTRY MakeSignature(PCtxtHandle phContext,
640 ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo);
641
642 typedef SECURITY_STATUS (SEC_ENTRY *MAKE_SIGNATURE_FN)(PCtxtHandle,
643 ULONG, PSecBufferDesc, ULONG);
644
645 SECURITY_STATUS SEC_ENTRY VerifySignature(PCtxtHandle phContext,
646 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
647
648 typedef SECURITY_STATUS (SEC_ENTRY *VERIFY_SIGNATURE_FN)(PCtxtHandle,
649 PSecBufferDesc, ULONG, PULONG);
650
651 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoA(
652 SEC_CHAR *pszPackageName, PSecPkgInfoA *ppPackageInfo);
653 SECURITY_STATUS SEC_ENTRY QuerySecurityPackageInfoW(
654 SEC_WCHAR *pszPackageName, PSecPkgInfoW *ppPackageInfo);
655 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
656
657 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_A)
658 (SEC_CHAR *, PSecPkgInfoA *);
659 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_PACKAGE_INFO_FN_W)
660 (SEC_WCHAR *, PSecPkgInfoW *);
661 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
662
663 SECURITY_STATUS SEC_ENTRY ExportSecurityContext(PCtxtHandle phContext,
664 ULONG fFlags, PSecBuffer pPackedContext, void **pToken);
665
666 typedef SECURITY_STATUS (SEC_ENTRY *EXPORT_SECURITY_CONTEXT_FN)(PCtxtHandle,
667 ULONG, PSecBuffer, void **);
668
669 /* values for ExportSecurityContext fFlags */
670 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
671 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
672
673 SECURITY_STATUS SEC_ENTRY ImportSecurityContextA(SEC_CHAR *pszPackage,
674 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
675 SECURITY_STATUS SEC_ENTRY ImportSecurityContextW(SEC_WCHAR *pszPackage,
676 PSecBuffer pPackedContext, void *Token, PCtxtHandle phContext);
677 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
678
679 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_A)(SEC_CHAR *,
680 PSecBuffer, void *, PCtxtHandle);
681 typedef SECURITY_STATUS (SEC_ENTRY *IMPORT_SECURITY_CONTEXT_FN_W)(SEC_WCHAR *,
682 PSecBuffer, void *, PCtxtHandle);
683 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
684
685 SECURITY_STATUS SEC_ENTRY AddCredentialsA(PCredHandle hCredentials,
686 SEC_CHAR *pszPrincipal, SEC_CHAR *pszPackage, ULONG fCredentialUse,
687 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
688 PTimeStamp ptsExpiry);
689 SECURITY_STATUS SEC_ENTRY AddCredentialsW(PCredHandle hCredentials,
690 SEC_WCHAR *pszPrincipal, SEC_WCHAR *pszPackage, ULONG fCredentialUse,
691 void *pAuthData, SEC_GET_KEY_FN pGetKeyFn, void *pvGetKeyArgument,
692 PTimeStamp ptsExpiry);
693 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
694
695 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_A)(PCredHandle,
696 SEC_CHAR *, SEC_CHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
697 PTimeStamp);
698 typedef SECURITY_STATUS (SEC_ENTRY *ADD_CREDENTIALS_FN_W)(PCredHandle,
699 SEC_WCHAR *, SEC_WCHAR *, ULONG, void *, SEC_GET_KEY_FN, void *,
700 PTimeStamp);
701
702 SECURITY_STATUS SEC_ENTRY QuerySecurityContextToken(PCtxtHandle phContext,
703 HANDLE *phToken);
704
705 typedef SECURITY_STATUS (SEC_ENTRY *QUERY_SECURITY_CONTEXT_TOKEN_FN)
706 (PCtxtHandle, HANDLE *);
707
708 SECURITY_STATUS SEC_ENTRY EncryptMessage(PCtxtHandle phContext, ULONG fQOP,
709 PSecBufferDesc pMessage, ULONG MessageSeqNo);
710 SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext,
711 PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP);
712
713 /* values for EncryptMessage fQOP */
714 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
715
716 typedef SECURITY_STATUS (SEC_ENTRY *ENCRYPT_MESSAGE_FN)(PCtxtHandle, ULONG,
717 PSecBufferDesc, ULONG);
718 typedef SECURITY_STATUS (SEC_ENTRY *DECRYPT_MESSAGE_FN)(PCtxtHandle,
719 PSecBufferDesc, ULONG, PULONG);
720
721 SECURITY_STATUS SEC_ENTRY SetContextAttributesA(PCtxtHandle phContext,
722 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
723 SECURITY_STATUS SEC_ENTRY SetContextAttributesW(PCtxtHandle phContext,
724 ULONG ulAttribute, void *pBuffer, ULONG cbBuffer);
725 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
726
727 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_A)(PCtxtHandle,
728 ULONG, void *, ULONG);
729 typedef SECURITY_STATUS (SEC_ENTRY *SET_CONTEXT_ATTRIBUTES_FN_W)(PCtxtHandle,
730 ULONG, void *, ULONG);
731
732 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
733 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
734 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
735
736 typedef struct _SECURITY_FUNCTION_TABLE_A
737 {
738 ULONG dwVersion;
739 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA;
740 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA;
741 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA;
742 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
743 void *Reserved2;
744 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA;
745 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
746 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
747 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
748 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
749 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA;
750 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
751 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
752 MAKE_SIGNATURE_FN MakeSignature;
753 VERIFY_SIGNATURE_FN VerifySignature;
754 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
755 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA;
756 void *Reserved3;
757 void *Reserved4;
758 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
759 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA;
760 ADD_CREDENTIALS_FN_A AddCredentialsA;
761 void *Reserved8;
762 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
763 ENCRYPT_MESSAGE_FN EncryptMessage;
764 DECRYPT_MESSAGE_FN DecryptMessage;
765 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA;
766 } SecurityFunctionTableA, *PSecurityFunctionTableA;
767
768 /* No, it really is FreeCredentialsHandle, see the thread beginning
769 * http://sourceforge.net/mailarchive/message.php?msg_id=4321080 for a
770 * discovery discussion. */
771 typedef struct _SECURITY_FUNCTION_TABLE_W
772 {
773 ULONG dwVersion;
774 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW;
775 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW;
776 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW;
777 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle;
778 void *Reserved2;
779 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW;
780 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext;
781 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken;
782 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext;
783 APPLY_CONTROL_TOKEN_FN ApplyControlToken;
784 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW;
785 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext;
786 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext;
787 MAKE_SIGNATURE_FN MakeSignature;
788 VERIFY_SIGNATURE_FN VerifySignature;
789 FREE_CONTEXT_BUFFER_FN FreeContextBuffer;
790 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW;
791 void *Reserved3;
792 void *Reserved4;
793 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext;
794 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW;
795 ADD_CREDENTIALS_FN_W AddCredentialsW;
796 void *Reserved8;
797 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken;
798 ENCRYPT_MESSAGE_FN EncryptMessage;
799 DECRYPT_MESSAGE_FN DecryptMessage;
800 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW;
801 } SecurityFunctionTableW, *PSecurityFunctionTableW;
802
803 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
804 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
805
806 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
807 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
808
809 PSecurityFunctionTableA SEC_ENTRY InitSecurityInterfaceA(void);
810 PSecurityFunctionTableW SEC_ENTRY InitSecurityInterfaceW(void);
811 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
812
813 typedef PSecurityFunctionTableA (SEC_ENTRY *INIT_SECURITY_INTERFACE_A)(void);
814 typedef PSecurityFunctionTableW (SEC_ENTRY *INIT_SECURITY_INTERFACE_W)(void);
815 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
816
817 #ifdef __cplusplus
818 }
819 #endif
820
821 #endif /* ndef __WINE_SSPI_H__ */