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