Develop and Download Open Source Software

Browse Subversion Repository

Contents of /branches/ssh_chacha20poly1305/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5887 - (show annotations) (download) (as text)
Tue May 26 02:52:28 2015 UTC (8 years, 10 months ago) by doda
Original Path: trunk/ttssh2/ttxssh/ttxssh.h
File MIME type: text/x-chdr
File size: 9475 byte(s)
改行として CR と CR+LF が混在していたのを修正

1 /*
2 Copyright (c) 1998-2001, Robert O'Callahan
3 All rights reserved.
4
5 Redistribution and use in source and binary forms, with or without modification,
6 are permitted provided that the following conditions are met:
7
8 Redistributions of source code must retain the above copyright notice, this list of
9 conditions and the following disclaimer.
10
11 Redistributions in binary form must reproduce the above copyright notice, this list
12 of conditions and the following disclaimer in the documentation and/or other materials
13 provided with the distribution.
14
15 The name of Robert O'Callahan may not be used to endorse or promote products derived from
16 this software without specific prior written permission.
17
18 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' AND
19 ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20 OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21 THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 */
28
29 /*
30 This code is copyright (C) 1998-1999 Robert O'Callahan.
31 See LICENSE.TXT for the license.
32 */
33
34 #ifndef __TTXSSH_H
35 #define __TTXSSH_H
36
37 #pragma warning(3 : 4035)
38
39 #ifndef NO_INET6
40 #include <winsock2.h>
41 #include <ws2tcpip.h>
42 /* actual body of in6addr_any and in6addr_loopback is disappeared?? */
43 #undef IN6_IS_ADDR_LOOPBACK
44 #define IN6_IS_ADDR_LOOPBACK(a) \
45 ((*(unsigned int *)(&(a)->s6_addr[0]) == 0) && \
46 (*(unsigned int *)(&(a)->s6_addr[4]) == 0) && \
47 (*(unsigned int *)(&(a)->s6_addr[8]) == 0) && \
48 (*(unsigned int *)(&(a)->s6_addr[12]) == ntohl(1)))
49 /* work around for MS Platform SDK Oct 2000 */
50 #include <malloc.h> /* prevent of conflict stdlib.h */
51 #endif /* NO_INET6 */
52 #include <stdlib.h>
53 #include <crtdbg.h>
54
55 #include "i18n.h"
56 #include "ttlib.h"
57
58 typedef struct _TInstVar FAR * PTInstVar;
59
60 #include "util.h"
61 #include "pkt.h"
62 #include "ssh.h"
63 #include "auth.h"
64 #include "crypt.h"
65 #include "hosts.h"
66 #include "fwd.h"
67
68 #include <openssl/dh.h>
69 #include <openssl/ec.h>
70 #include <openssl/evp.h>
71 #include "buffer.h"
72
73 /* tttypes.h �����`���������� EM �}�N���� openssl/rsa.h (OpenSSL 0.9.8)�������v���g�^�C�v������
74 * �������������d�����������������A�r���h�G���[�������B���L3�w�b�_��include���u�����L�����������B
75 * (2005.7.9 yutaka)
76 */
77 #include "teraterm.h"
78 #include "tttypes.h"
79 #include "ttplugin.h"
80
81 HANDLE hInst; /* Instance handle of TTXSSH.DLL */
82
83 #define ID_SSHSCPMENU 52110
84 #define ID_SSHSETUPMENU 52310
85 #define ID_SSHAUTHSETUPMENU 52320
86 #define ID_SSHFWDSETUPMENU 52330
87 #define ID_SSHKEYGENMENU 52340
88 #define ID_ABOUTMENU 52910
89
90 #define ID_SSHAUTH 62501
91 #define ID_SSHUNKNOWNHOST 62502
92 #define ID_SSHDIFFERENTKEY 62503
93 #define ID_SSHASYNCMESSAGEBOX 62504
94
95 #define OPTION_NONE 0
96 #define OPTION_CLEAR 1
97 #define OPTION_REPLACE 2
98
99 /*
100 * DisablePopupMessage �p���r�b�g���`
101 */
102 #define POPUP_MSG_default 0
103 #define POPUP_MSG_FWD_received_data (1 << 0)
104
105
106 /*
107 * Host key rotation
108 */
109 #define SSH_UPDATE_HOSTKEYS_NO 0
110 #define SSH_UPDATE_HOSTKEYS_YES 1
111 #define SSH_UPDATE_HOSTKEYS_ASK 2
112
113
114 /*
115 These are the fields that WOULD go in Tera Term's 'ts' structure, if
116 we could put them there.
117 */
118 typedef struct _TS_SSH {
119 BOOL Enabled;
120 int CompressionLevel; /* 0 = NONE, else 1-9 */
121 char DefaultUserName[256];
122
123 /* this next option is a string of digits. Each digit represents a
124 cipher. The first digit is the most preferred cipher, and so on.
125 The digit SSH_CIPHER_NONE signifies that any ciphers after it are
126 disabled. */
127 char CipherOrder[SSH_CIPHER_MAX+1];
128
129 char KnownHostsFiles[2048];
130 int DefaultAuthMethod;
131 char DefaultRhostsLocalUserName[256];
132 char DefaultRhostsHostPrivateKeyFile[1024];
133 char DefaultRSAPrivateKeyFile[1024];
134
135 char DefaultForwarding[2048];
136 BOOL TryDefaultAuth;
137
138 int LogLevel; /* 0 = NONE, 100 = Verbose */
139 int WriteBufferSize;
140
141 int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
142 int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
143 // whether password will permanently store on heap memory (2006.8.5 yutaka)
144 int remember_password;
145
146 // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
147 BOOL CheckAuthListFirst;
148
149 // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
150 BOOL EnableRsaShortKeyServer;
151
152 // Enable Agent forwarding
153 BOOL ForwardAgent;
154
155 // Confirm Agent forwarding
156 BOOL ForwardAgentConfirm;
157
158 // KEX order(derived from teraterm.ini)
159 char KexOrder[KEX_DH_MAX+1];
160 char HostKeyOrder[KEY_MAX+1];
161 char MacOrder[HMAC_MAX+1];
162 char CompOrder[COMP_MAX+1];
163
164 BOOL VerifyHostKeyDNS;
165
166 int IconID;
167
168 int DisablePopupMessage;
169
170 char X11Display[128];
171
172 BOOL UpdateHostkeys;
173 } TS_SSH;
174
175 typedef struct _TInstVar {
176 PTTSet ts;
177 PComVar cv;
178
179 /* shared memory for settings across instances. Basically it's
180 a cache for the INI file.*/
181 TS_SSH FAR * ts_SSH;
182
183 int fatal_error;
184 int showing_err;
185 char FAR * err_msg;
186
187 Tconnect Pconnect;
188 Trecv Precv;
189 Tsend Psend;
190 TWSAAsyncSelect PWSAAsyncSelect;
191 TWSAGetLastError PWSAGetLastError;
192
193 PReadIniFile ReadIniFile;
194 PWriteIniFile WriteIniFile;
195 PParseParam ParseParam;
196
197 HMENU FileMenu;
198
199 SOCKET socket;
200 HWND NotificationWindow;
201 unsigned int notification_msg;
202 long notification_events;
203 HICON OldSmallIcon;
204 HICON OldLargeIcon;
205
206 BOOL hostdlg_activated;
207 BOOL hostdlg_Enabled;
208
209 int protocol_major;
210 int protocol_minor;
211
212 PKTState pkt_state;
213 SSHState ssh_state;
214 AUTHState auth_state;
215 CRYPTState crypt_state;
216 HOSTSState hosts_state;
217 FWDState fwd_state;
218
219 /* The settings applied to the current session. The user may change
220 the settings but usually we don't want that to affect the session
221 in progress (race conditions). So user setup changes usually
222 modify the 'settings' field below. */
223 TS_SSH session_settings;
224
225 /* our copy of the global settings. This is synced up with the shared
226 memory only when we do a ReadIniFile or WriteIniFile
227 (i.e. the user loads or saves setup) */
228 TS_SSH settings;
229
230 // SSH2
231 DH *kexdh;
232 char server_version_string[128];
233 char client_version_string[128];
234 buffer_t *my_kex;
235 buffer_t *peer_kex;
236 kex_algorithm kex_type; // KEX algorithm
237 ssh_keytype hostkey_type;
238 SSHCipher ctos_cipher;
239 SSHCipher stoc_cipher;
240 hmac_type ctos_hmac;
241 hmac_type stoc_hmac;
242 compression_type ctos_compression;
243 compression_type stoc_compression;
244 int we_need;
245 int key_done;
246 int rekeying;
247 char *session_id;
248 int session_id_len;
249 Newkeys ssh2_keys[MODE_MAX];
250 EVP_CIPHER_CTX evpcip[MODE_MAX];
251 int userauth_success;
252 int shell_id;
253 /*int remote_id;*/
254 int session_nego_status;
255 /*
256 unsigned int local_window;
257 unsigned int local_window_max;
258 unsigned int local_consumed;
259 unsigned int local_maxpacket;
260 unsigned int remote_window;
261 unsigned int remote_maxpacket;
262 */
263 int client_key_bits;
264 int server_key_bits;
265 int kexgex_min;
266 int kexgex_bits;
267 int kexgex_max;
268 int ssh2_autologin;
269 int ask4passwd;
270 SSHAuthMethod ssh2_authmethod;
271 char ssh2_username[MAX_PATH];
272 char ssh2_password[MAX_PATH];
273 char ssh2_keyfile[MAX_PATH];
274 time_t ssh_heartbeat_tick;
275 HANDLE ssh_heartbeat_thread;
276 int keyboard_interactive_password_input;
277 int userauth_retry_count;
278 buffer_t *decomp_buffer;
279 char *ssh2_authlist;
280 BOOL tryed_ssh2_authlist;
281 HWND ssh_hearbeat_dialog;
282
283 /* Pageant �������M�p */
284 unsigned char *pageant_key;
285 unsigned char *pageant_curkey;
286 int pageant_keylistlen;
287 int pageant_keycount;
288 int pageant_keycurrent;
289 BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
290
291 // agent forward
292 BOOL agentfwd_enable;
293
294 BOOL origDisableTCPEchoCR;
295
296 BOOL nocheck_known_hosts;
297
298 EC_KEY *ecdh_client_key;
299
300 int dns_key_check;
301 } TInstVar;
302
303 #define LOG_LEVEL_FATAL 5
304 #define LOG_LEVEL_ERROR 10
305 #define LOG_LEVEL_URGENT 20
306 #define LOG_LEVEL_WARNING 30
307 #define LOG_LEVEL_VERBOSE 100
308 #define LOG_LEVEL_SSHDUMP 200
309
310 #define SSHv1(pvar) ((pvar)->protocol_major == 1)
311 #define SSHv2(pvar) ((pvar)->protocol_major == 2)
312
313 void notify_established_secure_connection(PTInstVar pvar);
314 void notify_closed_connection(PTInstVar pvar, char FAR * send_msg);
315 void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
316 void notify_fatal_error(PTInstVar pvar, char FAR * msg, BOOL send_disconnect);
317 void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
318
319 void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
320 int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
321 void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
322 int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
323 void arc4random_buf(void *_buf, size_t n);
324
325 #endif

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26