quartz: Fix support for files with multiple odml indexes.
[wine/wine64.git] / dlls / secur32 / secur32_priv.h
blob6f9c1e75decc407f636d4e883477da8f5ce237d2
1 /*
2 * secur32 private definitions.
4 * Copyright (C) 2004 Juan Lang
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef __SECUR32_PRIV_H__
22 #define __SECUR32_PRIV_H__
24 #include <sys/types.h>
25 #include "wine/list.h"
27 typedef struct _SecureProvider
29 struct list entry;
30 BOOL loaded;
31 PWSTR moduleName;
32 HMODULE lib;
33 SecurityFunctionTableA fnTableA;
34 SecurityFunctionTableW fnTableW;
35 } SecureProvider;
37 typedef struct _SecurePackage
39 struct list entry;
40 SecPkgInfoW infoW;
41 SecureProvider *provider;
42 } SecurePackage;
44 typedef enum _helper_mode {
45 NTLM_SERVER,
46 NTLM_CLIENT,
47 NUM_HELPER_MODES
48 } HelperMode;
50 typedef struct tag_arc4_info {
51 unsigned char x, y;
52 unsigned char state[256];
53 } arc4_info;
55 typedef struct _NegoHelper {
56 pid_t helper_pid;
57 HelperMode mode;
58 int pipe_in;
59 int pipe_out;
60 int major;
61 int minor;
62 int micro;
63 char *com_buf;
64 int com_buf_size;
65 int com_buf_offset;
66 BYTE *session_key;
67 unsigned long neg_flags;
68 struct {
69 struct {
70 ULONG seq_num;
71 arc4_info *a4i;
72 } ntlm;
73 struct {
74 BYTE *send_sign_key;
75 BYTE *send_seal_key;
76 BYTE *recv_sign_key;
77 BYTE *recv_seal_key;
78 ULONG send_seq_no;
79 ULONG recv_seq_no;
80 arc4_info *send_a4i;
81 arc4_info *recv_a4i;
82 } ntlm2;
83 } crypt;
84 } NegoHelper, *PNegoHelper;
86 typedef enum _sign_direction {
87 NTLM_SEND,
88 NTLM_RECV
89 } SignDirection;
91 /* Allocates space for and initializes a new provider. If fnTableA or fnTableW
92 * is non-NULL, assumes the provider is built-in, and if moduleName is non-NULL,
93 * means must load the LSA/user mode functions tables from external SSP/AP module.
94 * Otherwise moduleName must not be NULL.
95 * Returns a pointer to the stored provider entry, for use adding packages.
97 SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
98 const SecurityFunctionTableW *fnTableW, PCWSTR moduleName);
100 /* Allocates space for and adds toAdd packages with the given provider.
101 * provider must not be NULL, and either infoA or infoW may be NULL, but not
102 * both.
104 void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
105 const SecPkgInfoA *infoA, const SecPkgInfoW *infoW);
107 /* Tries to find the package named packageName. If it finds it, implicitly
108 * loads the package if it isn't already loaded.
110 SecurePackage *SECUR32_findPackageW(PCWSTR packageName);
112 /* Tries to find the package named packageName. (Thunks to _findPackageW)
114 SecurePackage *SECUR32_findPackageA(PCSTR packageName);
116 /* A few string helpers; will return NULL if str is NULL. Free return with
117 * HeapFree */
118 PWSTR SECUR32_strdupW(PCWSTR str);
119 PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
120 PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
122 /* Initialization functions for built-in providers */
123 void SECUR32_initSchannelSP(void);
124 void SECUR32_initNegotiateSP(void);
125 void SECUR32_initNTLMSP(void);
127 /* Functions from dispatcher.c used elsewhere in the code */
128 SECURITY_STATUS fork_helper(PNegoHelper *new_helper, const char *prog,
129 char * const argv[]);
131 SECURITY_STATUS run_helper(PNegoHelper helper, char *buffer,
132 unsigned int max_buflen, int *buflen);
134 void cleanup_helper(PNegoHelper helper);
136 void check_version(PNegoHelper helper);
138 /* Functions from base64_codec.c used elsewhere */
139 SECURITY_STATUS encodeBase64(PBYTE in_buf, int in_len, char* out_buf,
140 int max_len, int *out_len);
142 SECURITY_STATUS decodeBase64(char *in_buf, int in_len, BYTE *out_buf,
143 int max_len, int *out_len);
145 /* Functions from util.c */
146 ULONG ComputeCrc32(const BYTE *pData, INT iLen, ULONG initial_crc);
147 SECURITY_STATUS SECUR32_CreateNTLMv1SessionKey(PBYTE password, int len, PBYTE session_key);
148 SECURITY_STATUS SECUR32_CreateNTLMv2SubKeys(PNegoHelper helper);
149 arc4_info *SECUR32_arc4Alloc(void);
150 void SECUR32_arc4Init(arc4_info *a4i, const BYTE *key, unsigned int keyLen);
151 void SECUR32_arc4Process(arc4_info *a4i, BYTE *inoutString, unsigned int length);
152 void SECUR32_arc4Cleanup(arc4_info *a4i);
154 /* NTLMSSP flags indicating the negotiated features */
155 #define NTLMSSP_NEGOTIATE_UNICODE 0x00000001
156 #define NTLMSSP_NEGOTIATE_OEM 0x00000002
157 #define NTLMSSP_REQUEST_TARGET 0x00000004
158 #define NTLMSSP_NEGOTIATE_SIGN 0x00000010
159 #define NTLMSSP_NEGOTIATE_SEAL 0x00000020
160 #define NTLMSSP_NEGOTIATE_DATAGRAM_STYLE 0x00000040
161 #define NTLMSSP_NEGOTIATE_LM_SESSION_KEY 0x00000080
162 #define NTLMSSP_NEGOTIATE_NTLM 0x00000200
163 #define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x00001000
164 #define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x00002000
165 #define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x00004000
166 #define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000
167 #define NTLMSSP_NEGOTIATE_TARGET_TYPE_DOMAIN 0x00010000
168 #define NTLMSSP_NEGOTIATE_TARGET_TYPE_SERVER 0x00020000
169 #define NTLMSSP_NEGOTIATE_NTLM2 0x00080000
170 #define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000
171 #define NTLMSSP_NEGOTIATE_128 0x20000000
172 #define NTLMSSP_NEGOTIATE_KEY_EXCHANGE 0x40000000
173 #define NTLMSSP_NEGOTIATE_56 0x80000000
174 #endif /* ndef __SECUR32_PRIV_H__ */