1 /**
2  * WinPR: Windows Portable Runtime
3  * Security Support Provider Interface (SSPI)
4  *
5  * Copyright 2012-2014 Marc-Andre Moreau <marcandre.moreau@gmail.com>
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef WINPR_SSPI_PRIVATE_H
21 #define WINPR_SSPI_PRIVATE_H
22 
23 #include <winpr/sspi.h>
24 
25 #define SCHANNEL_CB_MAX_TOKEN 0x00006000
26 
27 #define SSPI_CREDENTIALS_PASSWORD_HASH 0x00000001
28 
29 #define SSPI_CREDENTIALS_HASH_LENGTH_OFFSET 512
30 
31 struct _SSPI_CREDENTIALS
32 {
33 	DWORD flags;
34 	ULONG fCredentialUse;
35 	SEC_GET_KEY_FN pGetKeyFn;
36 	void* pvGetKeyArgument;
37 	SEC_WINNT_AUTH_IDENTITY identity;
38 };
39 typedef struct _SSPI_CREDENTIALS SSPI_CREDENTIALS;
40 
41 SSPI_CREDENTIALS* sspi_CredentialsNew(void);
42 void sspi_CredentialsFree(SSPI_CREDENTIALS* credentials);
43 
44 PSecBuffer sspi_FindSecBuffer(PSecBufferDesc pMessage, ULONG BufferType);
45 
46 SecHandle* sspi_SecureHandleAlloc(void);
47 void sspi_SecureHandleInvalidate(SecHandle* handle);
48 void* sspi_SecureHandleGetLowerPointer(SecHandle* handle);
49 void sspi_SecureHandleSetLowerPointer(SecHandle* handle, void* pointer);
50 void* sspi_SecureHandleGetUpperPointer(SecHandle* handle);
51 void sspi_SecureHandleSetUpperPointer(SecHandle* handle, void* pointer);
52 void sspi_SecureHandleFree(SecHandle* handle);
53 
54 enum SecurityFunctionTableIndex
55 {
56 	EnumerateSecurityPackagesIndex = 1,
57 	Reserved1Index = 2,
58 	QueryCredentialsAttributesIndex = 3,
59 	AcquireCredentialsHandleIndex = 4,
60 	FreeCredentialsHandleIndex = 5,
61 	Reserved2Index = 6,
62 	InitializeSecurityContextIndex = 7,
63 	AcceptSecurityContextIndex = 8,
64 	CompleteAuthTokenIndex = 9,
65 	DeleteSecurityContextIndex = 10,
66 	ApplyControlTokenIndex = 11,
67 	QueryContextAttributesIndex = 12,
68 	ImpersonateSecurityContextIndex = 13,
69 	RevertSecurityContextIndex = 14,
70 	MakeSignatureIndex = 15,
71 	VerifySignatureIndex = 16,
72 	FreeContextBufferIndex = 17,
73 	QuerySecurityPackageInfoIndex = 18,
74 	Reserved3Index = 19,
75 	Reserved4Index = 20,
76 	ExportSecurityContextIndex = 21,
77 	ImportSecurityContextIndex = 22,
78 	AddCredentialsIndex = 23,
79 	Reserved8Index = 24,
80 	QuerySecurityContextTokenIndex = 25,
81 	EncryptMessageIndex = 26,
82 	DecryptMessageIndex = 27,
83 	SetContextAttributesIndex = 28
84 };
85 
86 BOOL IsSecurityStatusError(SECURITY_STATUS status);
87 
88 #include "sspi_gss.h"
89 #include "sspi_winpr.h"
90 
91 #endif /* WINPR_SSPI_PRIVATE_H */
92