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 __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 typedef SecHandle CtxtHandle
;
67 typedef PSecHandle PCtxtHandle
;
69 typedef struct _SECURITY_INTEGER
71 unsigned long LowPart
;
73 } SECURITY_INTEGER
, *PSECURITY_INTEGER
;
74 typedef SECURITY_INTEGER TimeStamp
, *PTimeStamp
;
76 typedef struct _SecPkgInfoA
78 unsigned long fCapabilities
;
79 unsigned short wVersion
;
80 unsigned short wRPCID
;
81 unsigned long cbMaxToken
;
84 } SecPkgInfoA
, *PSecPkgInfoA
;
86 typedef struct _SecPkgInfoW
88 unsigned long fCapabilities
;
89 unsigned short wVersion
;
90 unsigned short wRPCID
;
91 unsigned long cbMaxToken
;
94 } SecPkgInfoW
, *PSecPkgInfoW
;
96 #define SecPkgInfo WINELIB_NAME_AW(SecPkgInfo)
97 #define PSecPkgInfo WINELIB_NAME_AW(PSecPkgInfo)
99 /* fCapabilities field of SecPkgInfo */
100 #define SECPKG_FLAG_INTEGRITY 0x00000001
101 #define SECPKG_FLAG_PRIVACY 0x00000002
102 #define SECPKG_FLAG_TOKEN_ONLY 0x00000004
103 #define SECPKG_FLAG_DATAGRAM 0x00000008
104 #define SECPKG_FLAG_CONNECTION 0x00000010
105 #define SECPKG_FLAG_MULTI_REQUIRED 0x00000020
106 #define SECPKG_FLAG_CLIENT_ONLY 0x00000040
107 #define SECPKG_FLAG_EXTENDED_ERROR 0x00000080
108 #define SECPKG_FLAG_IMPERSONATION 0x00000100
109 #define SECPKG_FLAG_ACCEPT_WIN32_NAME 0x00000200
110 #define SECPKG_FLAG_STREAM 0x00000400
111 #define SECPKG_FLAG_NEGOTIABLE 0x00000800
112 #define SECPKG_FLAG_GSS_COMPATIBLE 0x00001000
113 #define SECPKG_FLAG_LOGON 0x00002000
114 #define SECPKG_FLAG_ASCII_BUFFERS 0x00004000
115 #define SECPKG_FLAG_FRAGMENT 0x00008000
116 #define SECPKG_FLAG_MUTUAL_AUTH 0x00010000
117 #define SECPKG_FLAG_DELEGATION 0x00020000
118 #define SECPKG_FLAG_READONLY_WITH_CHECKSUM 0x00040000
120 typedef struct _SecBuffer
122 unsigned long cbBuffer
;
123 unsigned long BufferType
;
125 } SecBuffer
, *PSecBuffer
;
127 /* values for BufferType */
128 #define SECBUFFER_EMPTY 0
129 #define SECBUFFER_DATA 1
130 #define SECBUFFER_TOKEN 2
131 #define SECBUFFER_PKG_PARAMS 3
132 #define SECBUFFER_MISSING 4
133 #define SECBUFFER_EXTRA 5
134 #define SECBUFFER_STREAM_TRAILER 6
135 #define SECBUFFER_HEADER 7
136 #define SECBUFFER_NEGOTIATION_INFO 8
137 #define SECBUFFER_PADDING 9
138 #define SECBUFFER_STREAM 10
139 #define SECBUFFER_MECHLIST 11
140 #define SECBUFFER_MECHLIST_SIGNATURE 12
141 #define SECBUFFER_TARGET 13
142 #define SECBUFFER_CHANNEL_BINDINGS 14
144 #define SECBUFFER_ATTRMASK 0xf0000000
145 #define SECBUFFER_READONLY 0x80000000
146 #define SECBUFFER_READONLY_WITH_CHECKSUM 0x10000000
147 #define SECBUFFER_RESERVED 0x60000000
149 typedef struct _SecBufferDesc
151 unsigned long ulVersion
;
152 unsigned long cBuffers
;
154 } SecBufferDesc
, *PSecBufferDesc
;
156 /* values for ulVersion */
157 #define SECBUFFER_VERSION 0
159 typedef void (SEC_ENTRY
*SEC_GET_KEY_FN
)(void *Arg
, void *Principal
,
160 unsigned long KeyVer
, void **Key
, SECURITY_STATUS
*Status
);
162 SECURITY_STATUS SEC_ENTRY
EnumerateSecurityPackagesA(PULONG pcPackages
,
163 PSecPkgInfoA
*ppPackageInfo
);
164 SECURITY_STATUS SEC_ENTRY
EnumerateSecurityPackagesW(PULONG pcPackages
,
165 PSecPkgInfoW
*ppPackageInfo
);
166 #define EnumerateSecurityPackages WINELIB_NAME_AW(EnumerateSecurityPackages)
168 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_A
)(PULONG
,
170 typedef SECURITY_STATUS (SEC_ENTRY
*ENUMERATE_SECURITY_PACKAGES_FN_W
)(PULONG
,
172 #define ENUMERATE_SECURITY_PACKAGES_FN WINELIB_NAME_AW(ENUMERATE_SECURITY_PACKAGES_FN_)
174 SECURITY_STATUS SEC_ENTRY
QueryCredentialsAttributesA(
175 PCredHandle phCredential
, ULONG ulAttribute
, void *pBuffer
);
176 SECURITY_STATUS SEC_ENTRY
QueryCredentialsAttributesW(
177 PCredHandle phCredential
, ULONG ulAttribute
, void *pBuffer
);
178 #define QueryCredentialsAttributes WINELIB_NAME_AW(QueryCredentialsAttributes)
180 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_A
)
181 (PCredHandle
, ULONG
, PVOID
);
182 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CREDENTIALS_ATTRIBUTES_FN_W
)
183 (PCredHandle
, ULONG
, PVOID
);
184 #define QUERY_CREDENTIALS_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CREDENTIALS_ATTRIBUTES_FN_)
186 /* values for QueryCredentialsAttributes ulAttribute */
187 #define SECPKG_CRED_ATTR_NAMES 1
189 /* types for QueryCredentialsAttributes */
190 typedef struct _SecPkgCredentials_NamesA
193 } SecPkgCredentials_NamesA
, *PSecPkgCredentials_NamesA
;
195 typedef struct _SecPkgCredentials_NamesW
197 SEC_WCHAR
*sUserName
;
198 } SecPkgCredentials_NamesW
, *PSecPkgCredentials_NamesW
;
200 #define SecPkgCredentials_Names WINELIB_NAME_AW(SecPkgCredentials_Names)
202 SECURITY_STATUS SEC_ENTRY
AcquireCredentialsHandleA(
203 SEC_CHAR
*pszPrincipal
, SEC_CHAR
*pszPackage
, ULONG fCredentialsUse
,
204 PLUID pvLogonID
, PVOID pAuthData
, SEC_GET_KEY_FN pGetKeyFn
,
205 PVOID pvGetKeyArgument
, PCredHandle phCredential
, PTimeStamp ptsExpiry
);
206 SECURITY_STATUS SEC_ENTRY
AcquireCredentialsHandleW(
207 SEC_WCHAR
*pszPrincipal
, SEC_WCHAR
*pszPackage
, ULONG fCredentialsUse
,
208 PLUID pvLogonID
, PVOID pAuthData
, SEC_GET_KEY_FN pGetKeyFn
,
209 PVOID pvGetKeyArgument
, PCredHandle phCredential
, PTimeStamp ptsExpiry
);
210 #define AcquireCredentialsHandle WINELIB_NAME_AW(AcquireCredentialsHandle)
212 /* flags for fCredentialsUse */
213 #define SECPKG_CRED_INBOUND 0x00000001
214 #define SECPKG_CRED_OUTBOUND 0x00000002
215 #define SECPKG_CRED_BOTH (SECPKG_CRED_INBOUND | SECPKG_CRED_OUTBOUND)
216 #define SECPKG_CRED_DEFAULT 0x00000004
217 #define SECPKG_CRED_RESERVED 0xf0000000
219 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_A
)(
220 SEC_CHAR
*, SEC_CHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
221 PCredHandle
, PTimeStamp
);
222 typedef SECURITY_STATUS (SEC_ENTRY
*ACQUIRE_CREDENTIALS_HANDLE_FN_W
)(
223 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, PLUID
, PVOID
, SEC_GET_KEY_FN
, PVOID
,
224 PCredHandle
, PTimeStamp
);
225 #define ACQUIRE_CREDENTIALS_HANDLE_FN WINELIB_NAME_AW(ACQUIRE_CREDENTIALS_HANDLE_FN_)
227 SECURITY_STATUS SEC_ENTRY
FreeContextBuffer(PVOID pv
);
229 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CONTEXT_BUFFER_FN
)(PVOID
);
231 SECURITY_STATUS SEC_ENTRY
FreeCredentialsHandle(PCredHandle
234 #define FreeCredentialHandle FreeCredentialsHandle
236 typedef SECURITY_STATUS (SEC_ENTRY
*FREE_CREDENTIALS_HANDLE_FN
)(PCredHandle
);
238 SECURITY_STATUS SEC_ENTRY
InitializeSecurityContextA(
239 PCredHandle phCredential
, PCtxtHandle phContext
,
240 SEC_CHAR
*pszTargetName
, ULONG fContextReq
,
241 ULONG Reserved1
, ULONG TargetDataRep
, PSecBufferDesc pInput
,
242 ULONG Reserved2
, PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
243 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
244 SECURITY_STATUS SEC_ENTRY
InitializeSecurityContextW(
245 PCredHandle phCredential
, PCtxtHandle phContext
,
246 SEC_WCHAR
*pszTargetName
, ULONG fContextReq
,
247 ULONG Reserved1
, ULONG TargetDataRep
, PSecBufferDesc pInput
,
248 ULONG Reserved2
, PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
249 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
250 #define InitializeSecurityContext WINELIB_NAME_AW(InitializeSecurityContext)
252 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_A
)
253 (PCredHandle
, PCtxtHandle
, SEC_CHAR
*, ULONG
, ULONG
, ULONG
, PSecBufferDesc
,
254 ULONG
, PCtxtHandle
, PSecBufferDesc
, ULONG
*, PTimeStamp
);
255 typedef SECURITY_STATUS (SEC_ENTRY
*INITIALIZE_SECURITY_CONTEXT_FN_W
)
256 (PCredHandle
, PCtxtHandle
, SEC_WCHAR
*, ULONG
, ULONG
, ULONG
, PSecBufferDesc
,
257 ULONG
, PCtxtHandle
, PSecBufferDesc
, ULONG
*, PTimeStamp
);
258 #define INITIALIZE_SECURITY_CONTEXT_FN WINELIB_NAME_AW(INITIALIZE_SECURITY_CONTEXT_FN_)
260 /* flags for InitializeSecurityContext fContextReq and pfContextAttr */
261 #define ISC_REQ_DELEGATE 0x00000001
262 #define ISC_REQ_MUTUAL_AUTH 0x00000002
263 #define ISC_REQ_REPLAY_DETECT 0x00000004
264 #define ISC_REQ_SEQUENCE_DETECT 0x00000008
265 #define ISC_REQ_CONFIDENTIALITY 0x00000010
266 #define ISC_REQ_USE_SESSION_KEY 0x00000020
267 #define ISC_REQ_PROMPT_FOR_CREDS 0x00000040
268 #define ISC_REQ_USE_SUPPLIED_CREDS 0x00000080
269 #define ISC_REQ_ALLOCATE_MEMORY 0x00000100
270 #define ISC_REQ_USE_DCE_STYLE 0x00000200
271 #define ISC_REQ_DATAGRAM 0x00000400
272 #define ISC_REQ_CONNECTION 0x00000800
273 #define ISC_REQ_CALL_LEVEL 0x00001000
274 #define ISC_REQ_FRAGMENT_SUPPLIED 0x00002000
275 #define ISC_REQ_EXTENDED_ERROR 0x00004000
276 #define ISC_REQ_STREAM 0x00008000
277 #define ISC_REQ_INTEGRITY 0x00010000
278 #define ISC_REQ_IDENTIFY 0x00020000
279 #define ISC_REQ_NULL_SESSION 0x00040000
280 #define ISC_REQ_MANUAL_CRED_VALIDATION 0x00080000
281 #define ISC_REQ_RESERVED1 0x00100000
282 #define ISC_REQ_FRAGMENT_TO_FIT 0x00200000
284 #define ISC_RET_DELEGATE 0x00000001
285 #define ISC_RET_MUTUAL_AUTH 0x00000002
286 #define ISC_RET_REPLAY_DETECT 0x00000004
287 #define ISC_RET_SEQUENCE_DETECT 0x00000008
288 #define ISC_RET_CONFIDENTIALITY 0x00000010
289 #define ISC_RET_USE_SESSION_KEY 0x00000020
290 #define ISC_RET_USED_COLLECTED_CREDS 0x00000040
291 #define ISC_RET_USED_SUPPLIED_CREDS 0x00000080
292 #define ISC_RET_ALLOCATED_MEMORY 0x00000100
293 #define ISC_RET_USED_DCE_STYLE 0x00000200
294 #define ISC_RET_DATAGRAM 0x00000400
295 #define ISC_RET_CONNECTION 0x00000800
296 #define ISC_RET_INTERMEDIATE_RETURN 0x00001000
297 #define ISC_RET_CALL_LEVEL 0x00002000
298 #define ISC_RET_EXTENDED_ERROR 0x00004000
299 #define ISC_RET_STREAM 0x00008000
300 #define ISC_RET_INTEGRITY 0x00010000
301 #define ISC_RET_IDENTIFY 0x00020000
302 #define ISC_RET_NULL_SESSION 0x00040000
303 #define ISC_RET_MANUAL_CRED_VALIDATION 0x00080000
304 #define ISC_RET_RESERVED1 0x00100000
305 #define ISC_RET_FRAGMENT_ONLY 0x00200000
307 SECURITY_STATUS SEC_ENTRY
AcceptSecurityContext(
308 PCredHandle phCredential
, PCtxtHandle phContext
, PSecBufferDesc pInput
,
309 ULONG fContextReq
, ULONG TargetDataRep
,
310 PCtxtHandle phNewContext
, PSecBufferDesc pOutput
,
311 ULONG
*pfContextAttr
, PTimeStamp ptsExpiry
);
313 typedef SECURITY_STATUS (SEC_ENTRY
*ACCEPT_SECURITY_CONTEXT_FN
)(PCredHandle
,
314 PCtxtHandle
, PSecBufferDesc
, ULONG
, ULONG
, PCtxtHandle
,
315 PSecBufferDesc
, ULONG
*, PTimeStamp
);
317 /* flags for AcceptSecurityContext fContextReq and pfContextAttr */
318 #define ASC_REQ_DELEGATE 0x00000001
319 #define ASC_REQ_MUTUAL_AUTH 0x00000002
320 #define ASC_REQ_REPLAY_DETECT 0x00000004
321 #define ASC_REQ_SEQUENCE_DETECT 0x00000008
322 #define ASC_REQ_CONFIDENTIALITY 0x00000010
323 #define ASC_REQ_USE_SESSION_KEY 0x00000020
324 #define ASC_REQ_ALLOCATE_MEMORY 0x00000100
325 #define ASC_REQ_USE_DCE_STYLE 0x00000200
326 #define ASC_REQ_DATAGRAM 0x00000400
327 #define ASC_REQ_CONNECTION 0x00000800
328 #define ASC_REQ_CALL_LEVEL 0x00001000
329 #define ASC_REQ_FRAGMENT_SUPPLIED 0x00002000
330 #define ASC_REQ_EXTENDED_ERROR 0x00008000
331 #define ASC_REQ_STREAM 0x00010000
332 #define ASC_REQ_INTEGRITY 0x00020000
333 #define ASC_REQ_LICENSING 0x00040000
334 #define ASC_REQ_IDENTIFY 0x00080000
335 #define ASC_REQ_ALLOW_NULL_SESSION 0x00100000
336 #define ASC_REQ_ALLOW_NON_USER_LOGONS 0x00200000
337 #define ASC_REQ_ALLOW_CONTEXT_REPLAY 0x00400000
338 #define ASC_REQ_FRAGMENT_TO_FIT 0x00800000
339 #define ASC_REQ_FRAGMENT_NO_TOKEN 0x01000000
341 #define ASC_RET_DELEGATE 0x00000001
342 #define ASC_RET_MUTUAL_AUTH 0x00000002
343 #define ASC_RET_REPLAY_DETECT 0x00000004
344 #define ASC_RET_SEQUENCE_DETECT 0x00000008
345 #define ASC_RET_CONFIDENTIALITY 0x00000010
346 #define ASC_RET_USE_SESSION_KEY 0x00000020
347 #define ASC_RET_ALLOCATED_MEMORY 0x00000100
348 #define ASC_RET_USED_DCE_STYLE 0x00000200
349 #define ASC_RET_DATAGRAM 0x00000400
350 #define ASC_RET_CONNECTION 0x00000800
351 #define ASC_RET_CALL_LEVEL 0x00002000
352 #define ASC_RET_THIRD_LEG_FAILED 0x00004000
353 #define ASC_RET_EXTENDED_ERROR 0x00008000
354 #define ASC_RET_STREAM 0x00010000
355 #define ASC_RET_INTEGRITY 0x00020000
356 #define ASC_RET_LICENSING 0x00040000
357 #define ASC_RET_IDENTIFY 0x00080000
358 #define ASC_RET_NULL_SESSION 0x00100000
359 #define ASC_RET_ALLOW_NON_USER_LOGONS 0x00200000
360 #define ASC_RET_ALLOW_CONTEXT_REPLAY 0x00400000
361 #define ASC_RET_FRAGMENT_ONLY 0x00800000
362 #define ASC_RET_NO_TOKEN 0x01000000
364 /* values for TargetDataRep */
365 #define SECURITY_NATIVE_DREP 0x00000010
366 #define SECURITY_NETWORK_DREP 0x00000000
368 SECURITY_STATUS SEC_ENTRY
CompleteAuthToken(PCtxtHandle phContext
,
369 PSecBufferDesc pToken
);
371 typedef SECURITY_STATUS (SEC_ENTRY
*COMPLETE_AUTH_TOKEN_FN
)(PCtxtHandle
,
374 SECURITY_STATUS SEC_ENTRY
DeleteSecurityContext(PCtxtHandle phContext
);
376 typedef SECURITY_STATUS (SEC_ENTRY
*DELETE_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
378 SECURITY_STATUS SEC_ENTRY
ApplyControlToken(PCtxtHandle phContext
,
379 PSecBufferDesc pInput
);
381 typedef SECURITY_STATUS (SEC_ENTRY
*APPLY_CONTROL_TOKEN_FN
)(PCtxtHandle
,
384 SECURITY_STATUS SEC_ENTRY
QueryContextAttributesA(PCtxtHandle phContext
,
385 ULONG ulAttribute
, void *pBuffer
);
386 SECURITY_STATUS SEC_ENTRY
QueryContextAttributesW(PCtxtHandle phContext
,
387 ULONG ulAttribute
, void *pBuffer
);
388 #define QueryContextAttributes WINELIB_NAME_AW(QueryContextAttributes)
390 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
392 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
394 #define QUERY_CONTEXT_ATTRIBUTES_FN WINELIB_NAME_AW(QUERY_CONTEXT_ATTRIBUTES_FN_)
396 /* values for QueryContextAttributes/SetContextAttributes ulAttribute */
397 #define SECPKG_ATTR_SIZES 0
398 #define SECPKG_ATTR_NAMES 1
399 #define SECPKG_ATTR_LIFESPAN 2
400 #define SECPKG_ATTR_DCE_INFO 3
401 #define SECPKG_ATTR_STREAM_SIZES 4
402 #define SECPKG_ATTR_KEY_INFO 5
403 #define SECPKG_ATTR_AUTHORITY 6
404 #define SECPKG_ATTR_PROTO_INFO 7
405 #define SECPKG_ATTR_PASSWORD_EXPIRY 8
406 #define SECPKG_ATTR_SESSION_KEY 9
407 #define SECPKG_ATTR_PACKAGE_INFO 10
408 #define SECPKG_ATTR_USER_FLAGS 11
409 #define SECPKG_ATTR_NEGOTIATION_INFO 12
410 #define SECPKG_ATTR_NATIVE_NAMES 13
411 #define SECPKG_ATTR_FLAGS 14
412 #define SECPKG_ATTR_USE_VALIDATED 15
413 #define SECPKG_ATTR_CREDENTIAL_NAME 16
414 #define SECPKG_ATTR_TARGET_INFORMATION 17
415 #define SECPKG_ATTR_ACCESS_TOKEN 18
416 #define SECPKG_ATTR_TARGET 19
417 #define SECPKG_ATTR_AUTHENTICATION_ID 20
419 /* types for QueryContextAttributes/SetContextAttributes */
421 typedef struct _SecPkgContext_Sizes
423 unsigned long cbMaxToken
;
424 unsigned long cbMaxSignature
;
425 unsigned long cbBlockSize
;
426 unsigned long cbSecurityTrailer
;
427 } SecPkgContext_Sizes
, *PSecPkgContext_Sizes
;
429 typedef struct _SecPkgContext_StreamSizes
431 unsigned long cbHeader
;
432 unsigned long cbTrailer
;
433 unsigned long cbMaximumMessage
;
434 unsigned long cbBuffers
;
435 unsigned long cbBlockSize
;
436 } SecPkgContext_StreamSizes
, *PSecPkgContext_StreamSizes
;
438 typedef struct _SecPkgContext_NamesA
441 } SecPkgContext_NamesA
, *PSecPkgContext_NamesA
;
443 typedef struct _SecPkgContext_NamesW
445 SEC_WCHAR
*sUserName
;
446 } SecPkgContext_NamesW
, *PSecPkgContext_NamesW
;
448 #define SecPkgContext_Names WINELIB_NAME_AW(SecPkgContext_Names)
449 #define PSecPkgContext_Names WINELIB_NAME_AW(PSecPkgContext_Names)
451 typedef struct _SecPkgContext_Lifespan
455 } SecPkgContext_Lifespan
, *PSecPkgContext_Lifespan
;
457 typedef struct _SecPkgContext_DceInfo
459 unsigned long AuthzSvc
;
461 } SecPkgContext_DceInfo
, *PSecPkgContext_DceInfo
;
463 typedef struct _SecPkgContext_KeyInfoA
465 SEC_CHAR
*sSignatureAlgorithmName
;
466 SEC_CHAR
*sEncryptAlgorithmName
;
467 unsigned long KeySize
;
468 unsigned long SignatureAlgorithm
;
469 unsigned long EncryptAlgorithm
;
470 } SecPkgContext_KeyInfoA
, *PSecPkgContext_KeyInfoA
;
472 typedef struct _SecPkgContext_KeyInfoW
474 SEC_WCHAR
*sSignatureAlgorithmName
;
475 SEC_WCHAR
*sEncryptAlgorithmName
;
476 unsigned long KeySize
;
477 unsigned long SignatureAlgorithm
;
478 unsigned long EncryptAlgorithm
;
479 } SecPkgContext_KeyInfoW
, *PSecPkgContext_KeyInfoW
;
481 #define SecPkgContext_KeyInfo WINELIB_NAME_AW(SecPkgContext_KeyInfo)
482 #define PSecPkgContext_KeyInfo WINELIB_NAME_AW(PSecPkgContext_KeyInfo)
484 typedef struct _SecPkgContext_AuthorityA
486 SEC_CHAR
*sAuthorityName
;
487 } SecPkgContext_AuthorityA
, *PSecPkgContext_AuthorityA
;
489 typedef struct _SecPkgContext_AuthorityW
491 SEC_WCHAR
*sAuthorityName
;
492 } SecPkgContext_AuthorityW
, *PSecPkgContext_AuthorityW
;
494 #define SecPkgContext_Authority WINELIB_NAME_AW(SecPkgContext_Authority)
495 #define PSecPkgContext_Authority WINELIB_NAME_AW(PSecPkgContext_Authority)
497 typedef struct _SecPkgContext_ProtoInfoA
499 SEC_CHAR
*sProtocolName
;
500 unsigned long majorVersion
;
501 unsigned long minorVersion
;
502 } SecPkgContext_ProtoInfoA
, *PSecPkgContext_ProtoInfoA
;
504 typedef struct _SecPkgContext_ProtoInfoW
506 SEC_WCHAR
*sProtocolName
;
507 unsigned long majorVersion
;
508 unsigned long minorVersion
;
509 } SecPkgContext_ProtoInfoW
, *PSecPkgContext_ProtoInfoW
;
511 #define SecPkgContext_ProtoInfo WINELIB_NAME_AW(SecPkgContext_ProtoInfo)
512 #define PSecPkgContext_ProtoInfo WINELIB_NAME_AW(PSecPkgContext_ProtoInfo)
514 typedef struct _SecPkgContext_PasswordExpiry
516 TimeStamp tsPasswordExpires
;
517 } SecPkgContext_PasswordExpiry
, *PSecPkgContext_PasswordExpiry
;
519 typedef struct _SecPkgContext_SessionKey
521 unsigned long SessionKeyLength
;
522 unsigned char *SessionKey
;
523 } SecPkgContext_SessionKey
, *PSecPkgContext_SessionKey
;
525 typedef struct _SecPkgContext_PackageInfoA
527 PSecPkgInfoA PackageInfo
;
528 } SecPkgContext_PackageInfoA
, *PSecPkgContext_PackageInfoA
;
530 typedef struct _SecPkgContext_PackageInfoW
532 PSecPkgInfoW PackageInfo
;
533 } SecPkgContext_PackageInfoW
, *PSecPkgContext_PackageInfoW
;
535 #define SecPkgContext_PackageInfo WINELIB_NAME_AW(SecPkgContext_PackageInfo)
536 #define PSecPkgContext_PackageInfo WINELIB_NAME_AW(PSecPkgContext_PackageInfo)
538 typedef struct _SecPkgContext_Flags
541 } SecPkgContext_Flags
, *PSecPkgContext_Flags
;
543 typedef struct _SecPkgContext_UserFlags
545 unsigned long UserFlags
;
546 } SecPkgContext_UserFlags
, *PSecPkgContext_UserFlags
;
548 typedef struct _SecPkgContext_NegotiationInfoA
550 PSecPkgInfoA PackageInfo
;
551 unsigned long NegotiationState
;
552 } SecPkgContext_NegotiationInfoA
, *PSecPkgContext_NegotiationInfoA
;
554 typedef struct _SecPkgContext_NegotiationInfoW
556 PSecPkgInfoW PackageInfo
;
557 unsigned long NegotiationState
;
558 } SecPkgContext_NegotiationInfoW
, *PSecPkgContext_NegotiationInfoW
;
560 #define SecPkgContext_NegotiationInfo WINELIB_NAME_AW(SecPkgContext_NegotiationInfo)
561 #define PSecPkgContext_NegotiationInfo WINELIB_NAME_AW(PSecPkgContext_NegotiationInfo)
563 /* values for NegotiationState */
564 #define SECPKG_NEGOTIATION_COMPLETE 0
565 #define SECPKG_NEGOTIATION_OPTIMISTIC 1
566 #define SECPKG_NEGOTIATION_IN_PROGRESS 2
567 #define SECPKG_NEGOTIATION_DIRECT 3
568 #define SECPKG_NEGOTIATION_TRY_MULTICRED 4
570 typedef struct _SecPkgContext_NativeNamesA
572 SEC_CHAR
*sClientName
;
573 SEC_CHAR
*sServerName
;
574 } SecPkgContext_NativeNamesA
, *PSecPkgContext_NativeNamesA
;
576 typedef struct _SecPkgContext_NativeNamesW
578 SEC_WCHAR
*sClientName
;
579 SEC_WCHAR
*sServerName
;
580 } SecPkgContext_NativeNamesW
, *PSecPkgContext_NativeNamesW
;
582 #define SecPkgContext_NativeNames WINELIB_NAME_AW(SecPkgContext_NativeNames)
583 #define PSecPkgContext_NativeNames WINELIB_NAME_AW(PSecPkgContext_NativeNames)
585 typedef struct _SecPkgContext_CredentialNameA
587 unsigned long CredentialType
;
588 SEC_CHAR
*sCredentialName
;
589 } SecPkgContext_CredentialNameA
, *PSecPkgContext_CredentialNameA
;
591 typedef struct _SecPkgContext_CredentialNameW
593 unsigned long CredentialType
;
594 SEC_WCHAR
*sCredentialName
;
595 } SecPkgContext_CredentialNameW
, *PSecPkgContext_CredentialNameW
;
597 #define SecPkgContext_CredentialName WINELIB_NAME_AW(SecPkgContext_CredentialName)
598 #define PSecPkgContext_CredentialName WINELIB_NAME_AW(PSecPkgContext_CredentialName)
600 typedef struct _SecPkgContext_AccessToken
603 } SecPkgContext_AccessToken
, *PSecPkgContext_AccessToken
;
605 typedef struct _SecPkgContext_TargetInformation
607 unsigned long MarshalledTargetInfoLength
;
608 unsigned char *MarshalledTargetInfo
;
609 } SecPkgContext_TargetInformation
, *PSecPkgContext_TargetInformation
;
611 typedef struct _SecPkgContext_AuthzID
613 unsigned long AuthzIDLength
;
615 } SecPkgContext_AuthzID
, *PSecPkgContext_AuthzID
;
617 typedef struct _SecPkgContext_Target
619 unsigned long TargetLength
;
621 } SecPkgContext_Target
, *PSecPkgContext_Target
;
623 SECURITY_STATUS SEC_ENTRY
ImpersonateSecurityContext(PCtxtHandle phContext
);
625 typedef SECURITY_STATUS (SEC_ENTRY
*IMPERSONATE_SECURITY_CONTEXT_FN
)
628 SECURITY_STATUS SEC_ENTRY
RevertSecurityContext(PCtxtHandle phContext
);
630 typedef SECURITY_STATUS (SEC_ENTRY
*REVERT_SECURITY_CONTEXT_FN
)(PCtxtHandle
);
632 SECURITY_STATUS SEC_ENTRY
MakeSignature(PCtxtHandle phContext
,
633 ULONG fQOP
, PSecBufferDesc pMessage
, ULONG MessageSeqNo
);
635 typedef SECURITY_STATUS (SEC_ENTRY
*MAKE_SIGNATURE_FN
)(PCtxtHandle
,
636 ULONG
, PSecBufferDesc
, ULONG
);
638 SECURITY_STATUS SEC_ENTRY
VerifySignature(PCtxtHandle phContext
,
639 PSecBufferDesc pMessage
, ULONG MessageSeqNo
, PULONG pfQOP
);
641 typedef SECURITY_STATUS (SEC_ENTRY
*VERIFY_SIGNATURE_FN
)(PCtxtHandle
,
642 PSecBufferDesc
, ULONG
, PULONG
);
644 SECURITY_STATUS SEC_ENTRY
QuerySecurityPackageInfoA(
645 SEC_CHAR
*pszPackageName
, PSecPkgInfoA
*ppPackageInfo
);
646 SECURITY_STATUS SEC_ENTRY
QuerySecurityPackageInfoW(
647 SEC_WCHAR
*pszPackageName
, PSecPkgInfoW
*ppPackageInfo
);
648 #define QuerySecurityPackageInfo WINELIB_NAME_AW(QuerySecurityPackageInfo)
650 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_A
)
651 (SEC_CHAR
*, PSecPkgInfoA
*);
652 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_PACKAGE_INFO_FN_W
)
653 (SEC_WCHAR
*, PSecPkgInfoW
*);
654 #define QUERY_SECURITY_PACKAGE_INFO_FN WINELIB_NAME_AW(QUERY_SECURITY_PACKAGE_INFO_FN_)
656 SECURITY_STATUS SEC_ENTRY
ExportSecurityContext(PCtxtHandle phContext
,
657 ULONG fFlags
, PSecBuffer pPackedContext
, void **pToken
);
659 typedef SECURITY_STATUS (SEC_ENTRY
*EXPORT_SECURITY_CONTEXT_FN
)(PCtxtHandle
,
660 ULONG
, PSecBuffer
, void **);
662 /* values for ExportSecurityContext fFlags */
663 #define SECPKG_CONTEXT_EXPORT_RESET_NEW 0x00000001
664 #define SECPKG_CONTEXT_EXPORT_DELETE_OLD 0x00000002
666 SECURITY_STATUS SEC_ENTRY
ImportSecurityContextA(SEC_CHAR
*pszPackage
,
667 PSecBuffer pPackedContext
, void *Token
, PCtxtHandle phContext
);
668 SECURITY_STATUS SEC_ENTRY
ImportSecurityContextW(SEC_WCHAR
*pszPackage
,
669 PSecBuffer pPackedContext
, void *Token
, PCtxtHandle phContext
);
670 #define ImportSecurityContext WINELIB_NAME_AW(ImportSecurityContext)
672 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_A
)(SEC_CHAR
*,
673 PSecBuffer
, void *, PCtxtHandle
);
674 typedef SECURITY_STATUS (SEC_ENTRY
*IMPORT_SECURITY_CONTEXT_FN_W
)(SEC_WCHAR
*,
675 PSecBuffer
, void *, PCtxtHandle
);
676 #define IMPORT_SECURITY_CONTEXT_FN WINELIB_NAME_AW(IMPORT_SECURITY_CONTEXT_FN_)
678 SECURITY_STATUS SEC_ENTRY
AddCredentialsA(PCredHandle hCredentials
,
679 SEC_CHAR
*pszPrincipal
, SEC_CHAR
*pszPackage
, ULONG fCredentialUse
,
680 void *pAuthData
, SEC_GET_KEY_FN pGetKeyFn
, void *pvGetKeyArgument
,
681 PTimeStamp ptsExpiry
);
682 SECURITY_STATUS SEC_ENTRY
AddCredentialsW(PCredHandle hCredentials
,
683 SEC_WCHAR
*pszPrincipal
, SEC_WCHAR
*pszPackage
, ULONG fCredentialUse
,
684 void *pAuthData
, SEC_GET_KEY_FN pGetKeyFn
, void *pvGetKeyArgument
,
685 PTimeStamp ptsExpiry
);
686 #define AddCredentials WINELIB_NAME_AW(AddCredentials)
688 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_A
)(PCredHandle
,
689 SEC_CHAR
*, SEC_CHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
691 typedef SECURITY_STATUS (SEC_ENTRY
*ADD_CREDENTIALS_FN_W
)(PCredHandle
,
692 SEC_WCHAR
*, SEC_WCHAR
*, ULONG
, void *, SEC_GET_KEY_FN
, void *,
695 SECURITY_STATUS SEC_ENTRY
QuerySecurityContextToken(PCtxtHandle phContext
,
698 typedef SECURITY_STATUS (SEC_ENTRY
*QUERY_SECURITY_CONTEXT_TOKEN_FN
)
699 (PCtxtHandle
, HANDLE
*);
701 SECURITY_STATUS SEC_ENTRY
EncryptMessage(PCtxtHandle phContext
, ULONG fQOP
,
702 PSecBufferDesc pMessage
, ULONG MessageSeqNo
);
703 SECURITY_STATUS SEC_ENTRY
DecryptMessage(PCtxtHandle phContext
,
704 PSecBufferDesc pMessage
, ULONG MessageSeqNo
, PULONG pfQOP
);
706 /* values for EncryptMessage fQOP */
707 #define SECQOP_WRAP_NO_ENCRYPT 0x80000001
709 typedef SECURITY_STATUS (SEC_ENTRY
*ENCRYPT_MESSAGE_FN
)(PCtxtHandle
, ULONG
,
710 PSecBufferDesc
, ULONG
);
711 typedef SECURITY_STATUS (SEC_ENTRY
*DECRYPT_MESSAGE_FN
)(PCtxtHandle
,
712 PSecBufferDesc
, ULONG
, PULONG
);
714 SECURITY_STATUS SEC_ENTRY
SetContextAttributesA(PCtxtHandle phContext
,
715 ULONG ulAttribute
, void *pBuffer
, ULONG cbBuffer
);
716 SECURITY_STATUS SEC_ENTRY
SetContextAttributesW(PCtxtHandle phContext
,
717 ULONG ulAttribute
, void *pBuffer
, ULONG cbBuffer
);
718 #define SetContextAttributes WINELIB_NAME_AW(SetContextAttributes)
720 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_A
)(PCtxtHandle
,
721 ULONG
, void *, ULONG
);
722 typedef SECURITY_STATUS (SEC_ENTRY
*SET_CONTEXT_ATTRIBUTES_FN_W
)(PCtxtHandle
,
723 ULONG
, void *, ULONG
);
725 #define SECURITY_ENTRYPOINT_ANSIA "InitSecurityInterfaceA"
726 #define SECURITY_ENTRYPOINT_ANSIW "InitSecurityInterfaceW"
727 #define SECURITY_ENTRYPOINT_ANSI WINELIB_NAME_AW(SECURITY_ENTRYPOINT_ANSI)
729 typedef struct _SECURITY_FUNCTION_TABLE_A
731 unsigned long dwVersion
;
732 ENUMERATE_SECURITY_PACKAGES_FN_A EnumerateSecurityPackagesA
;
733 QUERY_CREDENTIALS_ATTRIBUTES_FN_A QueryCredentialsAttributesA
;
734 ACQUIRE_CREDENTIALS_HANDLE_FN_A AcquireCredentialsHandleA
;
735 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
737 INITIALIZE_SECURITY_CONTEXT_FN_A InitializeSecurityContextA
;
738 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
739 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
740 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
741 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
742 QUERY_CONTEXT_ATTRIBUTES_FN_A QueryContextAttributesA
;
743 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
744 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
745 MAKE_SIGNATURE_FN MakeSignature
;
746 VERIFY_SIGNATURE_FN VerifySignature
;
747 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
748 QUERY_SECURITY_PACKAGE_INFO_FN_A QuerySecurityPackageInfoA
;
751 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
752 IMPORT_SECURITY_CONTEXT_FN_A ImportSecurityContextA
;
753 ADD_CREDENTIALS_FN_A AddCredentialsA
;
755 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
756 ENCRYPT_MESSAGE_FN EncryptMessage
;
757 DECRYPT_MESSAGE_FN DecryptMessage
;
758 SET_CONTEXT_ATTRIBUTES_FN_A SetContextAttributesA
;
759 } SecurityFunctionTableA
, *PSecurityFunctionTableA
;
761 typedef struct _SECURITY_FUNCTION_TABLE_W
763 unsigned long dwVersion
;
764 ENUMERATE_SECURITY_PACKAGES_FN_W EnumerateSecurityPackagesW
;
765 QUERY_CREDENTIALS_ATTRIBUTES_FN_W QueryCredentialsAttributesW
;
766 ACQUIRE_CREDENTIALS_HANDLE_FN_W AcquireCredentialsHandleW
;
767 FREE_CREDENTIALS_HANDLE_FN FreeCredentialsHandle
;
769 INITIALIZE_SECURITY_CONTEXT_FN_W InitializeSecurityContextW
;
770 ACCEPT_SECURITY_CONTEXT_FN AcceptSecurityContext
;
771 COMPLETE_AUTH_TOKEN_FN CompleteAuthToken
;
772 DELETE_SECURITY_CONTEXT_FN DeleteSecurityContext
;
773 APPLY_CONTROL_TOKEN_FN ApplyControlToken
;
774 QUERY_CONTEXT_ATTRIBUTES_FN_W QueryContextAttributesW
;
775 IMPERSONATE_SECURITY_CONTEXT_FN ImpersonateSecurityContext
;
776 REVERT_SECURITY_CONTEXT_FN RevertSecurityContext
;
777 MAKE_SIGNATURE_FN MakeSignature
;
778 VERIFY_SIGNATURE_FN VerifySignature
;
779 FREE_CONTEXT_BUFFER_FN FreeContextBuffer
;
780 QUERY_SECURITY_PACKAGE_INFO_FN_W QuerySecurityPackageInfoW
;
783 EXPORT_SECURITY_CONTEXT_FN ExportSecurityContext
;
784 IMPORT_SECURITY_CONTEXT_FN_W ImportSecurityContextW
;
785 ADD_CREDENTIALS_FN_W AddCredentialsW
;
787 QUERY_SECURITY_CONTEXT_TOKEN_FN QuerySecurityContextToken
;
788 ENCRYPT_MESSAGE_FN EncryptMessage
;
789 DECRYPT_MESSAGE_FN DecryptMessage
;
790 SET_CONTEXT_ATTRIBUTES_FN_W SetContextAttributesW
;
791 } SecurityFunctionTableW
, *PSecurityFunctionTableW
;
793 #define SecurityFunctionTable WINELIB_NAME_AW(SecurityFunctionTable)
794 #define PSecurityFunctionTable WINELIB_NAME_AW(PSecurityFunctionTable)
796 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION 1
797 #define SECURITY_SUPPORT_PROVIDER_INTERFACE_VERSION_2 2
799 PSecurityFunctionTableA SEC_ENTRY
InitSecurityInterfaceA(void);
800 PSecurityFunctionTableW SEC_ENTRY
InitSecurityInterfaceW(void);
801 #define InitSecurityInterface WINELIB_NAME_AW(InitSecurityInterface)
803 typedef PSecurityFunctionTableA (SEC_ENTRY
*INIT_SECURITY_INTERFACE_A
)(void);
804 typedef PSecurityFunctionTableW (SEC_ENTRY
*INIT_SECURITY_INTERFACE_W
)(void);
805 #define INIT_SECURITY_INTERFACE WINELIB_NAME_AW(INIT_SECURITY_INTERFACE_)
811 #endif /* ndef __WINE_SSPI_H__ */