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 3161 - (show annotations) (download) (as text)
Wed Nov 19 06:40:12 2008 UTC (15 years, 4 months ago) by maya
Original Path: ttssh2/trunk/ttxssh/ssh.h
File MIME type: text/x-chdr
File size: 17585 byte(s)
SSHの暗号アルゴリズムのデフォルト優先順位を変更

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

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