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

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