Develop and Download Open Source Software

Browse Subversion Repository

Annotation of /trunk/ttssh2/ttxssh/ttxssh.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4314 - (hide annotations) (download) (as text)
Wed Feb 16 15:55:41 2011 UTC (13 years, 1 month ago) by maya
File MIME type: text/x-chdr
File size: 8817 byte(s)
SSH2 diffie-hellman-group-exchange-sha256, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521 鍵交換プロトコルを追加した
1 maya 3227 /*
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 maya 3295 #include "ttlib.h"
57 maya 3227
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 maya 4314 #include <openssl/ec.h>
70 maya 3227 #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_SSHDIFFERENTHOST 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     These are the fields that WOULD go in Tera Term's 'ts' structure, if
101     we could put them there.
102     */
103     typedef struct _TS_SSH {
104     BOOL Enabled;
105     int CompressionLevel; /* 0 = NONE, else 1-9 */
106     char DefaultUserName[256];
107    
108     /* this next option is a string of digits. Each digit represents a
109     cipher. The first digit is the most preferred cipher, and so on.
110     The digit SSH_CIPHER_NONE signifies that any ciphers after it are
111     disabled. */
112     char CipherOrder[SSH_CIPHER_MAX+1];
113    
114     char KnownHostsFiles[2048];
115     int DefaultAuthMethod;
116     char DefaultRhostsLocalUserName[256];
117     char DefaultRhostsHostPrivateKeyFile[1024];
118     char DefaultRSAPrivateKeyFile[1024];
119    
120     char DefaultForwarding[2048];
121     BOOL TryDefaultAuth;
122    
123     int LogLevel; /* 0 = NONE, 100 = Verbose */
124     int WriteBufferSize;
125    
126     int ssh_protocol_version; // SSH version (2004.10.11 yutaka)
127     int ssh_heartbeat_overtime; // SSH heartbeat(keepalive) (2004.12.11 yutaka)
128     // whether password will permanently store on heap memory (2006.8.5 yutaka)
129     int remember_password;
130    
131     // try auth with "none" method for disable unsupported on dialog (2007.9.24 maya)
132     BOOL CheckAuthListFirst;
133    
134     // Enable connection to the server that has RSA key length less than 768 bit (2008.9.11 maya)
135     BOOL EnableRsaShortKeyServer;
136    
137     // Enable Agent forwarding
138     BOOL ForwardAgent;
139 maya 4229
140     // Confirm Agent forwarding
141     BOOL ForwardAgentConfirm;
142 maya 3227 } TS_SSH;
143    
144     typedef struct _TInstVar {
145     PTTSet ts;
146     PComVar cv;
147    
148     /* shared memory for settings across instances. Basically it's
149     a cache for the INI file.*/
150     TS_SSH FAR * ts_SSH;
151    
152     int fatal_error;
153     int showing_err;
154     char FAR * err_msg;
155    
156     Tconnect Pconnect;
157     Trecv Precv;
158     Tsend Psend;
159     TWSAAsyncSelect PWSAAsyncSelect;
160     TWSAGetLastError PWSAGetLastError;
161    
162     PReadIniFile ReadIniFile;
163     PWriteIniFile WriteIniFile;
164     PParseParam ParseParam;
165    
166     SOCKET socket;
167     HWND NotificationWindow;
168     unsigned int notification_msg;
169     long notification_events;
170     HICON OldSmallIcon;
171     HICON OldLargeIcon;
172    
173     BOOL hostdlg_activated;
174     BOOL hostdlg_Enabled;
175    
176     int protocol_major;
177     int protocol_minor;
178    
179     PKTState pkt_state;
180     SSHState ssh_state;
181     AUTHState auth_state;
182     CRYPTState crypt_state;
183     HOSTSState hosts_state;
184     FWDState fwd_state;
185    
186     /* The settings applied to the current session. The user may change
187     the settings but usually we don't want that to affect the session
188     in progress (race conditions). So user setup changes usually
189     modify the 'settings' field below. */
190     TS_SSH session_settings;
191    
192     /* our copy of the global settings. This is synced up with the shared
193     memory only when we do a ReadIniFile or WriteIniFile
194     (i.e. the user loads or saves setup) */
195     TS_SSH settings;
196    
197     // SSH2
198     DH *kexdh;
199     char server_version_string[128];
200     char client_version_string[128];
201     buffer_t *my_kex;
202     buffer_t *peer_kex;
203 maya 4301 enum kex_algorithm kex_type; // KEX algorithm
204 maya 4307 enum ssh_keytype hostkey_type;
205 maya 3227 SSHCipher ctos_cipher;
206     SSHCipher stoc_cipher;
207     enum hmac_type ctos_hmac;
208     enum hmac_type stoc_hmac;
209 maya 3325 enum compression_type ctos_compression;
210     enum compression_type stoc_compression;
211 maya 3227 int we_need;
212     int key_done;
213     int rekeying;
214     char *session_id;
215     int session_id_len;
216     Newkeys ssh2_keys[MODE_MAX];
217     EVP_CIPHER_CTX evpcip[MODE_MAX];
218     int userauth_success;
219     int shell_id;
220     /*int remote_id;*/
221     int session_nego_status;
222     /*
223     unsigned int local_window;
224     unsigned int local_window_max;
225     unsigned int local_consumed;
226     unsigned int local_maxpacket;
227     unsigned int remote_window;
228     unsigned int remote_maxpacket;
229     */
230     int client_key_bits;
231     int server_key_bits;
232     int kexgex_min;
233     int kexgex_bits;
234     int kexgex_max;
235     int ssh2_autologin;
236     int ask4passwd;
237     SSHAuthMethod ssh2_authmethod;
238     char ssh2_username[MAX_PATH];
239     char ssh2_password[MAX_PATH];
240     char ssh2_keyfile[MAX_PATH];
241     time_t ssh_heartbeat_tick;
242     HANDLE ssh_heartbeat_thread;
243     int keyboard_interactive_password_input;
244     int userauth_retry_count;
245     buffer_t *decomp_buffer;
246     char *ssh2_authlist;
247     BOOL tryed_ssh2_authlist;
248     HWND ssh_hearbeat_dialog;
249    
250     /* Pageant �������M�p */
251     unsigned char *pageant_key;
252     unsigned char *pageant_curkey;
253     int pageant_keylistlen;
254     int pageant_keycount;
255     int pageant_keycurrent;
256     BOOL pageant_keyfinal;// SSH2 PK_OK ������������ TRUE ������
257    
258     // agent forward
259     BOOL agentfwd_enable;
260 doda 3579
261     BOOL origDisableTCPEchoCR;
262 yutakapon 3631
263     BOOL nocheck_known_hosts;
264 maya 4314
265     EC_KEY *ecdh_client_key;
266 maya 3227 } TInstVar;
267    
268     #define LOG_LEVEL_FATAL 5
269     #define LOG_LEVEL_ERROR 10
270     #define LOG_LEVEL_URGENT 20
271     #define LOG_LEVEL_WARNING 30
272     #define LOG_LEVEL_VERBOSE 100
273     #define LOG_LEVEL_SSHDUMP 200
274    
275     #define SSHv1(pvar) ((pvar)->protocol_major == 1)
276     #define SSHv2(pvar) ((pvar)->protocol_major == 2)
277    
278     void notify_established_secure_connection(PTInstVar pvar);
279     void notify_closed_connection(PTInstVar pvar);
280     void notify_nonfatal_error(PTInstVar pvar, char FAR * msg);
281     void notify_fatal_error(PTInstVar pvar, char FAR * msg);
282     void notify_verbose_message(PTInstVar pvar, char FAR * msg, int level);
283    
284     void get_teraterm_dir_relative_name(char FAR * buf, int bufsize, char FAR * basename);
285     int copy_teraterm_dir_relative_path(char FAR * dest, int destsize, char FAR * basename);
286     void get_file_version(char *exefile, int *major, int *minor, int *release, int *build);
287     int uuencode(unsigned char *src, int srclen, unsigned char *target, int targsize);
288    
289     #endif

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