Develop and Download Open Source Software

Browse Subversion Repository

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3176 - (show annotations) (download) (as text)
Sun Nov 30 16:14:41 2008 UTC (15 years, 4 months ago) by maya
Original Path: ttssh2/trunk/ttxssh/ssh.h
File MIME type: text/x-chdr
File size: 18188 byte(s)
SSH agent forwarding をサポートした。
  SSH1 の channel 内部処理が port forward しか想定していなかったため、
  local_channel_num に固定値を強引に割り当てている。

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 __SSH_H
35 #define __SSH_H
36
37 #include "zlib.h"
38 #include <openssl/evp.h>
39
40 #include "buffer.h"
41
42 #define DEBUG_PRINT_TO_FILE(base, msg, len) { \
43 static int count = 0; \
44 debug_print(count + base, msg, len); \
45 count++; \
46 }
47
48 // from OpenSSH
49 extern const EVP_CIPHER *evp_aes_128_ctr(void);
50
51 // yutaka
52 #define SSH2_USE
53
54
55 /* Some of this code has been adapted from Ian Goldberg's Pilot SSH */
56
57 typedef enum {
58 SSH_MSG_NONE, SSH_MSG_DISCONNECT, SSH_SMSG_PUBLIC_KEY, //2
59 SSH_CMSG_SESSION_KEY, SSH_CMSG_USER, SSH_CMSG_AUTH_RHOSTS, // 5
60 SSH_CMSG_AUTH_RSA, SSH_SMSG_AUTH_RSA_CHALLENGE,
61 SSH_CMSG_AUTH_RSA_RESPONSE, SSH_CMSG_AUTH_PASSWORD,
62 SSH_CMSG_REQUEST_PTY, // 10
63 SSH_CMSG_WINDOW_SIZE, SSH_CMSG_EXEC_SHELL,
64 SSH_CMSG_EXEC_CMD, SSH_SMSG_SUCCESS, SSH_SMSG_FAILURE,
65 SSH_CMSG_STDIN_DATA, SSH_SMSG_STDOUT_DATA, SSH_SMSG_STDERR_DATA,
66 SSH_CMSG_EOF, SSH_SMSG_EXITSTATUS,
67 SSH_MSG_CHANNEL_OPEN_CONFIRMATION, SSH_MSG_CHANNEL_OPEN_FAILURE,
68 SSH_MSG_CHANNEL_DATA, SSH_MSG_CHANNEL_INPUT_EOF,
69 SSH_MSG_CHANNEL_OUTPUT_CLOSED, SSH_MSG_OBSOLETED0,
70 SSH_SMSG_X11_OPEN, SSH_CMSG_PORT_FORWARD_REQUEST, SSH_MSG_PORT_OPEN,
71 SSH_CMSG_AGENT_REQUEST_FORWARDING, SSH_SMSG_AGENT_OPEN,
72 SSH_MSG_IGNORE, SSH_CMSG_EXIT_CONFIRMATION,
73 SSH_CMSG_X11_REQUEST_FORWARDING, SSH_CMSG_AUTH_RHOSTS_RSA,
74 SSH_MSG_DEBUG, SSH_CMSG_REQUEST_COMPRESSION,
75 SSH_CMSG_MAX_PACKET_SIZE, SSH_CMSG_AUTH_TIS,
76 SSH_SMSG_AUTH_TIS_CHALLENGE, SSH_CMSG_AUTH_TIS_RESPONSE,
77 SSH_CMSG_AUTH_KERBEROS, SSH_SMSG_AUTH_KERBEROS_RESPONSE
78 } SSHMessage;
79
80 typedef enum {
81 SSH_CIPHER_NONE, SSH_CIPHER_IDEA, SSH_CIPHER_DES, SSH_CIPHER_3DES,
82 SSH_CIPHER_TSS, SSH_CIPHER_RC4, SSH_CIPHER_BLOWFISH,
83 // for SSH2
84 SSH2_CIPHER_3DES_CBC, SSH2_CIPHER_AES128_CBC,
85 SSH2_CIPHER_AES192_CBC, SSH2_CIPHER_AES256_CBC,
86 SSH2_CIPHER_BLOWFISH_CBC, SSH2_CIPHER_AES128_CTR,
87 SSH2_CIPHER_AES192_CTR, SSH2_CIPHER_AES256_CTR,
88 SSH2_CIPHER_ARCFOUR, SSH2_CIPHER_ARCFOUR128, SSH2_CIPHER_ARCFOUR256,
89 SSH2_CIPHER_CAST128_CBC,
90 } SSHCipher;
91
92 #define SSH_CIPHER_MAX SSH2_CIPHER_CAST128_CBC
93
94 typedef enum {
95 SSH_AUTH_NONE, SSH_AUTH_RHOSTS, SSH_AUTH_RSA, SSH_AUTH_PASSWORD,
96 SSH_AUTH_RHOSTS_RSA, SSH_AUTH_TIS, SSH_AUTH_KERBEROS,
97 SSH_AUTH_PAGEANT = 16,
98 } SSHAuthMethod;
99
100 #define SSH_AUTH_MAX SSH_AUTH_PAGEANT
101
102 typedef enum {
103 SSH_GENERIC_AUTHENTICATION, SSH_TIS_AUTHENTICATION
104 } SSHAuthMode;
105
106 #define SSH_PROTOFLAG_SCREEN_NUMBER 1
107 #define SSH_PROTOFLAG_HOST_IN_FWD_OPEN 2
108
109 // for SSH1
110 #define SSH_MAX_SEND_PACKET_SIZE 250000
111
112 // for SSH2
113 /* default window/packet sizes for tcp/x11-fwd-channel */
114 // changed CHAN_SES_WINDOW_DEFAULT from 32KB to 128KB. (2007.10.29 maya)
115 #define CHAN_SES_PACKET_DEFAULT (32*1024)
116 #define CHAN_SES_WINDOW_DEFAULT (4*CHAN_SES_PACKET_DEFAULT)
117 #define CHAN_TCP_PACKET_DEFAULT (32*1024)
118 #define CHAN_TCP_WINDOW_DEFAULT (4*CHAN_TCP_PACKET_DEFAULT)
119 #if 0 // unused
120 #define CHAN_X11_PACKET_DEFAULT (16*1024)
121 #define CHAN_X11_WINDOW_DEFAULT (4*CHAN_X11_PACKET_DEFAULT)
122 #endif
123
124
125 /* SSH2 constants */
126
127 /* SSH2 messages */
128 #define SSH2_MSG_DISCONNECT 1
129 #define SSH2_MSG_IGNORE 2
130 #define SSH2_MSG_UNIMPLEMENTED 3
131 #define SSH2_MSG_DEBUG 4
132 #define SSH2_MSG_SERVICE_REQUEST 5
133 #define SSH2_MSG_SERVICE_ACCEPT 6
134
135 #define SSH2_MSG_KEXINIT 20
136 #define SSH2_MSG_NEWKEYS 21
137
138 #define SSH2_MSG_KEXDH_INIT 30
139 #define SSH2_MSG_KEXDH_REPLY 31
140
141 #define SSH2_MSG_KEX_DH_GEX_GROUP 31
142 #define SSH2_MSG_KEX_DH_GEX_INIT 32
143 #define SSH2_MSG_KEX_DH_GEX_REPLY 33
144 #define SSH2_MSG_KEX_DH_GEX_REQUEST 34
145
146 #define SSH2_MSG_USERAUTH_REQUEST 50
147 #define SSH2_MSG_USERAUTH_FAILURE 51
148 #define SSH2_MSG_USERAUTH_SUCCESS 52
149 #define SSH2_MSG_USERAUTH_BANNER 53
150
151 #define SSH2_MSG_USERAUTH_PK_OK 60
152 #define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60
153 #define SSH2_MSG_USERAUTH_INFO_REQUEST 60
154 #define SSH2_MSG_USERAUTH_INFO_RESPONSE 61
155
156 #define SSH2_MSG_GLOBAL_REQUEST 80
157 #define SSH2_MSG_REQUEST_SUCCESS 81
158 #define SSH2_MSG_REQUEST_FAILURE 82
159 #define SSH2_MSG_CHANNEL_OPEN 90
160 #define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91
161 #define SSH2_MSG_CHANNEL_OPEN_FAILURE 92
162 #define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93
163 #define SSH2_MSG_CHANNEL_DATA 94
164 #define SSH2_MSG_CHANNEL_EXTENDED_DATA 95
165 #define SSH2_MSG_CHANNEL_EOF 96
166 #define SSH2_MSG_CHANNEL_CLOSE 97
167 #define SSH2_MSG_CHANNEL_REQUEST 98
168 #define SSH2_MSG_CHANNEL_SUCCESS 99
169 #define SSH2_MSG_CHANNEL_FAILURE 100
170
171 /* SSH2 miscellaneous constants */
172 #define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1
173 #define SSH2_DISCONNECT_PROTOCOL_ERROR 2
174 #define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3
175 #define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4
176 #define SSH2_DISCONNECT_MAC_ERROR 5
177 #define SSH2_DISCONNECT_COMPRESSION_ERROR 6
178 #define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7
179 #define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8
180 #define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9
181 #define SSH2_DISCONNECT_CONNECTION_LOST 10
182 #define SSH2_DISCONNECT_BY_APPLICATION 11
183
184 #define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1
185 #define SSH2_OPEN_CONNECT_FAILED 2
186 #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3
187 #define SSH2_OPEN_RESOURCE_SHORTAGE 4
188
189 // �L�[�����A���S���Y��
190 #define KEX_DH1 "diffie-hellman-group1-sha1"
191 #define KEX_DH14 "diffie-hellman-group14-sha1"
192 #define KEX_DHGEX "diffie-hellman-group-exchange-sha1"
193
194 // support of "Compression delayed" (2006.6.23 maya)
195 enum compression_algorithm {
196 COMP_NONE,
197 COMP_ZLIB,
198 COMP_DELAYED,
199 COMP_UNKNOWN
200 };
201
202 enum kex_exchange {
203 KEX_DH_GRP1_SHA1,
204 KEX_DH_GRP14_SHA1,
205 KEX_DH_GEX_SHA1,
206 KEX_MAX
207 };
208
209 enum hostkey_type {
210 KEY_RSA1,
211 KEY_RSA,
212 KEY_DSA,
213 KEY_UNSPEC,
214 };
215
216 // ���L���C���f�b�N�X�� ssh2_macs[] ���������������B
217 enum hmac_type {
218 HMAC_SHA1,
219 HMAC_MD5,
220 HMAC_UNKNOWN
221 };
222
223 #define KEX_DEFAULT_KEX "diffie-hellman-group-exchange-sha1," \
224 "diffie-hellman-group14-sha1," \
225 "diffie-hellman-group1-sha1"
226 #define KEX_DEFAULT_PK_ALG "ssh-rsa,ssh-dss"
227 // use the setting of pvar.CipherOrder.
228 #define KEX_DEFAULT_ENCRYPT ""
229 #define KEX_DEFAULT_MAC "hmac-sha1,hmac-md5"
230 // support of "Compression delayed" (2006.6.23 maya)
231 #define KEX_DEFAULT_COMP "none,zlib@openssh.com,zlib"
232 #define KEX_DEFAULT_LANG ""
233
234 /* Minimum modulus size (n) for RSA keys. */
235 #define SSH_RSA_MINIMUM_MODULUS_SIZE 768
236
237 enum kex_init_proposals {
238 PROPOSAL_KEX_ALGS,
239 PROPOSAL_SERVER_HOST_KEY_ALGS,
240 PROPOSAL_ENC_ALGS_CTOS,
241 PROPOSAL_ENC_ALGS_STOC,
242 PROPOSAL_MAC_ALGS_CTOS,
243 PROPOSAL_MAC_ALGS_STOC,
244 PROPOSAL_COMP_ALGS_CTOS,
245 PROPOSAL_COMP_ALGS_STOC,
246 PROPOSAL_LANG_CTOS,
247 PROPOSAL_LANG_STOC,
248 PROPOSAL_MAX
249 };
250
251
252 // �N���C�A���g�����T�[�o������������
253 #ifdef SSH2_DEBUG
254 static char *myproposal[PROPOSAL_MAX] = {
255 // KEX_DEFAULT_KEX,
256 "diffie-hellman-group14-sha1,diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1",
257 KEX_DEFAULT_PK_ALG,
258 // "ssh-dss,ssh-rsa",
259 KEX_DEFAULT_ENCRYPT,
260 KEX_DEFAULT_ENCRYPT,
261 "hmac-md5,hmac-sha1",
262 "hmac-md5,hmac-sha1",
263 // "hmac-sha1",
264 // "hmac-sha1",
265 // KEX_DEFAULT_MAC,
266 // KEX_DEFAULT_MAC,
267 KEX_DEFAULT_COMP,
268 KEX_DEFAULT_COMP,
269 KEX_DEFAULT_LANG,
270 KEX_DEFAULT_LANG,
271 };
272 #else
273 static char *myproposal[PROPOSAL_MAX] = {
274 KEX_DEFAULT_KEX,
275 KEX_DEFAULT_PK_ALG,
276 KEX_DEFAULT_ENCRYPT,
277 KEX_DEFAULT_ENCRYPT,
278 KEX_DEFAULT_MAC,
279 KEX_DEFAULT_MAC,
280 KEX_DEFAULT_COMP,
281 KEX_DEFAULT_COMP,
282 KEX_DEFAULT_LANG,
283 KEX_DEFAULT_LANG,
284 };
285 #endif
286
287
288 typedef struct ssh2_cipher {
289 SSHCipher cipher;
290 char *name;
291 int block_size;
292 int key_len;
293 int discard_len;
294 const EVP_CIPHER *(*func)(void);
295 } ssh2_cipher_t;
296
297 static ssh2_cipher_t ssh2_ciphers[] = {
298 {SSH2_CIPHER_3DES_CBC, "3des-cbc", 8, 24, 0, EVP_des_ede3_cbc},
299 {SSH2_CIPHER_AES128_CBC, "aes128-cbc", 16, 16, 0, EVP_aes_128_cbc},
300 {SSH2_CIPHER_AES192_CBC, "aes192-cbc", 16, 24, 0, EVP_aes_192_cbc},
301 {SSH2_CIPHER_AES256_CBC, "aes256-cbc", 16, 32, 0, EVP_aes_256_cbc},
302 {SSH2_CIPHER_BLOWFISH_CBC, "blowfish-cbc", 8, 16, 0, EVP_bf_cbc},
303 {SSH2_CIPHER_AES128_CTR, "aes128-ctr", 16, 16, 0, evp_aes_128_ctr},
304 {SSH2_CIPHER_AES192_CTR, "aes192-ctr", 16, 24, 0, evp_aes_128_ctr},
305 {SSH2_CIPHER_AES256_CTR, "aes256-ctr", 16, 32, 0, evp_aes_128_ctr},
306 {SSH2_CIPHER_ARCFOUR, "arcfour", 8, 16, 0, EVP_rc4},
307 {SSH2_CIPHER_ARCFOUR128, "arcfour128", 8, 16, 1536, EVP_rc4},
308 {SSH2_CIPHER_ARCFOUR256, "arcfour256", 8, 32, 1536, EVP_rc4},
309 {SSH2_CIPHER_CAST128_CBC, "cast128-cbc", 8, 16, 0, EVP_cast5_cbc},
310 {SSH_CIPHER_NONE, NULL, 0, 0, 0, NULL},
311 };
312
313
314 typedef struct ssh2_mac {
315 char *name;
316 const EVP_MD *(*func)(void);
317 int truncatebits;
318 } ssh2_mac_t;
319
320 static ssh2_mac_t ssh2_macs[] = {
321 {"hmac-sha1", EVP_sha1, 0},
322 {"hmac-md5", EVP_md5, 0},
323 {NULL, NULL, 0},
324 };
325
326 static char *ssh_comp[] = {
327 "none",
328 "zlib",
329 "zlib@openssh.com",
330 };
331
332
333 struct Enc {
334 u_char *key;
335 u_char *iv;
336 unsigned int key_len;
337 unsigned int block_size;
338 };
339
340 struct Mac {
341 char *name;
342 int enabled;
343 const EVP_MD *md;
344 int mac_len;
345 u_char *key;
346 int key_len;
347 };
348
349 struct Comp {
350 int type;
351 int enabled;
352 char *name;
353 };
354
355 typedef struct {
356 struct Enc enc;
357 struct Mac mac;
358 struct Comp comp;
359 } Newkeys;
360
361 #define roundup(x, y) ((((x)+((y)-1))/(y))*(y))
362
363 enum kex_modes {
364 MODE_IN,
365 MODE_OUT,
366 MODE_MAX
367 };
368
369
370 // �z�X�g�L�[(SSH1, SSH2����)���f�[�^�\�� (2006.3.21 yutaka)
371 typedef struct Key {
372 // host key type
373 enum hostkey_type type;
374 // SSH2 RSA
375 RSA *rsa;
376 // SSH2 DSA
377 DSA *dsa;
378 // SSH1 RSA
379 int bits;
380 unsigned char *exp;
381 unsigned char *mod;
382 } Key;
383
384 // fingerprint������
385 enum fp_rep {
386 SSH_FP_HEX,
387 SSH_FP_BUBBLEBABBLE,
388 SSH_FP_RANDOMART
389 };
390
391 enum scp_dir {
392 TOLOCAL, FROMREMOTE,
393 };
394
395 #define SSH1_AGENT_CHANNEL_ID 0x10000000
396 typedef struct agent_channel {
397 int local_id;
398 int remote_id;
399 buffer_t *agent_msg;
400 int agent_request_len;
401 } agent_channel_t;
402
403 /* The packet handler returns TRUE to keep the handler in place,
404 FALSE to remove the handler. */
405 typedef BOOL (* SSHPacketHandler)(PTInstVar pvar);
406
407 typedef struct _SSHPacketHandlerItem SSHPacketHandlerItem;
408 struct _SSHPacketHandlerItem {
409 SSHPacketHandler handler;
410 /* Circular list of handlers for given message */
411 SSHPacketHandlerItem FAR * next_for_message;
412 SSHPacketHandlerItem FAR * last_for_message;
413 /* Circular list of handlers in set */
414 SSHPacketHandlerItem FAR * next_in_set;
415 int active_for_message;
416 };
417
418 typedef struct {
419 char FAR * hostname;
420
421 int server_protocol_flags;
422 char FAR * server_ID;
423
424 /* This buffer is used to hold the outgoing data, and encrypted in-place
425 here if necessary. */
426 unsigned char FAR * outbuf;
427 long outbuflen;
428 /* This buffer is used by the SSH protocol processing to store uncompressed
429 packet data for compression. User data is never streamed through here;
430 it is compressed directly from the user's buffer. */
431 unsigned char FAR * precompress_outbuf;
432 long precompress_outbuflen;
433 /* this is the length of the packet data, including the type header */
434 long outgoing_packet_len;
435
436 /* This buffer is used by the SSH protocol processing to store decompressed
437 packet data. User data is never streamed through here; it is decompressed
438 directly to the user's buffer. */
439 unsigned char FAR * postdecompress_inbuf;
440 long postdecompress_inbuflen;
441
442 unsigned char FAR * payload;
443 long payload_grabbed;
444 long payloadlen;
445 long payload_datastart;
446 long payload_datalen;
447
448 uint32 receiver_sequence_number;
449 uint32 sender_sequence_number;
450
451 z_stream compress_stream;
452 z_stream decompress_stream;
453 BOOL compressing;
454 BOOL decompressing;
455 int compression_level;
456
457 SSHPacketHandlerItem FAR * packet_handlers[256];
458 int status_flags;
459
460 int win_cols;
461 int win_rows;
462
463 unsigned short tcpport;
464 } SSHState;
465
466 #define STATUS_DONT_SEND_USER_NAME 0x01
467 #define STATUS_EXPECTING_COMPRESSION_RESPONSE 0x02
468 #define STATUS_DONT_SEND_CREDENTIALS 0x04
469 #define STATUS_HOST_OK 0x08
470 #define STATUS_INTERACTIVE 0x10
471 #define STATUS_IN_PARTIAL_ID_STRING 0x20
472
473 void SSH_init(PTInstVar pvar);
474 void SSH_open(PTInstVar pvar);
475 void SSH_notify_disconnecting(PTInstVar pvar, char FAR * reason);
476 /* SSH_handle_server_ID returns TRUE iff a valid ID string has been
477 received. If it returns FALSE, we need to keep looking for another
478 ID string. */
479 BOOL SSH_handle_server_ID(PTInstVar pvar, char FAR * ID, int ID_len);
480 /* SSH_handle_packet requires NO PAYLOAD on entry.
481 'len' is the size of the packet: payload + padding (+ CRC for SSHv1)
482 'padding' is the size of the padding.
483 'data' points to the start of the packet data (the length field)
484 */
485 void SSH_handle_packet(PTInstVar pvar, char FAR * data, int len, int padding);
486 void SSH_notify_win_size(PTInstVar pvar, int cols, int rows);
487 void SSH_notify_user_name(PTInstVar pvar);
488 void SSH_notify_cred(PTInstVar pvar);
489 void SSH_notify_host_OK(PTInstVar pvar);
490 void SSH_send(PTInstVar pvar, unsigned char const FAR * buf, unsigned int buflen);
491 /* SSH_extract_payload returns number of bytes extracted */
492 int SSH_extract_payload(PTInstVar pvar, unsigned char FAR * dest, int len);
493 void SSH_end(PTInstVar pvar);
494
495 void SSH_get_server_ID_info(PTInstVar pvar, char FAR * dest, int len);
496 void SSH_get_protocol_version_info(PTInstVar pvar, char FAR * dest, int len);
497 void SSH_get_compression_info(PTInstVar pvar, char FAR * dest, int len);
498
499 /* len must be <= SSH_MAX_SEND_PACKET_SIZE */
500 void SSH_channel_send(PTInstVar pvar, int channel_num,
501 uint32 remote_channel_num,
502 unsigned char FAR * buf, int len);
503 void SSH_fail_channel_open(PTInstVar pvar, uint32 remote_channel_num);
504 void SSH_confirm_channel_open(PTInstVar pvar, uint32 remote_channel_num, uint32 local_channel_num);
505 void SSH_channel_output_eof(PTInstVar pvar, uint32 remote_channel_num);
506 void SSH_channel_input_eof(PTInstVar pvar, uint32 remote_channel_num, uint32 local_channel_num);
507 void SSH_request_forwarding(PTInstVar pvar, int from_server_port,
508 char FAR * to_local_host, int to_local_port);
509 void SSH_request_X11_forwarding(PTInstVar pvar,
510 char FAR * auth_protocol, unsigned char FAR * auth_data, int auth_data_len, int screen_num);
511 void SSH_open_channel(PTInstVar pvar, uint32 local_channel_num,
512 char FAR * to_remote_host, int to_remote_port,
513 char FAR * originator, unsigned short originator_port);
514
515 int SSH_start_scp(PTInstVar pvar, char *sendfile, char *dstfile);
516 int SSH_start_scp_receive(PTInstVar pvar, char *filename);
517 int SSH_scp_transaction(PTInstVar pvar, char *sendfile, char *dstfile, enum scp_dir direction);
518 int SSH_sftp_transaction(PTInstVar pvar);
519
520 /* auxiliary SSH2 interfaces for pkt.c */
521 int SSH_get_min_packet_size(PTInstVar pvar);
522 /* data is guaranteed to be at least SSH_get_min_packet_size bytes long
523 at least 5 bytes must be decrypted */
524 void SSH_predecrpyt_packet(PTInstVar pvar, char FAR * data);
525 int SSH_get_clear_MAC_size(PTInstVar pvar);
526
527 #define SSH_is_any_payload(pvar) ((pvar)->ssh_state.payload_datalen > 0)
528 #define SSH_get_host_name(pvar) ((pvar)->ssh_state.hostname)
529 #define SSH_get_compression_level(pvar) ((pvar)->ssh_state.compressing ? (pvar)->ts_SSH_CompressionLevel : 0)
530
531 void SSH2_send_kexinit(PTInstVar pvar);
532 BOOL do_SSH2_userauth(PTInstVar pvar);
533 BOOL do_SSH2_authrequest(PTInstVar pvar);
534 void debug_print(int no, char *msg, int len);
535 int get_cipher_block_size(SSHCipher cipher);
536 int get_cipher_key_len(SSHCipher cipher);
537 const EVP_CIPHER* get_cipher_EVP_CIPHER(SSHCipher cipher);
538 int get_cipher_discard_len(SSHCipher cipher);
539 void ssh_heartbeat_lock_initialize(void);
540 void ssh_heartbeat_lock_finalize(void);
541 void ssh_heartbeat_lock(void);
542 void ssh_heartbeat_unlock(void);
543 void halt_ssh_heartbeat_thread(PTInstVar pvar);
544 void ssh2_channel_free(void);
545 BOOL handle_SSH2_userauth_inforeq(PTInstVar pvar);
546 void SSH2_update_compression_myproposal(PTInstVar pvar);
547 void SSH2_update_cipher_myproposal(PTInstVar pvar);
548
549 enum hostkey_type get_keytype_from_name(char *name);
550 char *get_sshname_from_key(Key *key);
551 int key_to_blob(Key *key, char **blobp, int *lenp);
552 Key *key_from_blob(char *data, int blen);
553 void key_free(Key *key);
554 RSA *duplicate_RSA(RSA *src);
555 DSA *duplicate_DSA(DSA *src);
556 char *key_fingerprint(Key *key, enum fp_rep dgst_rep);
557
558 #endif

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