2 * Copyright (C) 2004 Juan Lang
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.
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.
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
18 #ifndef __WINE_SSPI_H__
19 #define __WINE_SSPI_H__
21 /* FIXME: #include <sdkddkver.h> */
27 #define SEC_ENTRY __stdcall
29 typedef WCHAR SEC_WCHAR
;
30 typedef CHAR SEC_CHAR
;
32 #ifndef __SECSTATUS_DEFINED__
33 #define __SECSTATUS_DEFINED__
34 typedef LONG SECURITY_STATUS
;
38 typedef SEC_WCHAR
* SECURITY_PSTR
;
39 typedef const SEC_WCHAR
* SECURITY_PCSTR
;
41 typedef SEC_CHAR
* SECURITY_PSTR
;
42 typedef const SEC_CHAR
* SECURITY_PCSTR
;
45 #ifndef __SECHANDLE_DEFINED__
46 #define __SECHANDLE_DEFINED__
47 typedef struct _SecHandle
51 } SecHandle
, *PSecHandle
;
54 #define SecInvalidateHandle(x) do { \
55 ((PSecHandle)(x))->dwLower = ((ULONG_PTR)((INT_PTR)-1)); \
56 ((PSecHandle)(x))->dwUpper = ((ULONG_PTR)((INT_PTR)-1)); \
59 #define SecIsValidHandle(x) \
60 ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)(INT_PTR)-1)) && \
61 (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)(INT_PTR)-1)))
63 typedef SecHandle CredHandle
;
64 typedef PSecHandle PCredHandle
;
66 #ifndef __WINE_CTXTHANDLE_DEFINED__
67 #define __WINE_CTXTHANDLE_DEFINED__
68 typedef SecHandle CtxtHandle
;
69 typedef PSecHandle PCtxtHandle
;
72 typedef struct _SECURITY_INTEGER
76 } SECURITY_INTEGER
, *PSECURITY_INTEGER
;
77 typedef SECURITY_INTEGER TimeStamp
, *PTimeStamp
;
79 #ifndef __UNICODE_STRING_DEFINED__
80 #define __UNICODE_STRING_DEFINED__
81 typedef struct _UNICODE_STRING
{
82 USHORT Length
; /* bytes */
83 USHORT MaximumLength
; /* bytes */
85 } UNICODE_STRING
, *PUNICODE_STRING
;
88 typedef UNICODE_STRING SECURITY_STRING
, *PSECURITY_STRING
;
90 typedef struct _SecPkgInfoA
98 } SecPkgInfoA
, *PSecPkgInfoA
;
100 typedef struct _SecPkgInfoW
108 } SecPkgInfoW
, *PSecPkgInfoW
;
110 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
111 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
113 /* fCapabilities field of SecPkgInfo */
114 #define SECPKG_FLAG_INTEGRITY 0x00000001
115 #define SECPKG_FLAG_PRIVACY 0x00000002
116 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
117 #define SECPKG_FLAG_DATAGRAM 0x00000008
118 #define SECPKG_FLAG_CONNECTION 0x00000010
119 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
120 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
121 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
122 #define SECPKG_FLAG_IMPERSONATION 0x00000100
123 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
124 #define SECPKG_FLAG_STREAM 0x00000400
125 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
126 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
127 #define SECPKG_FLAG_LOGON 0x00002000
128 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
129 #define SECPKG_FLAG_FRAGMENT 0x00008000
130 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
131 #define SECPKG_FLAG_DELEGATION 0x00020000
132 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
133 #define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000
134 #define SECPKG_FLAG_NEGO_EXTENDER 0x00100000
135 #define SECPKG_FLAG_NEGOTIABLE2 0x00200000
136 #define SECPKG_FLAG_APPCONTAINER_PASSTHROUGH 0x00400000
137 #define SECPKG_FLAG_APPCONTAINER_CHECKS 0x00800000
139 #define SECPKG_ID_NONE 0xffff
141 typedef struct _SecBuffer
146 } SecBuffer
, *PSecBuffer
;
148 /* values for BufferType */
149 #define SECBUFFER_EMPTY 0
150 #define SECBUFFER_DATA 1
151 #define SECBUFFER_TOKEN 2
152 #define SECBUFFER_PKG_PARAMS 3
153 #define SECBUFFER_MISSING 4
154 #define SECBUFFER_EXTRA 5
155 #define SECBUFFER_STREAM_TRAILER 6
156 #define SECBUFFER_STREAM_HEADER 7
157 #define SECBUFFER_NEGOTIATION_INFO 8
158 #define SECBUFFER_PADDING 9
159 #define SECBUFFER_STREAM 10
160 #define SECBUFFER_MECHLIST 11
161 #define SECBUFFER_MECHLIST_SIGNATURE 12
162 #define SECBUFFER_TARGET 13
163 #define SECBUFFER_CHANNEL_BINDINGS 14
165 #define SECBUFFER_ATTRMASK 0xf0000000
166 #define SECBUFFER_READONLY 0x80000000
167 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
168 #define SECBUFFER_RESERVED 0x60000000
170 typedef struct _SecBufferDesc
175 } SecBufferDesc
, *PSecBufferDesc
;
177 /* values for ulVersion */
178 #define SECBUFFER_VERSION 0
180 typedef void (SEC_ENTRY
*SEC_GET_KEY_FN
)(void *Arg
, void *Principal
,
181 ULONG KeyVer
, void **Key
, SECURITY_STATUS
*Status
);
183 SECURITY_STATUS SEC_ENTRY
EnumerateSecurityPackagesA(PULONG pcPackages
,
184 PSecPkgInfoA
*ppPackageInfo
);
185 SECURITY_STATUS SEC_ENTRY
EnumerateSecurityPackagesW(PULONG pcPackages
,
186 PSecPkgInfoW
*ppPackageInfo
);
187 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
189 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_A
)(PULONG
,
191 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_W
)(PULONG
,
193 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
195 SECURITY_STATUS SEC_ENTRY
QueryCredentialsAttributesA(
196 PCredHandle phCredential
, ULONG ulAttribute
, void *pBuffer
);
197 SECURITY_STATUS SEC_ENTRY
QueryCredentialsAttributesW(
198 PCredHandle phCredential
, ULONG ulAttribute
, void *pBuffer
);
199 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
201 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_A
)
202 (PCredHandle
, ULONG
, PVOID
);
203 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_W
)
204 (PCredHandle
, ULONG
, PVOID
);
205 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
207 /* values for QueryCredentialsAttributes ulAttribute */
208 #define SECPKG_CRED_ATTR_NAMES 1
210 /* types for QueryCredentialsAttributes */
211 typedef struct _SecPkgCredentials_NamesA
214 } SecPkgCredentials_NamesA
, *PSecPkgCredentials_NamesA
;
216 typedef struct _SecPkgCredentials_NamesW
218 SEC_WCHAR
*sUserName
;
219 } SecPkgCredentials_NamesW
, *PSecPkgCredentials_NamesW
;
221 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
223 SECURITY_STATUS SEC_ENTRY
AcquireCredentialsHandleA(
224 SEC_CHAR
*pszPrincipal
, SEC_CHAR
*pszPackage
, ULONG fCredentialsUse
,
225 PLUID pvLogonID
, PVOID pAuthData
, SEC_GET_KEY_FN pGetKeyFn
,
226 PVOID pvGetKeyArgument
, PCredHandle phCredential
, PTimeStamp ptsExpiry
);
227 SECURITY_STATUS SEC_ENTRY
AcquireCredentialsHandleW(
228 SEC_WCHAR
*pszPrincipal
, SEC_WCHAR
*pszPackage
, ULONG fCredentialsUse
,
229 PLUID pvLogonID
, PVOID pAuthData
, SEC_GET_KEY_FN pGetKeyFn
,
230 PVOID pvGetKeyArgument
, PCredHandle phCredential
, PTimeStamp ptsExpiry
);
231 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
233 /* flags for fCredentialsUse */
234 #define SECPKG_CRED_INBOUND 0x00000001
235 #define SECPKG_CRED_OUTBOUND 0x00000002
236 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
237 #define SECPKG_CRED_DEFAULT 0x00000004
238 #define SECPKG_CRED_RESERVED 0xf0000000
240 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_A
)(
241 SEC_CHAR
*, SEC_CHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
242 PCredHandle
, PTimeStamp
);
243 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_W
)(
244 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
245 PCredHandle
, PTimeStamp
);
246 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
248 SECURITY_STATUS SEC_ENTRY
FreeContextBuffer(PVOID pv
);
250 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CONTEXT_BUFFER_FN
)(PVOID
);
252 SECURITY_STATUS SEC_ENTRY
FreeCredentialsHandle(PCredHandle
255 #define FreeCredentialHandle FreeCredentialsHandle
257 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CREDENTIALS_HANDLE_FN
)(PCredHandle
);
259 SECURITY_STATUS SEC_ENTRY
InitializeSecurityContextA(
260 PCredHandle phCredential
, PCtxtHandle phContext
,
261 SEC_CHAR
*pszTargetName
, ULONG fContextReq
,
262 ULONG Reserved1
, ULONG TargetDataRep
, PSecBufferDesc pInput
,
263 ULONG Reserved2
, PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
264 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
265 SECURITY_STATUS SEC_ENTRY
InitializeSecurityContextW(
266 PCredHandle phCredential
, PCtxtHandle phContext
,
267 SEC_WCHAR
*pszTargetName
, ULONG fContextReq
,
268 ULONG Reserved1
, ULONG TargetDataRep
, PSecBufferDesc pInput
,
269 ULONG Reserved2
, PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
270 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
271 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
273 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_A
)
274 (PCredHandle
, PCtxtHandle
, SEC_CHAR
*, ULONG
, ULONG
, ULONG
, PSecBufferDesc
,
275 ULONG
, PCtxtHandle
, PSecBufferDesc
, ULONG
*, PTimeStamp
);
276 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_W
)
277 (PCredHandle
, PCtxtHandle
, SEC_WCHAR
*, ULONG
, ULONG
, ULONG
, PSecBufferDesc
,
278 ULONG
, PCtxtHandle
, PSecBufferDesc
, ULONG
*, PTimeStamp
);
279 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
281 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
282 #define ISC_REQ_DELEGATE 0x00000001
283 #define ISC_REQ_MUTUAL_AUTH 0x00000002
284 #define ISC_REQ_REPLAY_DETECT 0x00000004
285 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
286 #define ISC_REQ_CONFIDENTIALITY 0x00000010
287 #define ISC_REQ_USE_SESSION_KEY 0x00000020
288 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
289 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
290 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
291 #define ISC_REQ_USE_DCE_STYLE 0x00000200
292 #define ISC_REQ_DATAGRAM 0x00000400
293 #define ISC_REQ_CONNECTION 0x00000800
294 #define ISC_REQ_CALL_LEVEL 0x00001000
295 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
296 #define ISC_REQ_EXTENDED_ERROR 0x00004000
297 #define ISC_REQ_STREAM 0x00008000
298 #define ISC_REQ_INTEGRITY 0x00010000
299 #define ISC_REQ_IDENTIFY 0x00020000
300 #define ISC_REQ_NULL_SESSION 0x00040000
301 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
302 #define ISC_REQ_RESERVED1 0x00100000
303 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
305 #define ISC_RET_DELEGATE 0x00000001
306 #define ISC_RET_MUTUAL_AUTH 0x00000002
307 #define ISC_RET_REPLAY_DETECT 0x00000004
308 #define ISC_RET_SEQUENCE_DETECT 0x00000008
309 #define ISC_RET_CONFIDENTIALITY 0x00000010
310 #define ISC_RET_USE_SESSION_KEY 0x00000020
311 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
312 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
313 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
314 #define ISC_RET_USED_DCE_STYLE 0x00000200
315 #define ISC_RET_DATAGRAM 0x00000400
316 #define ISC_RET_CONNECTION 0x00000800
317 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
318 #define ISC_RET_CALL_LEVEL 0x00002000
319 #define ISC_RET_EXTENDED_ERROR 0x00004000
320 #define ISC_RET_STREAM 0x00008000
321 #define ISC_RET_INTEGRITY 0x00010000
322 #define ISC_RET_IDENTIFY 0x00020000
323 #define ISC_RET_NULL_SESSION 0x00040000
324 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
325 #define ISC_RET_RESERVED1 0x00100000
326 #define ISC_RET_FRAGMENT_ONLY 0x00200000
328 SECURITY_STATUS SEC_ENTRY
AcceptSecurityContext(
329 PCredHandle phCredential
, PCtxtHandle phContext
, PSecBufferDesc pInput
,
330 ULONG fContextReq
, ULONG TargetDataRep
,
331 PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
332 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
334 typedef SECURITY_STATUS (SEC_ENTRY
*ACCEPT_SECURITY_CONTEXT_FN
)(PCredHandle
,
335 PCtxtHandle
, PSecBufferDesc
, ULONG
, ULONG
, PCtxtHandle
,
336 PSecBufferDesc
, ULONG
*, PTimeStamp
);
338 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
339 #define ASC_REQ_DELEGATE 0x00000001
340 #define ASC_REQ_MUTUAL_AUTH 0x00000002
341 #define ASC_REQ_REPLAY_DETECT 0x00000004
342 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
343 #define ASC_REQ_CONFIDENTIALITY 0x00000010
344 #define ASC_REQ_USE_SESSION_KEY 0x00000020
345 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
346 #define ASC_REQ_USE_DCE_STYLE 0x00000200
347 #define ASC_REQ_DATAGRAM 0x00000400
348 #define ASC_REQ_CONNECTION 0x00000800
349 #define ASC_REQ_CALL_LEVEL 0x00001000
350 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
351 #define ASC_REQ_EXTENDED_ERROR 0x00008000
352 #define ASC_REQ_STREAM 0x00010000
353 #define ASC_REQ_INTEGRITY 0x00020000
354 #define ASC_REQ_LICENSING 0x00040000
355 #define ASC_REQ_IDENTIFY 0x00080000
356 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
357 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
358 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
359 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
360 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
362 #define ASC_RET_DELEGATE 0x00000001
363 #define ASC_RET_MUTUAL_AUTH 0x00000002
364 #define ASC_RET_REPLAY_DETECT 0x00000004
365 #define ASC_RET_SEQUENCE_DETECT 0x00000008
366 #define ASC_RET_CONFIDENTIALITY 0x00000010
367 #define ASC_RET_USE_SESSION_KEY 0x00000020
368 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
369 #define ASC_RET_USED_DCE_STYLE 0x00000200
370 #define ASC_RET_DATAGRAM 0x00000400
371 #define ASC_RET_CONNECTION 0x00000800
372 #define ASC_RET_CALL_LEVEL 0x00002000
373 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
374 #define ASC_RET_EXTENDED_ERROR 0x00008000
375 #define ASC_RET_STREAM 0x00010000
376 #define ASC_RET_INTEGRITY 0x00020000
377 #define ASC_RET_LICENSING 0x00040000
378 #define ASC_RET_IDENTIFY 0x00080000
379 #define ASC_RET_NULL_SESSION 0x00100000
380 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
381 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
382 #define ASC_RET_FRAGMENT_ONLY 0x00800000
383 #define ASC_RET_NO_TOKEN 0x01000000
385 /* values for TargetDataRep */
386 #define SECURITY_NATIVE_DREP 0x00000010
387 #define SECURITY_NETWORK_DREP 0x00000000
389 SECURITY_STATUS SEC_ENTRY
CompleteAuthToken(PCtxtHandle phContext
,
390 PSecBufferDesc pToken
);
392 typedef SECURITY_STATUS (SEC_ENTRY
*COMPLETE_AUTH_TOKEN_FN
)(PCtxtHandle
,
395 SECURITY_STATUS SEC_ENTRY
DeleteSecurityContext(PCtxtHandle phContext
);
397 typedef SECURITY_STATUS (SEC_ENTRY
*DELETE_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
399 SECURITY_STATUS SEC_ENTRY
ApplyControlToken(PCtxtHandle phContext
,
400 PSecBufferDesc pInput
);
402 typedef SECURITY_STATUS (SEC_ENTRY
*APPLY_CONTROL_TOKEN_FN
)(PCtxtHandle
,
405 SECURITY_STATUS SEC_ENTRY
QueryContextAttributesA(PCtxtHandle phContext
,
406 ULONG ulAttribute
, void *pBuffer
);
407 SECURITY_STATUS SEC_ENTRY
QueryContextAttributesW(PCtxtHandle phContext
,
408 ULONG ulAttribute
, void *pBuffer
);
409 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
411 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
413 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
415 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
417 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
418 #define SECPKG_ATTR_SIZES 0
419 #define SECPKG_ATTR_NAMES 1
420 #define SECPKG_ATTR_LIFESPAN 2
421 #define SECPKG_ATTR_DCE_INFO 3
422 #define SECPKG_ATTR_STREAM_SIZES 4
423 #define SECPKG_ATTR_KEY_INFO 5
424 #define SECPKG_ATTR_AUTHORITY 6
425 #define SECPKG_ATTR_PROTO_INFO 7
426 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
427 #define SECPKG_ATTR_SESSION_KEY 9
428 #define SECPKG_ATTR_PACKAGE_INFO 10
429 #define SECPKG_ATTR_USER_FLAGS 11
430 #define SECPKG_ATTR_NEGOTIATION_INFO 12
431 #define SECPKG_ATTR_NATIVE_NAMES 13
432 #define SECPKG_ATTR_FLAGS 14
433 #define SECPKG_ATTR_USE_VALIDATED 15
434 #define SECPKG_ATTR_CREDENTIAL_NAME 16
435 #define SECPKG_ATTR_TARGET_INFORMATION 17
436 #define SECPKG_ATTR_ACCESS_TOKEN 18
437 #define SECPKG_ATTR_TARGET 19
438 #define SECPKG_ATTR_AUTHENTICATION_ID 20
440 /* types for QueryContextAttributes/SetContextAttributes */
442 typedef struct _SecPkgContext_Sizes
445 ULONG cbMaxSignature
;
447 ULONG cbSecurityTrailer
;
448 } SecPkgContext_Sizes
, *PSecPkgContext_Sizes
;
450 typedef struct _SecPkgContext_StreamSizes
454 ULONG cbMaximumMessage
;
457 } SecPkgContext_StreamSizes
, *PSecPkgContext_StreamSizes
;
459 typedef struct _SecPkgContext_NamesA
462 } SecPkgContext_NamesA
, *PSecPkgContext_NamesA
;
464 typedef struct _SecPkgContext_NamesW
466 SEC_WCHAR
*sUserName
;
467 } SecPkgContext_NamesW
, *PSecPkgContext_NamesW
;
469 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
470 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
472 typedef struct _SecPkgContext_Lifespan
476 } SecPkgContext_Lifespan
, *PSecPkgContext_Lifespan
;
478 typedef struct _SecPkgContext_DceInfo
482 } SecPkgContext_DceInfo
, *PSecPkgContext_DceInfo
;
484 typedef struct _SecPkgContext_KeyInfoA
486 SEC_CHAR
*sSignatureAlgorithmName
;
487 SEC_CHAR
*sEncryptAlgorithmName
;
489 ULONG SignatureAlgorithm
;
490 ULONG EncryptAlgorithm
;
491 } SecPkgContext_KeyInfoA
, *PSecPkgContext_KeyInfoA
;
493 typedef struct _SecPkgContext_KeyInfoW
495 SEC_WCHAR
*sSignatureAlgorithmName
;
496 SEC_WCHAR
*sEncryptAlgorithmName
;
498 ULONG SignatureAlgorithm
;
499 ULONG EncryptAlgorithm
;
500 } SecPkgContext_KeyInfoW
, *PSecPkgContext_KeyInfoW
;
502 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
503 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
505 typedef struct _SecPkgContext_AuthorityA
507 SEC_CHAR
*sAuthorityName
;
508 } SecPkgContext_AuthorityA
, *PSecPkgContext_AuthorityA
;
510 typedef struct _SecPkgContext_AuthorityW
512 SEC_WCHAR
*sAuthorityName
;
513 } SecPkgContext_AuthorityW
, *PSecPkgContext_AuthorityW
;
515 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
516 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
518 typedef struct _SecPkgContext_ProtoInfoA
520 SEC_CHAR
*sProtocolName
;
523 } SecPkgContext_ProtoInfoA
, *PSecPkgContext_ProtoInfoA
;
525 typedef struct _SecPkgContext_ProtoInfoW
527 SEC_WCHAR
*sProtocolName
;
530 } SecPkgContext_ProtoInfoW
, *PSecPkgContext_ProtoInfoW
;
532 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
533 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
535 typedef struct _SecPkgContext_PasswordExpiry
537 TimeStamp tsPasswordExpires
;
538 } SecPkgContext_PasswordExpiry
, *PSecPkgContext_PasswordExpiry
;
540 typedef struct _SecPkgContext_SessionKey
542 ULONG SessionKeyLength
;
543 unsigned char *SessionKey
;
544 } SecPkgContext_SessionKey
, *PSecPkgContext_SessionKey
;
546 typedef struct _SecPkgContext_PackageInfoA
548 PSecPkgInfoA PackageInfo
;
549 } SecPkgContext_PackageInfoA
, *PSecPkgContext_PackageInfoA
;
551 typedef struct _SecPkgContext_PackageInfoW
553 PSecPkgInfoW PackageInfo
;
554 } SecPkgContext_PackageInfoW
, *PSecPkgContext_PackageInfoW
;
556 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
557 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
559 typedef struct _SecPkgContext_Flags
562 } SecPkgContext_Flags
, *PSecPkgContext_Flags
;
564 typedef struct _SecPkgContext_UserFlags
567 } SecPkgContext_UserFlags
, *PSecPkgContext_UserFlags
;
569 typedef struct _SecPkgContext_NegotiationInfoA
571 PSecPkgInfoA PackageInfo
;
572 ULONG NegotiationState
;
573 } SecPkgContext_NegotiationInfoA
, *PSecPkgContext_NegotiationInfoA
;
575 typedef struct _SecPkgContext_NegotiationInfoW
577 PSecPkgInfoW PackageInfo
;
578 ULONG NegotiationState
;
579 } SecPkgContext_NegotiationInfoW
, *PSecPkgContext_NegotiationInfoW
;
581 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
582 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
584 /* values for NegotiationState */
585 #define SECPKG_NEGOTIATION_COMPLETE 0
586 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
587 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
588 #define SECPKG_NEGOTIATION_DIRECT 3
589 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
591 typedef struct _SecPkgContext_NativeNamesA
593 SEC_CHAR
*sClientName
;
594 SEC_CHAR
*sServerName
;
595 } SecPkgContext_NativeNamesA
, *PSecPkgContext_NativeNamesA
;
597 typedef struct _SecPkgContext_NativeNamesW
599 SEC_WCHAR
*sClientName
;
600 SEC_WCHAR
*sServerName
;
601 } SecPkgContext_NativeNamesW
, *PSecPkgContext_NativeNamesW
;
603 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
604 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
606 typedef struct _SecPkgContext_CredentialNameA
608 ULONG CredentialType
;
609 SEC_CHAR
*sCredentialName
;
610 } SecPkgContext_CredentialNameA
, *PSecPkgContext_CredentialNameA
;
612 typedef struct _SecPkgContext_CredentialNameW
614 ULONG CredentialType
;
615 SEC_WCHAR
*sCredentialName
;
616 } SecPkgContext_CredentialNameW
, *PSecPkgContext_CredentialNameW
;
618 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
619 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
621 typedef struct _SecPkgContext_AccessToken
624 } SecPkgContext_AccessToken
, *PSecPkgContext_AccessToken
;
626 typedef struct _SecPkgContext_TargetInformation
628 ULONG MarshalledTargetInfoLength
;
629 unsigned char *MarshalledTargetInfo
;
630 } SecPkgContext_TargetInformation
, *PSecPkgContext_TargetInformation
;
632 typedef struct _SecPkgContext_AuthzID
636 } SecPkgContext_AuthzID
, *PSecPkgContext_AuthzID
;
638 typedef struct _SecPkgContext_Target
642 } SecPkgContext_Target
, *PSecPkgContext_Target
;
644 SECURITY_STATUS SEC_ENTRY
ImpersonateSecurityContext(PCtxtHandle phContext
);
646 typedef SECURITY_STATUS (SEC_ENTRY
*IMPERSONATE_SECURITY_CONTEXT_FN
)
649 SECURITY_STATUS SEC_ENTRY
RevertSecurityContext(PCtxtHandle phContext
);
651 typedef SECURITY_STATUS (SEC_ENTRY
*REVERT_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
653 SECURITY_STATUS SEC_ENTRY
MakeSignature(PCtxtHandle phContext
,
654 ULONG fQOP
, PSecBufferDesc pMessage
, ULONG MessageSeqNo
);
656 typedef SECURITY_STATUS (SEC_ENTRY
*MAKE_SIGNATURE_FN
)(PCtxtHandle
,
657 ULONG
, PSecBufferDesc
, ULONG
);
659 SECURITY_STATUS SEC_ENTRY
VerifySignature(PCtxtHandle phContext
,
660 PSecBufferDesc pMessage
, ULONG MessageSeqNo
, PULONG pfQOP
);
662 typedef SECURITY_STATUS (SEC_ENTRY
*VERIFY_SIGNATURE_FN
)(PCtxtHandle
,
663 PSecBufferDesc
, ULONG
, PULONG
);
665 SECURITY_STATUS SEC_ENTRY
QuerySecurityPackageInfoA(
666 SEC_CHAR
*pszPackageName
, PSecPkgInfoA
*ppPackageInfo
);
667 SECURITY_STATUS SEC_ENTRY
QuerySecurityPackageInfoW(
668 SEC_WCHAR
*pszPackageName
, PSecPkgInfoW
*ppPackageInfo
);
669 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
671 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_A
)
672 (SEC_CHAR
*, PSecPkgInfoA
*);
673 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_W
)
674 (SEC_WCHAR
*, PSecPkgInfoW
*);
675 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
677 SECURITY_STATUS SEC_ENTRY
ExportSecurityContext(PCtxtHandle phContext
,
678 ULONG fFlags
, PSecBuffer pPackedContext
, void **pToken
);
680 typedef SECURITY_STATUS (SEC_ENTRY
*EXPORT_SECURITY_CONTEXT_FN
)(PCtxtHandle
,
681 ULONG
, PSecBuffer
, void **);
683 /* values for ExportSecurityContext fFlags */
684 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
685 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
687 SECURITY_STATUS SEC_ENTRY
ImportSecurityContextA(SEC_CHAR
*pszPackage
,
688 PSecBuffer pPackedContext
, void *Token
, PCtxtHandle phContext
);
689 SECURITY_STATUS SEC_ENTRY
ImportSecurityContextW(SEC_WCHAR
*pszPackage
,
690 PSecBuffer pPackedContext
, void *Token
, PCtxtHandle phContext
);
691 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
693 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_A
)(SEC_CHAR
*,
694 PSecBuffer
, void *, PCtxtHandle
);
695 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_W
)(SEC_WCHAR
*,
696 PSecBuffer
, void *, PCtxtHandle
);
697 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
699 SECURITY_STATUS SEC_ENTRY
AddCredentialsA(PCredHandle hCredentials
,
700 SEC_CHAR
*pszPrincipal
, SEC_CHAR
*pszPackage
, ULONG fCredentialUse
,
701 void *pAuthData
, SEC_GET_KEY_FN pGetKeyFn
, void *pvGetKeyArgument
,
702 PTimeStamp ptsExpiry
);
703 SECURITY_STATUS SEC_ENTRY
AddCredentialsW(PCredHandle hCredentials
,
704 SEC_WCHAR
*pszPrincipal
, SEC_WCHAR
*pszPackage
, ULONG fCredentialUse
,
705 void *pAuthData
, SEC_GET_KEY_FN pGetKeyFn
, void *pvGetKeyArgument
,
706 PTimeStamp ptsExpiry
);
707 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
709 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_A
)(PCredHandle
,
710 SEC_CHAR
*, SEC_CHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
712 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_W
)(PCredHandle
,
713 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
716 SECURITY_STATUS SEC_ENTRY
QuerySecurityContextToken(PCtxtHandle phContext
,
719 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_CONTEXT_TOKEN_FN
)
720 (PCtxtHandle
, HANDLE
*);
722 SECURITY_STATUS SEC_ENTRY
EncryptMessage(PCtxtHandle phContext
, ULONG fQOP
,
723 PSecBufferDesc pMessage
, ULONG MessageSeqNo
);
724 SECURITY_STATUS SEC_ENTRY
DecryptMessage(PCtxtHandle phContext
,
725 PSecBufferDesc pMessage
, ULONG MessageSeqNo
, PULONG pfQOP
);
727 /* values for EncryptMessage fQOP */
728 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
730 typedef SECURITY_STATUS (SEC_ENTRY
*ENCRYPT_MESSAGE_FN
)(PCtxtHandle
, ULONG
,
731 PSecBufferDesc
, ULONG
);
732 typedef SECURITY_STATUS (SEC_ENTRY
*DECRYPT_MESSAGE_FN
)(PCtxtHandle
,
733 PSecBufferDesc
, ULONG
, PULONG
);
735 SECURITY_STATUS SEC_ENTRY
SetContextAttributesA(PCtxtHandle phContext
,
736 ULONG ulAttribute
, void *pBuffer
, ULONG cbBuffer
);
737 SECURITY_STATUS SEC_ENTRY
SetContextAttributesW(PCtxtHandle phContext
,
738 ULONG ulAttribute
, void *pBuffer
, ULONG cbBuffer
);
739 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
741 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
742 ULONG
, void *, ULONG
);
743 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
744 ULONG
, void *, ULONG
);
746 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
747 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
748 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
750 typedef struct _SECURITY_FUNCTION_TABLE_A
753 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA
;
754 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA
;
755 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA
;
756 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
758 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA
;
759 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
760 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
761 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
762 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
763 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA
;
764 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
765 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
766 MAKE_SIGNATURE_FN MakeSignature
;
767 VERIFY_SIGNATURE_FN VerifySignature
;
768 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
769 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA
;
772 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
773 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA
;
774 ADD_CREDENTIALS_FN_A AddCredentialsA
;
776 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
777 ENCRYPT_MESSAGE_FN EncryptMessage
;
778 DECRYPT_MESSAGE_FN DecryptMessage
;
779 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA
;
780 } SecurityFunctionTableA
, *PSecurityFunctionTableA
;
782 typedef struct _SECURITY_FUNCTION_TABLE_W
785 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW
;
786 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW
;
787 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW
;
788 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
790 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW
;
791 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
792 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
793 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
794 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
795 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW
;
796 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
797 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
798 MAKE_SIGNATURE_FN MakeSignature
;
799 VERIFY_SIGNATURE_FN VerifySignature
;
800 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
801 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW
;
804 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
805 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW
;
806 ADD_CREDENTIALS_FN_W AddCredentialsW
;
808 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
809 ENCRYPT_MESSAGE_FN EncryptMessage
;
810 DECRYPT_MESSAGE_FN DecryptMessage
;
811 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW
;
812 } SecurityFunctionTableW
, *PSecurityFunctionTableW
;
814 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
815 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
817 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
818 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
820 PSecurityFunctionTableA SEC_ENTRY
InitSecurityInterfaceA(void);
821 PSecurityFunctionTableW SEC_ENTRY
InitSecurityInterfaceW(void);
822 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
824 typedef PSecurityFunctionTableA (SEC_ENTRY
*INIT_SECURITY_INTERFACE_A
)(void);
825 typedef PSecurityFunctionTableW (SEC_ENTRY
*INIT_SECURITY_INTERFACE_W
)(void);
826 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
832 #endif /* ndef __WINE_SSPI_H__ */