source: trunk/src/secur32/secur32_priv.h@ 22015

Last change on this file since 22015 was 21916, checked in by dmik, 14 years ago

Merge branch gcc-kmk to trunk.

File size: 6.2 KB
Line 
1/*
2 * secur32 private definitions.
3 *
4 * Copyright (C) 2004 Juan Lang
5 *
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.
10 *
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.
15 *
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
19 */
20
21#ifndef __SECUR32_PRIV_H__
22#define __SECUR32_PRIV_H__
23
24#include <sys/types.h>
25#include "wine/list.h"
26
27#ifndef __EMX__
28typedef ULONG pid_t;
29#endif
30
31typedef struct _SecureProvider
32{
33 struct list entry;
34 BOOL loaded;
35 PWSTR moduleName;
36 HMODULE lib;
37 SecurityFunctionTableA fnTableA;
38 SecurityFunctionTableW fnTableW;
39} SecureProvider;
40
41typedef struct _SecurePackage
42{
43 struct list entry;
44 SecPkgInfoW infoW;
45 SecureProvider *provider;
46} SecurePackage;
47
48typedef enum _helper_mode {
49 NTLM_SERVER,
50 NTLM_CLIENT,
51 NUM_HELPER_MODES
52} HelperMode;
53
54typedef struct tag_arc4_info {
55 unsigned char x, y;
56 unsigned char state[256];
57} arc4_info;
58
59typedef struct _NegoHelper {
60 pid_t helper_pid;
61 HelperMode mode;
62 int pipe_in;
63 int pipe_out;
64 int major;
65 int minor;
66 int micro;
67 char *com_buf;
68 int com_buf_size;
69 int com_buf_offset;
70 BYTE *session_key;
71 unsigned long neg_flags;
72 struct {
73 struct {
74 ULONG seq_num;
75 arc4_info *a4i;
76 } ntlm;
77 struct {
78 BYTE *send_sign_key;
79 BYTE *send_seal_key;
80 BYTE *recv_sign_key;
81 BYTE *recv_seal_key;
82 ULONG send_seq_no;
83 ULONG recv_seq_no;
84 arc4_info *send_a4i;
85 arc4_info *recv_a4i;
86 } ntlm2;
87 } crypt;
88} NegoHelper, *PNegoHelper;
89
90typedef enum _sign_direction {
91 NTLM_SEND,
92 NTLM_RECV
93} SignDirection;
94
95/* Allocates space for and initializes a new provider. If fnTableA or fnTableW
96 * is non-NULL, assumes the provider is built-in, and if moduleName is non-NULL,
97 * means must load the LSA/user mode functions tables from external SSP/AP module.
98 * Otherwise moduleName must not be NULL.
99 * Returns a pointer to the stored provider entry, for use adding packages.
100 */
101SecureProvider *SECUR32_addProvider(const SecurityFunctionTableA *fnTableA,
102 const SecurityFunctionTableW *fnTableW, PCWSTR moduleName);
103
104/* Allocates space for and adds toAdd packages with the given provider.
105 * provider must not be NULL, and either infoA or infoW may be NULL, but not
106 * both.
107 */
108void SECUR32_addPackages(SecureProvider *provider, ULONG toAdd,
109 const SecPkgInfoA *infoA, const SecPkgInfoW *infoW);
110
111/* Tries to find the package named packageName. If it finds it, implicitly
112 * loads the package if it isn't already loaded.
113 */
114SecurePackage *SECUR32_findPackageW(PCWSTR packageName);
115
116/* Tries to find the package named packageName. (Thunks to _findPackageW)
117 */
118SecurePackage *SECUR32_findPackageA(PCSTR packageName);
119
120/* A few string helpers; will return NULL if str is NULL. Free return with
121 * HeapFree */
122PWSTR SECUR32_strdupW(PCWSTR str);
123PWSTR SECUR32_AllocWideFromMultiByte(PCSTR str);
124PSTR SECUR32_AllocMultiByteFromWide(PCWSTR str);
125
126/* Initialization functions for built-in providers */
127void SECUR32_initSchannelSP(void);
128void SECUR32_initNegotiateSP(void);
129void SECUR32_initNTLMSP(void);
130
131/* Cleanup functions for built-in providers */
132void SECUR32_deinitSchannelSP(void);
133
134/* Functions from dispatcher.c used elsewhere in the code */
135SECURITY_STATUS fork_helper(PNegoHelper *new_helper, const char *prog,
136 char * const argv[]);
137
138SECURITY_STATUS run_helper(PNegoHelper helper, char *buffer,
139 unsigned int max_buflen, int *buflen);
140
141void cleanup_helper(PNegoHelper helper);
142
143void check_version(PNegoHelper helper);
144
145/* Functions from base64_codec.c used elsewhere */
146SECURITY_STATUS encodeBase64(PBYTE in_buf, int in_len, char* out_buf,
147 int max_len, int *out_len);
148
149SECURITY_STATUS decodeBase64(char *in_buf, int in_len, BYTE *out_buf,
150 int max_len, int *out_len);
151
152/* Functions from util.c */
153ULONG ComputeCrc32(const BYTE *pData, INT iLen, ULONG initial_crc);
154SECURITY_STATUS SECUR32_CreateNTLMv1SessionKey(PBYTE password, int len, PBYTE session_key);
155SECURITY_STATUS SECUR32_CreateNTLMv2SubKeys(PNegoHelper helper);
156arc4_info *SECUR32_arc4Alloc(void);
157void SECUR32_arc4Init(arc4_info *a4i, const BYTE *key, unsigned int keyLen);
158void SECUR32_arc4Process(arc4_info *a4i, BYTE *inoutString, unsigned int length);
159void SECUR32_arc4Cleanup(arc4_info *a4i);
160
161/* NTLMSSP flags indicating the negotiated features */
162#define NTLMSSP_NEGOTIATE_UNICODE 0x00000001
163#define NTLMSSP_NEGOTIATE_OEM 0x00000002
164#define NTLMSSP_REQUEST_TARGET 0x00000004
165#define NTLMSSP_NEGOTIATE_SIGN 0x00000010
166#define NTLMSSP_NEGOTIATE_SEAL 0x00000020
167#define NTLMSSP_NEGOTIATE_DATAGRAM_STYLE 0x00000040
168#define NTLMSSP_NEGOTIATE_LM_SESSION_KEY 0x00000080
169#define NTLMSSP_NEGOTIATE_NTLM 0x00000200
170#define NTLMSSP_NEGOTIATE_DOMAIN_SUPPLIED 0x00001000
171#define NTLMSSP_NEGOTIATE_WORKSTATION_SUPPLIED 0x00002000
172#define NTLMSSP_NEGOTIATE_LOCAL_CALL 0x00004000
173#define NTLMSSP_NEGOTIATE_ALWAYS_SIGN 0x00008000
174#define NTLMSSP_NEGOTIATE_TARGET_TYPE_DOMAIN 0x00010000
175#define NTLMSSP_NEGOTIATE_TARGET_TYPE_SERVER 0x00020000
176#define NTLMSSP_NEGOTIATE_NTLM2 0x00080000
177#define NTLMSSP_NEGOTIATE_TARGET_INFO 0x00800000
178#define NTLMSSP_NEGOTIATE_128 0x20000000
179#define NTLMSSP_NEGOTIATE_KEY_EXCHANGE 0x40000000
180#define NTLMSSP_NEGOTIATE_56 0x80000000
181#endif /* ndef __SECUR32_PRIV_H__ */
Note: See TracBrowser for help on using the repository browser.