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__
27 #define SEC_ENTRY WINAPI
29 typedef WCHAR SEC_WCHAR
;
30 typedef CHAR SEC_CHAR
;
32 #ifndef __SECSTATUS_DEFINED__
33 #define __SECSTATUS_DEFINED__
34 typedef LONG SECURITY_STATUS
;
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_)
42 typedef SEC_WCHAR
* SECURITY_PSTR
;
43 typedef CONST SEC_WCHAR
* SECURITY_PCSTR
;
45 typedef SEC_CHAR
* SECURITY_PSTR
;
46 typedef CONST SEC_CHAR
* SECURITY_PCSTR
;
49 #ifndef __SECHANDLE_DEFINED__
50 #define __SECHANDLE_DEFINED__
51 typedef struct _SecHandle
55 } SecHandle
, *PSecHandle
;
58 #define SecInvalidateHandle(x) do { \
59 ((PSecHandle)(x))->dwLower = ((ULONG_PTR)((INT_PTR)-1)); \
60 ((PSecHandle)(x))->dwUpper = ((ULONG_PTR)((INT_PTR)-1)); \
63 #define SecIsValidHandle(x) \
64 ((((PSecHandle)(x))->dwLower != ((ULONG_PTR)(INT_PTR)-1)) && \
65 (((PSecHandle)(x))->dwUpper != ((ULONG_PTR)(INT_PTR)-1)))
67 typedef SecHandle CredHandle
;
68 typedef PSecHandle PCredHandle
;
70 typedef SecHandle CtxtHandle
;
71 typedef PSecHandle PCtxtHandle
;
73 typedef struct _SECURITY_INTEGER
77 } SECURITY_INTEGER
, *PSECURITY_INTEGER
;
78 typedef SECURITY_INTEGER TimeStamp
, *PTimeStamp
;
80 #define SSPIPFC_CREDPROV_DO_NOT_SAVE 0x00000001
81 #define SSPIPFC_NO_CHECKBOX 0x00000002
83 typedef void *PSEC_WINNT_AUTH_IDENTITY_OPAQUE
;
85 ULONG SEC_ENTRY
SspiPromptForCredentialsW(_In_ PCWSTR
, _In_opt_
void *,
86 _In_ ULONG
, _In_ PCWSTR
, _In_opt_ PSEC_WINNT_AUTH_IDENTITY_OPAQUE
,
87 _Outptr_ PSEC_WINNT_AUTH_IDENTITY_OPAQUE
*, _Inout_opt_
int *, _In_ ULONG
);
89 typedef struct _SecPkgInfoA
92 unsigned short wVersion
;
93 unsigned short wRPCID
;
97 } SecPkgInfoA
, *PSecPkgInfoA
;
99 typedef struct _SecPkgInfoW
102 unsigned short wVersion
;
103 unsigned short wRPCID
;
107 } SecPkgInfoW
, *PSecPkgInfoW
;
109 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
110 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
112 /* fCapabilities field of SecPkgInfo */
113 #define SECPKG_FLAG_INTEGRITY 0x00000001
114 #define SECPKG_FLAG_PRIVACY 0x00000002
115 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
116 #define SECPKG_FLAG_DATAGRAM 0x00000008
117 #define SECPKG_FLAG_CONNECTION 0x00000010
118 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
119 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
120 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
121 #define SECPKG_FLAG_IMPERSONATION 0x00000100
122 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
123 #define SECPKG_FLAG_STREAM 0x00000400
124 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
125 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
126 #define SECPKG_FLAG_LOGON 0x00002000
127 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
128 #define SECPKG_FLAG_FRAGMENT 0x00008000
129 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
130 #define SECPKG_FLAG_DELEGATION 0x00020000
131 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
132 #define SECPKG_FLAG_RESTRICTED_TOKENS 0x00080000
133 #define SECPKG_FLAG_NEGO_EXTENDER 0x00100000
134 #define SECPKG_FLAG_NEGOTIABLE2 0x00200000
135 #define SECPKG_FLAG_APPCONTAINER_PASSTHROUGH 0x00400000
136 #define SECPKG_FLAG_APPCONTAINER_CHECKS 0x00800000
138 typedef struct _SecBuffer
{
141 _Field_size_bytes_(cbBuffer
) void *pvBuffer
;
142 } SecBuffer
, *PSecBuffer
;
144 /* values for BufferType */
145 #define SECBUFFER_EMPTY 0
146 #define SECBUFFER_DATA 1
147 #define SECBUFFER_TOKEN 2
148 #define SECBUFFER_PKG_PARAMS 3
149 #define SECBUFFER_MISSING 4
150 #define SECBUFFER_EXTRA 5
151 #define SECBUFFER_STREAM_TRAILER 6
152 #define SECBUFFER_STREAM_HEADER 7
153 #define SECBUFFER_NEGOTIATION_INFO 8
154 #define SECBUFFER_PADDING 9
155 #define SECBUFFER_STREAM 10
156 #define SECBUFFER_MECHLIST 11
157 #define SECBUFFER_MECHLIST_SIGNATURE 12
158 #define SECBUFFER_TARGET 13
159 #define SECBUFFER_CHANNEL_BINDINGS 14
161 #define SECBUFFER_ATTRMASK 0xf0000000
162 #define SECBUFFER_READONLY 0x80000000
163 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
164 #define SECBUFFER_RESERVED 0x60000000
166 typedef struct _SecBufferDesc
{
169 _Field_size_(cBuffers
) PSecBuffer pBuffers
;
170 } SecBufferDesc
, *PSecBufferDesc
;
172 /* values for ulVersion */
173 #define SECBUFFER_VERSION 0
175 typedef void (SEC_ENTRY
*SEC_GET_KEY_FN
)(void *Arg
, void *Principal
,
176 ULONG KeyVer
, void **Key
, SECURITY_STATUS
*Status
);
180 EnumerateSecurityPackagesA(
181 _Out_ PULONG pcPackages
,
182 _Outptr_ PSecPkgInfoA
*ppPackageInfo
);
186 EnumerateSecurityPackagesW(
187 _Out_ PULONG pcPackages
,
188 _Outptr_ PSecPkgInfoW
*ppPackageInfo
);
190 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
192 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_A
)(PULONG
,
194 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_W
)(PULONG
,
196 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
200 QueryCredentialsAttributesA(
201 _In_ PCredHandle phCredential
,
202 _In_ ULONG ulAttribute
,
203 _Inout_
void *pBuffer
);
207 QueryCredentialsAttributesW(
208 _In_ PCredHandle phCredential
,
209 _In_ ULONG ulAttribute
,
210 _Inout_
void *pBuffer
);
212 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
214 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_A
)
215 (PCredHandle
, ULONG
, PVOID
);
216 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_W
)
217 (PCredHandle
, ULONG
, PVOID
);
218 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
220 /* values for QueryCredentialsAttributes ulAttribute */
221 #define SECPKG_CRED_ATTR_NAMES 1
223 /* types for QueryCredentialsAttributes */
224 typedef struct _SecPkgCredentials_NamesA
227 } SecPkgCredentials_NamesA
, *PSecPkgCredentials_NamesA
;
229 typedef struct _SecPkgCredentials_NamesW
231 SEC_WCHAR
*sUserName
;
232 } SecPkgCredentials_NamesW
, *PSecPkgCredentials_NamesW
;
234 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
238 AcquireCredentialsHandleA(
239 _In_opt_ SEC_CHAR
*pszPrincipal
,
240 _In_ SEC_CHAR
*pszPackage
,
241 _In_ ULONG fCredentialsUse
,
242 _In_opt_ PLUID pvLogonID
,
243 _In_opt_ PVOID pAuthData
,
244 _In_opt_ SEC_GET_KEY_FN pGetKeyFn
,
245 _In_opt_ PVOID pvGetKeyArgument
,
246 _Out_ PCredHandle phCredential
,
247 _Out_opt_ PTimeStamp ptsExpiry
);
251 AcquireCredentialsHandleW(
252 _In_opt_ SEC_WCHAR
*pszPrincipal
,
253 _In_ SEC_WCHAR
*pszPackage
,
254 _In_ ULONG fCredentialsUse
,
255 _In_opt_ PLUID pvLogonID
,
256 _In_opt_ PVOID pAuthData
,
257 _In_opt_ SEC_GET_KEY_FN pGetKeyFn
,
258 _In_opt_ PVOID pvGetKeyArgument
,
259 _Out_ PCredHandle phCredential
,
260 _Out_opt_ PTimeStamp ptsExpiry
);
262 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
264 /* flags for fCredentialsUse */
265 #define SECPKG_CRED_INBOUND 0x00000001
266 #define SECPKG_CRED_OUTBOUND 0x00000002
267 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
268 #define SECPKG_CRED_DEFAULT 0x00000004
269 #define SECPKG_CRED_RESERVED 0xf0000000
271 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_A
)(
272 SEC_CHAR
*, SEC_CHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
273 PCredHandle
, PTimeStamp
);
274 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_W
)(
275 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
276 PCredHandle
, PTimeStamp
);
277 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
279 SECURITY_STATUS SEC_ENTRY
FreeContextBuffer(_Inout_ PVOID pv
);
281 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CONTEXT_BUFFER_FN
)(_Inout_ PVOID
);
285 FreeCredentialsHandle(
286 _In_ PCredHandle phCredential
);
288 #define FreeCredentialHandle FreeCredentialsHandle
290 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CREDENTIALS_HANDLE_FN
)(PCredHandle
);
294 InitializeSecurityContextA(
295 _In_opt_ PCredHandle phCredential
,
296 _In_opt_ PCtxtHandle phContext
,
297 _In_opt_ SEC_CHAR
*pszTargetName
,
298 _In_ ULONG fContextReq
,
299 _In_ ULONG Reserved1
,
300 _In_ ULONG TargetDataRep
,
301 _In_opt_ PSecBufferDesc pInput
,
302 _In_ ULONG Reserved2
,
303 _Inout_opt_ PCtxtHandle phNewContext
,
304 _Inout_opt_ PSecBufferDesc pOutput
,
305 _Out_ ULONG
*pfContextAttr
,
306 _Out_opt_ PTimeStamp ptsExpiry
);
310 InitializeSecurityContextW(
311 _In_opt_ PCredHandle phCredential
,
312 _In_opt_ PCtxtHandle phContext
,
313 _In_opt_ SEC_WCHAR
*pszTargetName
,
314 _In_ ULONG fContextReq
,
315 _In_ ULONG Reserved1
,
316 _In_ ULONG TargetDataRep
,
317 _In_opt_ PSecBufferDesc pInput
,
318 _In_ ULONG Reserved2
,
319 _Inout_opt_ PCtxtHandle phNewContext
,
320 _Inout_opt_ PSecBufferDesc pOutput
,
321 _Out_ ULONG
*pfContextAttr
,
322 _Out_opt_ PTimeStamp ptsExpiry
);
324 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
326 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_A
)
327 (PCredHandle
, PCtxtHandle
, SEC_CHAR
*, ULONG
, ULONG
,
328 ULONG
, PSecBufferDesc
, ULONG
, PCtxtHandle
, PSecBufferDesc
,
329 ULONG
*, PTimeStamp
);
330 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_W
)
331 (PCredHandle
, PCtxtHandle
, SEC_WCHAR
*, ULONG
, ULONG
,
332 ULONG
, PSecBufferDesc
, ULONG
, PCtxtHandle
, PSecBufferDesc
,
333 ULONG
*, PTimeStamp
);
334 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
336 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
337 #define ISC_REQ_DELEGATE 0x00000001
338 #define ISC_REQ_MUTUAL_AUTH 0x00000002
339 #define ISC_REQ_REPLAY_DETECT 0x00000004
340 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
341 #define ISC_REQ_CONFIDENTIALITY 0x00000010
342 #define ISC_REQ_USE_SESSION_KEY 0x00000020
343 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
344 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
345 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
346 #define ISC_REQ_USE_DCE_STYLE 0x00000200
347 #define ISC_REQ_DATAGRAM 0x00000400
348 #define ISC_REQ_CONNECTION 0x00000800
349 #define ISC_REQ_CALL_LEVEL 0x00001000
350 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
351 #define ISC_REQ_EXTENDED_ERROR 0x00004000
352 #define ISC_REQ_STREAM 0x00008000
353 #define ISC_REQ_INTEGRITY 0x00010000
354 #define ISC_REQ_IDENTIFY 0x00020000
355 #define ISC_REQ_NULL_SESSION 0x00040000
356 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
357 #define ISC_REQ_RESERVED1 0x00100000
358 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
360 #define ISC_RET_DELEGATE 0x00000001
361 #define ISC_RET_MUTUAL_AUTH 0x00000002
362 #define ISC_RET_REPLAY_DETECT 0x00000004
363 #define ISC_RET_SEQUENCE_DETECT 0x00000008
364 #define ISC_RET_CONFIDENTIALITY 0x00000010
365 #define ISC_RET_USE_SESSION_KEY 0x00000020
366 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
367 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
368 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
369 #define ISC_RET_USED_DCE_STYLE 0x00000200
370 #define ISC_RET_DATAGRAM 0x00000400
371 #define ISC_RET_CONNECTION 0x00000800
372 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
373 #define ISC_RET_CALL_LEVEL 0x00002000
374 #define ISC_RET_EXTENDED_ERROR 0x00004000
375 #define ISC_RET_STREAM 0x00008000
376 #define ISC_RET_INTEGRITY 0x00010000
377 #define ISC_RET_IDENTIFY 0x00020000
378 #define ISC_RET_NULL_SESSION 0x00040000
379 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
380 #define ISC_RET_RESERVED1 0x00100000
381 #define ISC_RET_FRAGMENT_ONLY 0x00200000
385 AcceptSecurityContext(
386 _In_opt_ PCredHandle phCredential
,
387 _In_opt_ PCtxtHandle phContext
,
388 _In_opt_ PSecBufferDesc pInput
,
389 _In_ ULONG fContextReq
,
390 _In_ ULONG TargetDataRep
,
391 _Inout_opt_ PCtxtHandle phNewContext
,
392 _Inout_opt_ PSecBufferDesc pOutput
,
393 _Out_ ULONG
*pfContextAttr
,
394 _Out_opt_ PTimeStamp ptsExpiry
);
396 typedef SECURITY_STATUS (SEC_ENTRY
*ACCEPT_SECURITY_CONTEXT_FN
)(PCredHandle
,
397 PCtxtHandle
, PSecBufferDesc
, ULONG
, ULONG
, PCtxtHandle
,
398 PSecBufferDesc
, ULONG
*, PTimeStamp
);
400 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
401 #define ASC_REQ_DELEGATE 0x00000001
402 #define ASC_REQ_MUTUAL_AUTH 0x00000002
403 #define ASC_REQ_REPLAY_DETECT 0x00000004
404 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
405 #define ASC_REQ_CONFIDENTIALITY 0x00000010
406 #define ASC_REQ_USE_SESSION_KEY 0x00000020
407 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
408 #define ASC_REQ_USE_DCE_STYLE 0x00000200
409 #define ASC_REQ_DATAGRAM 0x00000400
410 #define ASC_REQ_CONNECTION 0x00000800
411 #define ASC_REQ_CALL_LEVEL 0x00001000
412 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
413 #define ASC_REQ_EXTENDED_ERROR 0x00008000
414 #define ASC_REQ_STREAM 0x00010000
415 #define ASC_REQ_INTEGRITY 0x00020000
416 #define ASC_REQ_LICENSING 0x00040000
417 #define ASC_REQ_IDENTIFY 0x00080000
418 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
419 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
420 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
421 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
422 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
424 #define ASC_RET_DELEGATE 0x00000001
425 #define ASC_RET_MUTUAL_AUTH 0x00000002
426 #define ASC_RET_REPLAY_DETECT 0x00000004
427 #define ASC_RET_SEQUENCE_DETECT 0x00000008
428 #define ASC_RET_CONFIDENTIALITY 0x00000010
429 #define ASC_RET_USE_SESSION_KEY 0x00000020
430 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
431 #define ASC_RET_USED_DCE_STYLE 0x00000200
432 #define ASC_RET_DATAGRAM 0x00000400
433 #define ASC_RET_CONNECTION 0x00000800
434 #define ASC_RET_CALL_LEVEL 0x00002000
435 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
436 #define ASC_RET_EXTENDED_ERROR 0x00008000
437 #define ASC_RET_STREAM 0x00010000
438 #define ASC_RET_INTEGRITY 0x00020000
439 #define ASC_RET_LICENSING 0x00040000
440 #define ASC_RET_IDENTIFY 0x00080000
441 #define ASC_RET_NULL_SESSION 0x00100000
442 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
443 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
444 #define ASC_RET_FRAGMENT_ONLY 0x00800000
445 #define ASC_RET_NO_TOKEN 0x01000000
447 /*Vvalues for TargetDataRep */
448 #define SECURITY_NATIVE_DREP 0x00000010
449 #define SECURITY_NETWORK_DREP 0x00000000
454 _In_ PCtxtHandle phContext
,
455 _In_ PSecBufferDesc pToken
);
457 typedef SECURITY_STATUS (SEC_ENTRY
*COMPLETE_AUTH_TOKEN_FN
)(PCtxtHandle
,
460 SECURITY_STATUS SEC_ENTRY
DeleteSecurityContext(_In_ PCtxtHandle phContext
);
462 typedef SECURITY_STATUS (SEC_ENTRY
*DELETE_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
467 _In_ PCtxtHandle phContext
,
468 _In_ PSecBufferDesc pInput
);
470 typedef SECURITY_STATUS (SEC_ENTRY
*APPLY_CONTROL_TOKEN_FN
)(PCtxtHandle
,
475 QueryContextAttributesA(
476 _In_ PCtxtHandle phContext
,
477 _In_ ULONG ulAttribute
,
478 _Out_
void *pBuffer
);
482 QueryContextAttributesW(
483 _In_ PCtxtHandle phContext
,
484 _In_ ULONG ulAttribute
,
485 _Out_
void *pBuffer
);
487 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
489 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
491 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
493 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
495 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
496 #define SECPKG_ATTR_SIZES 0
497 #define SECPKG_ATTR_NAMES 1
498 #define SECPKG_ATTR_LIFESPAN 2
499 #define SECPKG_ATTR_DCE_INFO 3
500 #define SECPKG_ATTR_STREAM_SIZES 4
501 #define SECPKG_ATTR_KEY_INFO 5
502 #define SECPKG_ATTR_AUTHORITY 6
503 #define SECPKG_ATTR_PROTO_INFO 7
504 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
505 #define SECPKG_ATTR_SESSION_KEY 9
506 #define SECPKG_ATTR_PACKAGE_INFO 10
507 #define SECPKG_ATTR_USER_FLAGS 11
508 #define SECPKG_ATTR_NEGOTIATION_INFO 12
509 #define SECPKG_ATTR_NATIVE_NAMES 13
510 #define SECPKG_ATTR_FLAGS 14
511 #define SECPKG_ATTR_USE_VALIDATED 15
512 #define SECPKG_ATTR_CREDENTIAL_NAME 16
513 #define SECPKG_ATTR_TARGET_INFORMATION 17
514 #define SECPKG_ATTR_ACCESS_TOKEN 18
515 #define SECPKG_ATTR_TARGET 19
516 #define SECPKG_ATTR_AUTHENTICATION_ID 20
518 /* types for QueryContextAttributes/SetContextAttributes */
520 typedef struct _SecPkgContext_Sizes
523 ULONG cbMaxSignature
;
525 ULONG cbSecurityTrailer
;
526 } SecPkgContext_Sizes
, *PSecPkgContext_Sizes
;
528 typedef struct _SecPkgContext_StreamSizes
532 ULONG cbMaximumMessage
;
535 } SecPkgContext_StreamSizes
, *PSecPkgContext_StreamSizes
;
537 typedef struct _SecPkgContext_NamesA
540 } SecPkgContext_NamesA
, *PSecPkgContext_NamesA
;
542 typedef struct _SecPkgContext_NamesW
544 SEC_WCHAR
*sUserName
;
545 } SecPkgContext_NamesW
, *PSecPkgContext_NamesW
;
547 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
548 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
550 typedef struct _SecPkgContext_Lifespan
554 } SecPkgContext_Lifespan
, *PSecPkgContext_Lifespan
;
556 typedef struct _SecPkgContext_DceInfo
560 } SecPkgContext_DceInfo
, *PSecPkgContext_DceInfo
;
562 typedef struct _SecPkgContext_KeyInfoA
564 SEC_CHAR
*sSignatureAlgorithmName
;
565 SEC_CHAR
*sEncryptAlgorithmName
;
567 ULONG SignatureAlgorithm
;
568 ULONG EncryptAlgorithm
;
569 } SecPkgContext_KeyInfoA
, *PSecPkgContext_KeyInfoA
;
571 typedef struct _SecPkgContext_KeyInfoW
573 SEC_WCHAR
*sSignatureAlgorithmName
;
574 SEC_WCHAR
*sEncryptAlgorithmName
;
576 ULONG SignatureAlgorithm
;
577 ULONG EncryptAlgorithm
;
578 } SecPkgContext_KeyInfoW
, *PSecPkgContext_KeyInfoW
;
580 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
581 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
583 typedef struct _SecPkgContext_AuthorityA
585 SEC_CHAR
*sAuthorityName
;
586 } SecPkgContext_AuthorityA
, *PSecPkgContext_AuthorityA
;
588 typedef struct _SecPkgContext_AuthorityW
590 SEC_WCHAR
*sAuthorityName
;
591 } SecPkgContext_AuthorityW
, *PSecPkgContext_AuthorityW
;
593 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
594 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
596 typedef struct _SecPkgContext_ProtoInfoA
598 SEC_CHAR
*sProtocolName
;
601 } SecPkgContext_ProtoInfoA
, *PSecPkgContext_ProtoInfoA
;
603 typedef struct _SecPkgContext_ProtoInfoW
605 SEC_WCHAR
*sProtocolName
;
608 } SecPkgContext_ProtoInfoW
, *PSecPkgContext_ProtoInfoW
;
610 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
611 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
613 typedef struct _SecPkgContext_PasswordExpiry
615 TimeStamp tsPasswordExpires
;
616 } SecPkgContext_PasswordExpiry
, *PSecPkgContext_PasswordExpiry
;
618 typedef struct _SecPkgContext_SessionKey
{
619 ULONG SessionKeyLength
;
620 _Field_size_bytes_(SessionKeyLength
) unsigned char *SessionKey
;
621 } SecPkgContext_SessionKey
, *PSecPkgContext_SessionKey
;
623 typedef struct _SecPkgContext_PackageInfoA
625 PSecPkgInfoA PackageInfo
;
626 } SecPkgContext_PackageInfoA
, *PSecPkgContext_PackageInfoA
;
628 typedef struct _SecPkgContext_PackageInfoW
630 PSecPkgInfoW PackageInfo
;
631 } SecPkgContext_PackageInfoW
, *PSecPkgContext_PackageInfoW
;
633 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
634 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
636 typedef struct _SecPkgContext_Flags
639 } SecPkgContext_Flags
, *PSecPkgContext_Flags
;
641 typedef struct _SecPkgContext_UserFlags
644 } SecPkgContext_UserFlags
, *PSecPkgContext_UserFlags
;
646 typedef struct _SecPkgContext_NegotiationInfoA
648 PSecPkgInfoA PackageInfo
;
649 ULONG NegotiationState
;
650 } SecPkgContext_NegotiationInfoA
, *PSecPkgContext_NegotiationInfoA
;
652 typedef struct _SecPkgContext_NegotiationInfoW
654 PSecPkgInfoW PackageInfo
;
655 ULONG NegotiationState
;
656 } SecPkgContext_NegotiationInfoW
, *PSecPkgContext_NegotiationInfoW
;
658 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
659 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
661 /* values for NegotiationState */
662 #define SECPKG_NEGOTIATION_COMPLETE 0
663 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
664 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
665 #define SECPKG_NEGOTIATION_DIRECT 3
666 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
668 typedef struct _SecPkgContext_NativeNamesA
670 SEC_CHAR
*sClientName
;
671 SEC_CHAR
*sServerName
;
672 } SecPkgContext_NativeNamesA
, *PSecPkgContext_NativeNamesA
;
674 typedef struct _SecPkgContext_NativeNamesW
676 SEC_WCHAR
*sClientName
;
677 SEC_WCHAR
*sServerName
;
678 } SecPkgContext_NativeNamesW
, *PSecPkgContext_NativeNamesW
;
680 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
681 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
683 typedef struct _SecPkgContext_CredentialNameA
685 ULONG CredentialType
;
686 SEC_CHAR
*sCredentialName
;
687 } SecPkgContext_CredentialNameA
, *PSecPkgContext_CredentialNameA
;
689 typedef struct _SecPkgContext_CredentialNameW
691 ULONG CredentialType
;
692 SEC_WCHAR
*sCredentialName
;
693 } SecPkgContext_CredentialNameW
, *PSecPkgContext_CredentialNameW
;
695 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
696 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
698 typedef struct _SecPkgContext_AccessToken
701 } SecPkgContext_AccessToken
, *PSecPkgContext_AccessToken
;
703 typedef struct _SecPkgContext_TargetInformation
705 ULONG MarshalledTargetInfoLength
;
706 unsigned char *MarshalledTargetInfo
;
707 } SecPkgContext_TargetInformation
, *PSecPkgContext_TargetInformation
;
709 typedef struct _SecPkgContext_AuthzID
713 } SecPkgContext_AuthzID
, *PSecPkgContext_AuthzID
;
715 typedef struct _SecPkgContext_Target
719 } SecPkgContext_Target
, *PSecPkgContext_Target
;
724 ImpersonateSecurityContext(
725 _In_ PCtxtHandle phContext
);
727 typedef SECURITY_STATUS (SEC_ENTRY
*IMPERSONATE_SECURITY_CONTEXT_FN
)
730 SECURITY_STATUS SEC_ENTRY
RevertSecurityContext(_In_ PCtxtHandle phContext
);
732 typedef SECURITY_STATUS (SEC_ENTRY
*REVERT_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
737 _In_ PCtxtHandle phContext
,
739 _In_ PSecBufferDesc pMessage
,
740 _In_ ULONG MessageSeqNo
);
742 typedef SECURITY_STATUS (SEC_ENTRY
*MAKE_SIGNATURE_FN
)(PCtxtHandle
,
743 ULONG
, PSecBufferDesc
, ULONG
);
748 _In_ PCtxtHandle phContext
,
749 _In_ PSecBufferDesc pMessage
,
750 _In_ ULONG MessageSeqNo
,
753 typedef SECURITY_STATUS (SEC_ENTRY
*VERIFY_SIGNATURE_FN
)(PCtxtHandle
,
754 PSecBufferDesc
, ULONG
, PULONG
);
758 QuerySecurityPackageInfoA(
759 _In_ SEC_CHAR
*pszPackageName
,
760 _Outptr_ PSecPkgInfoA
*ppPackageInfo
);
764 QuerySecurityPackageInfoW(
765 _In_ SEC_WCHAR
*pszPackageName
,
766 _Outptr_ PSecPkgInfoW
*ppPackageInfo
);
768 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
770 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_A
)
771 (SEC_CHAR
*, PSecPkgInfoA
*);
772 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_W
)
773 (SEC_WCHAR
*, PSecPkgInfoW
*);
774 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
778 ExportSecurityContext(
779 _In_ PCtxtHandle phContext
,
781 _Out_ PSecBuffer pPackedContext
,
782 _Out_
void **pToken
);
784 typedef SECURITY_STATUS (SEC_ENTRY
*EXPORT_SECURITY_CONTEXT_FN
)(PCtxtHandle
,
785 ULONG
, PSecBuffer
, void **);
787 /* values for ExportSecurityContext fFlags */
788 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
789 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
793 ImportSecurityContextA(
794 _In_ SEC_CHAR
*pszPackage
,
795 _In_ PSecBuffer pPackedContext
,
797 _Out_ PCtxtHandle phContext
);
801 ImportSecurityContextW(
802 _In_ SEC_WCHAR
*pszPackage
,
803 _In_ PSecBuffer pPackedContext
,
805 _Out_ PCtxtHandle phContext
);
807 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
809 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_A
)(SEC_CHAR
*,
810 PSecBuffer
, void *, PCtxtHandle
);
811 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_W
)(SEC_WCHAR
*,
812 PSecBuffer
, void *, PCtxtHandle
);
813 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
818 _In_ PCredHandle hCredentials
,
819 _In_opt_ SEC_CHAR
*pszPrincipal
,
820 _In_ SEC_CHAR
*pszPackage
,
821 _In_ ULONG fCredentialUse
,
822 _In_opt_
void *pAuthData
,
823 _In_opt_ SEC_GET_KEY_FN pGetKeyFn
,
824 _In_opt_
void *pvGetKeyArgument
,
825 _Out_opt_ PTimeStamp ptsExpiry
);
830 _In_ PCredHandle hCredentials
,
831 _In_opt_ SEC_WCHAR
*pszPrincipal
,
832 _In_ SEC_WCHAR
*pszPackage
,
833 _In_ ULONG fCredentialUse
,
834 _In_opt_
void *pAuthData
,
835 _In_opt_ SEC_GET_KEY_FN pGetKeyFn
,
836 _In_opt_
void *pvGetKeyArgument
,
837 _Out_opt_ PTimeStamp ptsExpiry
);
839 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
841 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_A
)(PCredHandle
,
842 SEC_CHAR
*, SEC_CHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
844 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_W
)(PCredHandle
,
845 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
850 QuerySecurityContextToken(
851 _In_ PCtxtHandle phContext
,
852 _Out_ HANDLE
*phToken
);
854 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_CONTEXT_TOKEN_FN
)
855 (PCtxtHandle
, HANDLE
*);
860 _In_ PCtxtHandle phContext
,
862 _In_ PSecBufferDesc pMessage
,
863 _In_ ULONG MessageSeqNo
);
868 _In_ PCtxtHandle phContext
,
869 _In_ PSecBufferDesc pMessage
,
870 _In_ ULONG MessageSeqNo
,
871 _Out_opt_ PULONG pfQOP
);
873 /* values for EncryptMessage fQOP */
874 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
876 typedef SECURITY_STATUS (SEC_ENTRY
*ENCRYPT_MESSAGE_FN
)(PCtxtHandle
, ULONG
,
877 PSecBufferDesc
, ULONG
);
878 typedef SECURITY_STATUS (SEC_ENTRY
*DECRYPT_MESSAGE_FN
)(PCtxtHandle
,
879 PSecBufferDesc
, ULONG
, PULONG
);
883 SetContextAttributesA(
884 _In_ PCtxtHandle phContext
,
885 _In_ ULONG ulAttribute
,
886 _In_reads_bytes_(cbBuffer
) void *pBuffer
,
887 _In_ ULONG cbBuffer
);
891 SetContextAttributesW(
892 _In_ PCtxtHandle phContext
,
893 _In_ ULONG ulAttribute
,
894 _In_reads_bytes_(cbBuffer
) void *pBuffer
,
895 _In_ ULONG cbBuffer
);
897 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
899 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
900 ULONG
, void *, ULONG
);
901 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
902 ULONG
, void *, ULONG
);
904 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
905 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
906 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
908 typedef struct _SECURITY_FUNCTION_TABLE_A
911 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA
;
912 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA
;
913 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA
;
914 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
916 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA
;
917 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
918 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
919 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
920 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
921 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA
;
922 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
923 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
924 MAKE_SIGNATURE_FN MakeSignature
;
925 VERIFY_SIGNATURE_FN VerifySignature
;
926 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
927 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA
;
930 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
931 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA
;
932 ADD_CREDENTIALS_FN_A AddCredentialsA
;
934 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
935 ENCRYPT_MESSAGE_FN EncryptMessage
;
936 DECRYPT_MESSAGE_FN DecryptMessage
;
937 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA
;
938 } SecurityFunctionTableA
, *PSecurityFunctionTableA
;
940 /* No, it really is FreeCredentialsHandle, see the thread beginning
941 * http://sourceforge.net/mailarchive/message.php?msg_id=4321080 for a
942 * discovery discussion. */
943 typedef struct _SECURITY_FUNCTION_TABLE_W
946 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW
;
947 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW
;
948 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW
;
949 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
951 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW
;
952 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
953 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
954 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
955 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
956 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW
;
957 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
958 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
959 MAKE_SIGNATURE_FN MakeSignature
;
960 VERIFY_SIGNATURE_FN VerifySignature
;
961 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
962 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW
;
965 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
966 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW
;
967 ADD_CREDENTIALS_FN_W AddCredentialsW
;
969 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
970 ENCRYPT_MESSAGE_FN EncryptMessage
;
971 DECRYPT_MESSAGE_FN DecryptMessage
;
972 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW
;
973 } SecurityFunctionTableW
, *PSecurityFunctionTableW
;
975 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
976 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
978 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
979 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
981 PSecurityFunctionTableA SEC_ENTRY
InitSecurityInterfaceA(void);
982 PSecurityFunctionTableW SEC_ENTRY
InitSecurityInterfaceW(void);
983 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
985 typedef PSecurityFunctionTableA (SEC_ENTRY
*INIT_SECURITY_INTERFACE_A
)(void);
986 typedef PSecurityFunctionTableW (SEC_ENTRY
*INIT_SECURITY_INTERFACE_W
)(void);
987 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
993 #endif /* ndef __WINE_SSPI_H__ */