4 #include "puttymem.h"
\r
11 typedef struct ssh_tag *Ssh;
\r
13 extern int sshfwd_write(struct ssh_channel *c, char *, int);
\r
14 extern void sshfwd_write_eof(struct ssh_channel *c);
\r
15 extern void sshfwd_unclean_close(struct ssh_channel *c, const char *err);
\r
16 extern void sshfwd_unthrottle(struct ssh_channel *c, int bufsize);
\r
17 Conf *sshfwd_get_conf(struct ssh_channel *c);
\r
18 void sshfwd_x11_sharing_handover(struct ssh_channel *c,
\r
19 void *share_cs, void *share_chan,
\r
20 const char *peer_addr, int peer_port,
\r
21 int endian, int protomajor, int protominor,
\r
22 const void *initial_data, int initial_len);
\r
23 void sshfwd_x11_is_local(struct ssh_channel *c);
\r
25 extern Socket ssh_connection_sharing_init(const char *host, int port,
\r
26 Conf *conf, Ssh ssh, void **state);
\r
27 int ssh_share_test_for_upstream(const char *host, int port, Conf *conf);
\r
28 void share_got_pkt_from_server(void *ctx, int type,
\r
29 unsigned char *pkt, int pktlen);
\r
30 void share_activate(void *state, const char *server_verstring);
\r
31 void sharestate_free(void *state);
\r
32 int share_ndownstreams(void *state);
\r
34 void ssh_connshare_log(Ssh ssh, int event, const char *logtext,
\r
35 const char *ds_err, const char *us_err);
\r
36 unsigned ssh_alloc_sharing_channel(Ssh ssh, void *sharing_ctx);
\r
37 void ssh_delete_sharing_channel(Ssh ssh, unsigned localid);
\r
38 int ssh_alloc_sharing_rportfwd(Ssh ssh, const char *shost, int sport,
\r
40 void ssh_sharing_queue_global_request(Ssh ssh, void *share_ctx);
\r
41 struct X11FakeAuth *ssh_sharing_add_x11_display(Ssh ssh, int authtype,
\r
44 void ssh_sharing_remove_x11_display(Ssh ssh, struct X11FakeAuth *auth);
\r
45 void ssh_send_packet_from_downstream(Ssh ssh, unsigned id, int type,
\r
46 const void *pkt, int pktlen,
\r
47 const char *additional_log_text);
\r
48 void ssh_sharing_downstream_connected(Ssh ssh, unsigned id,
\r
49 const char *peerinfo);
\r
50 void ssh_sharing_downstream_disconnected(Ssh ssh, unsigned id);
\r
51 void ssh_sharing_logf(Ssh ssh, unsigned id, const char *logfmt, ...);
\r
52 int ssh_agent_forwarding_permitted(Ssh ssh);
\r
53 void share_setup_x11_channel(void *csv, void *chanv,
\r
54 unsigned upstream_id, unsigned server_id,
\r
55 unsigned server_currwin, unsigned server_maxpkt,
\r
56 unsigned client_adjusted_window,
\r
57 const char *peer_addr, int peer_port, int endian,
\r
58 int protomajor, int protominor,
\r
59 const void *initial_data, int initial_len);
\r
65 #define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
\r
68 #define SSH_CIPHER_IDEA 1
\r
69 #define SSH_CIPHER_DES 2
\r
70 #define SSH_CIPHER_3DES 3
\r
71 #define SSH_CIPHER_BLOWFISH 6
\r
79 #ifndef BIGNUM_INTERNAL
\r
80 typedef void *Bignum;
\r
87 unsigned long exponent;
\r
88 unsigned char *modulus;
\r
92 Bignum private_exponent;
\r
101 Bignum p, q, g, y, x;
\r
107 const struct ec_curve *curve;
\r
109 Bignum z; /* Jacobian denominator */
\r
110 unsigned char infinity;
\r
113 void ec_point_free(struct ec_point *point);
\r
115 /* Weierstrass form curve */
\r
122 /* Montgomery form curve */
\r
129 /* Edwards form curve */
\r
137 enum { EC_WEIERSTRASS, EC_MONTGOMERY, EC_EDWARDS } type;
\r
138 /* 'name' is the identifier of the curve when it has to appear in
\r
139 * wire protocol encodings, as it does in e.g. the public key and
\r
140 * signature formats for NIST curves. Curves which do not format
\r
141 * their keys or signatures in this way just have name==NULL.
\r
143 * 'textname' is non-NULL for all curves, and is a human-readable
\r
144 * identification suitable for putting in log messages. */
\r
145 const char *name, *textname;
\r
146 unsigned int fieldBits;
\r
149 struct ec_wcurve w;
\r
150 struct ec_mcurve m;
\r
151 struct ec_ecurve e;
\r
155 const struct ssh_signkey *ec_alg_by_oid(int len, const void *oid,
\r
156 const struct ec_curve **curve);
\r
157 const unsigned char *ec_alg_oid(const struct ssh_signkey *alg, int *oidlen);
\r
158 extern const int ec_nist_curve_lengths[], n_ec_nist_curve_lengths;
\r
159 int ec_nist_alg_and_curve_by_bits(int bits,
\r
160 const struct ec_curve **curve,
\r
161 const struct ssh_signkey **alg);
\r
162 int ec_ed_alg_and_curve_by_bits(int bits,
\r
163 const struct ec_curve **curve,
\r
164 const struct ssh_signkey **alg);
\r
166 struct ssh_signkey;
\r
169 const struct ssh_signkey *signalg;
\r
170 struct ec_point publicKey;
\r
174 struct ec_point *ec_public(const Bignum privateKey, const struct ec_curve *curve);
\r
176 int makekey(const unsigned char *data, int len, struct RSAKey *result,
\r
177 const unsigned char **keystr, int order);
\r
178 int makeprivate(const unsigned char *data, int len, struct RSAKey *result);
\r
179 int rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
\r
180 Bignum rsadecrypt(Bignum input, struct RSAKey *key);
\r
181 void rsasign(unsigned char *data, int length, struct RSAKey *key);
\r
182 void rsasanitise(struct RSAKey *key);
\r
183 int rsastr_len(struct RSAKey *key);
\r
184 void rsastr_fmt(char *str, struct RSAKey *key);
\r
185 void rsa_fingerprint(char *str, int len, struct RSAKey *key);
\r
186 int rsa_verify(struct RSAKey *key);
\r
187 unsigned char *rsa_public_blob(struct RSAKey *key, int *len);
\r
188 int rsa_public_blob_len(void *data, int maxlen);
\r
189 void freersakey(struct RSAKey *key);
\r
191 #ifndef PUTTY_UINT32_DEFINED
\r
192 /* This makes assumptions about the int type. */
\r
193 typedef unsigned int uint32;
\r
194 #define PUTTY_UINT32_DEFINED
\r
196 typedef uint32 word32;
\r
198 unsigned long crc32_compute(const void *s, size_t len);
\r
199 unsigned long crc32_update(unsigned long crc_input, const void *s, size_t len);
\r
201 /* SSH CRC compensation attack detector */
\r
202 void *crcda_make_context(void);
\r
203 void crcda_free_context(void *handle);
\r
204 int detect_attack(void *handle, unsigned char *buf, uint32 len,
\r
205 unsigned char *IV);
\r
208 * SSH2 RSA key exchange functions
\r
211 void *ssh_rsakex_newkey(char *data, int len);
\r
212 void ssh_rsakex_freekey(void *key);
\r
213 int ssh_rsakex_klen(void *key);
\r
214 void ssh_rsakex_encrypt(const struct ssh_hash *h, unsigned char *in, int inlen,
\r
215 unsigned char *out, int outlen,
\r
219 * SSH2 ECDH key exchange functions
\r
222 const char *ssh_ecdhkex_curve_textname(const struct ssh_kex *kex);
\r
223 void *ssh_ecdhkex_newkey(const struct ssh_kex *kex);
\r
224 void ssh_ecdhkex_freekey(void *key);
\r
225 char *ssh_ecdhkex_getpublic(void *key, int *len);
\r
226 Bignum ssh_ecdhkex_getkey(void *key, char *remoteKey, int remoteKeyLen);
\r
229 * Helper function for k generation in DSA, reused in ECDSA
\r
231 Bignum *dss_gen_k(const char *id_string, Bignum modulus, Bignum private_key,
\r
232 unsigned char *digest, int digest_len);
\r
238 struct MD5Context {
\r
240 unsigned long hHash;
\r
242 MD5_Core_State core;
\r
243 unsigned char block[64];
\r
245 uint32 lenhi, lenlo;
\r
249 void MD5Init(struct MD5Context *context);
\r
250 void MD5Update(struct MD5Context *context, unsigned char const *buf,
\r
252 void MD5Final(unsigned char digest[16], struct MD5Context *context);
\r
253 void MD5Simple(void const *p, unsigned len, unsigned char output[16]);
\r
255 void *hmacmd5_make_context(void *);
\r
256 void hmacmd5_free_context(void *handle);
\r
257 void hmacmd5_key(void *handle, void const *key, int len);
\r
258 void hmacmd5_do_hmac(void *handle, unsigned char const *blk, int len,
\r
259 unsigned char *hmac);
\r
263 unsigned char block[64];
\r
265 uint32 lenhi, lenlo;
\r
267 void SHA_Init(SHA_State * s);
\r
268 void SHA_Bytes(SHA_State * s, const void *p, int len);
\r
269 void SHA_Final(SHA_State * s, unsigned char *output);
\r
270 void SHA_Simple(const void *p, int len, unsigned char *output);
\r
272 void hmac_sha1_simple(void *key, int keylen, void *data, int datalen,
\r
273 unsigned char *output);
\r
276 unsigned char block[64];
\r
278 uint32 lenhi, lenlo;
\r
280 void SHA256_Init(SHA256_State * s);
\r
281 void SHA256_Bytes(SHA256_State * s, const void *p, int len);
\r
282 void SHA256_Final(SHA256_State * s, unsigned char *output);
\r
283 void SHA256_Simple(const void *p, int len, unsigned char *output);
\r
287 unsigned char block[128];
\r
291 #define SHA384_State SHA512_State
\r
292 void SHA512_Init(SHA512_State * s);
\r
293 void SHA512_Bytes(SHA512_State * s, const void *p, int len);
\r
294 void SHA512_Final(SHA512_State * s, unsigned char *output);
\r
295 void SHA512_Simple(const void *p, int len, unsigned char *output);
\r
296 void SHA384_Init(SHA384_State * s);
\r
297 #define SHA384_Bytes(s, p, len) SHA512_Bytes(s, p, len)
\r
298 void SHA384_Final(SHA384_State * s, unsigned char *output);
\r
299 void SHA384_Simple(const void *p, int len, unsigned char *output);
\r
302 struct ssh_cipher {
\r
303 void *(*make_context)(void);
\r
304 void (*free_context)(void *);
\r
305 void (*sesskey) (void *, unsigned char *key); /* for SSH-1 */
\r
306 void (*encrypt) (void *, unsigned char *blk, int len);
\r
307 void (*decrypt) (void *, unsigned char *blk, int len);
\r
309 const char *text_name;
\r
312 struct ssh2_cipher {
\r
313 void *(*make_context)(void);
\r
314 void (*free_context)(void *);
\r
315 void (*setiv) (void *, unsigned char *key); /* for SSH-2 */
\r
316 void (*setkey) (void *, unsigned char *key);/* for SSH-2 */
\r
317 void (*encrypt) (void *, unsigned char *blk, int len);
\r
318 void (*decrypt) (void *, unsigned char *blk, int len);
\r
319 /* Ignored unless SSH_CIPHER_SEPARATE_LENGTH flag set */
\r
320 void (*encrypt_length) (void *, unsigned char *blk, int len, unsigned long seq);
\r
321 void (*decrypt_length) (void *, unsigned char *blk, int len, unsigned long seq);
\r
324 /* real_keybits is the number of bits of entropy genuinely used by
\r
325 * the cipher scheme; it's used for deciding how big a
\r
326 * Diffie-Hellman group is needed to exchange a key for the
\r
329 /* padded_keybytes is the number of bytes of key data expected as
\r
330 * input to the setkey function; it's used for deciding how much
\r
331 * data needs to be generated from the post-kex generation of key
\r
332 * material. In a sensible cipher which uses all its key bytes for
\r
333 * real work, this will just be real_keybits/8, but in DES-type
\r
334 * ciphers which ignore one bit in each byte, it'll be slightly
\r
336 int padded_keybytes;
\r
337 unsigned int flags;
\r
338 #define SSH_CIPHER_IS_CBC 1
\r
339 #define SSH_CIPHER_SEPARATE_LENGTH 2
\r
340 const char *text_name;
\r
341 /* If set, this takes priority over other MAC. */
\r
342 const struct ssh_mac *required_mac;
\r
345 struct ssh2_ciphers {
\r
347 const struct ssh2_cipher *const *list;
\r
351 /* Passes in the cipher context */
\r
352 void *(*make_context)(void *);
\r
353 void (*free_context)(void *);
\r
354 void (*setkey) (void *, unsigned char *key);
\r
355 /* whole-packet operations */
\r
356 void (*generate) (void *, unsigned char *blk, int len, unsigned long seq);
\r
357 int (*verify) (void *, unsigned char *blk, int len, unsigned long seq);
\r
358 /* partial-packet operations */
\r
359 void (*start) (void *);
\r
360 void (*bytes) (void *, unsigned char const *, int);
\r
361 void (*genresult) (void *, unsigned char *);
\r
362 int (*verresult) (void *, unsigned char const *);
\r
363 const char *name, *etm_name;
\r
365 const char *text_name;
\r
369 void *(*init)(void); /* also allocates context */
\r
370 void *(*copy)(const void *);
\r
371 void (*bytes)(void *, const void *, int);
\r
372 void (*final)(void *, unsigned char *); /* also frees context */
\r
373 void (*free)(void *);
\r
374 int hlen; /* output length in bytes */
\r
375 const char *text_name;
\r
379 const char *name, *groupname;
\r
380 enum { KEXTYPE_DH, KEXTYPE_RSA, KEXTYPE_ECDH } main_type;
\r
381 const struct ssh_hash *hash;
\r
382 const void *extra; /* private to the kex methods */
\r
387 const struct ssh_kex *const *list;
\r
390 struct ssh_signkey {
\r
391 void *(*newkey) (const struct ssh_signkey *self,
\r
392 const char *data, int len);
\r
393 void (*freekey) (void *key);
\r
394 char *(*fmtkey) (void *key);
\r
395 unsigned char *(*public_blob) (void *key, int *len);
\r
396 unsigned char *(*private_blob) (void *key, int *len);
\r
397 void *(*createkey) (const struct ssh_signkey *self,
\r
398 const unsigned char *pub_blob, int pub_len,
\r
399 const unsigned char *priv_blob, int priv_len);
\r
400 void *(*openssh_createkey) (const struct ssh_signkey *self,
\r
401 const unsigned char **blob, int *len);
\r
402 int (*openssh_fmtkey) (void *key, unsigned char *blob, int len);
\r
403 /* OpenSSH private key blobs, as created by openssh_fmtkey and
\r
404 * consumed by openssh_createkey, always (at least so far...) take
\r
405 * the form of a number of SSH-2 strings / mpints concatenated
\r
406 * end-to-end. Because the new-style OpenSSH private key format
\r
407 * stores those blobs without a containing string wrapper, we need
\r
408 * to know how many strings each one consists of, so that we can
\r
409 * skip over the right number to find the next key in the file.
\r
410 * openssh_private_npieces gives that information. */
\r
411 int openssh_private_npieces;
\r
412 int (*pubkey_bits) (const struct ssh_signkey *self,
\r
413 const void *blob, int len);
\r
414 int (*verifysig) (void *key, const char *sig, int siglen,
\r
415 const char *data, int datalen);
\r
416 unsigned char *(*sign) (void *key, const char *data, int datalen,
\r
419 const char *keytype; /* for host key cache */
\r
420 const void *extra; /* private to the public key methods */
\r
423 struct ssh_compress {
\r
425 /* For zlib@openssh.com: if non-NULL, this name will be considered once
\r
426 * userauth has completed successfully. */
\r
427 const char *delayed_name;
\r
428 void *(*compress_init) (void);
\r
429 void (*compress_cleanup) (void *);
\r
430 int (*compress) (void *, unsigned char *block, int len,
\r
431 unsigned char **outblock, int *outlen);
\r
432 void *(*decompress_init) (void);
\r
433 void (*decompress_cleanup) (void *);
\r
434 int (*decompress) (void *, unsigned char *block, int len,
\r
435 unsigned char **outblock, int *outlen);
\r
436 int (*disable_compression) (void *);
\r
437 const char *text_name;
\r
440 struct ssh2_userkey {
\r
441 const struct ssh_signkey *alg; /* the key algorithm */
\r
442 void *data; /* the key data */
\r
443 char *comment; /* the key comment */
\r
446 /* The maximum length of any hash algorithm used in kex. (bytes) */
\r
447 #define SSH2_KEX_MAX_HASH_LEN (64) /* SHA-512 */
\r
449 extern const struct ssh_cipher ssh_3des;
\r
450 extern const struct ssh_cipher ssh_des;
\r
451 extern const struct ssh_cipher ssh_blowfish_ssh1;
\r
452 extern const struct ssh2_ciphers ssh2_3des;
\r
453 extern const struct ssh2_ciphers ssh2_des;
\r
454 extern const struct ssh2_ciphers ssh2_aes;
\r
455 extern const struct ssh2_ciphers ssh2_blowfish;
\r
456 extern const struct ssh2_ciphers ssh2_arcfour;
\r
457 extern const struct ssh2_ciphers ssh2_ccp;
\r
458 extern const struct ssh_hash ssh_sha1;
\r
459 extern const struct ssh_hash ssh_sha256;
\r
460 extern const struct ssh_hash ssh_sha384;
\r
461 extern const struct ssh_hash ssh_sha512;
\r
462 extern const struct ssh_kexes ssh_diffiehellman_group1;
\r
463 extern const struct ssh_kexes ssh_diffiehellman_group14;
\r
464 extern const struct ssh_kexes ssh_diffiehellman_gex;
\r
465 extern const struct ssh_kexes ssh_rsa_kex;
\r
466 extern const struct ssh_kexes ssh_ecdh_kex;
\r
467 extern const struct ssh_signkey ssh_dss;
\r
468 extern const struct ssh_signkey ssh_rsa;
\r
469 extern const struct ssh_signkey ssh_ecdsa_ed25519;
\r
470 extern const struct ssh_signkey ssh_ecdsa_nistp256;
\r
471 extern const struct ssh_signkey ssh_ecdsa_nistp384;
\r
472 extern const struct ssh_signkey ssh_ecdsa_nistp521;
\r
473 extern const struct ssh_mac ssh_hmac_md5;
\r
474 extern const struct ssh_mac ssh_hmac_sha1;
\r
475 extern const struct ssh_mac ssh_hmac_sha1_buggy;
\r
476 extern const struct ssh_mac ssh_hmac_sha1_96;
\r
477 extern const struct ssh_mac ssh_hmac_sha1_96_buggy;
\r
478 extern const struct ssh_mac ssh_hmac_sha256;
\r
480 void *aes_make_context(void);
\r
481 void aes_free_context(void *handle);
\r
482 void aes128_key(void *handle, unsigned char *key);
\r
483 void aes192_key(void *handle, unsigned char *key);
\r
484 void aes256_key(void *handle, unsigned char *key);
\r
485 void aes_iv(void *handle, unsigned char *iv);
\r
486 void aes_ssh2_encrypt_blk(void *handle, unsigned char *blk, int len);
\r
487 void aes_ssh2_decrypt_blk(void *handle, unsigned char *blk, int len);
\r
490 * PuTTY version number formatted as an SSH version string.
\r
492 extern const char sshver[];
\r
495 * Gross hack: pscp will try to start SFTP but fall back to scp1 if
\r
496 * that fails. This variable is the means by which scp.c can reach
\r
497 * into the SSH code and find out which one it got.
\r
499 extern int ssh_fallback_cmd(void *handle);
\r
501 #ifndef MSCRYPTOAPI
\r
502 void SHATransform(word32 * digest, word32 * data);
\r
505 int random_byte(void);
\r
506 void random_add_noise(void *noise, int length);
\r
507 void random_add_heavynoise(void *noise, int length);
\r
509 void logevent(void *, const char *);
\r
511 struct PortForwarding;
\r
513 /* Allocate and register a new channel for port forwarding */
\r
514 void *new_sock_channel(void *handle, struct PortForwarding *pf);
\r
515 void ssh_send_port_open(void *channel, const char *hostname, int port,
\r
518 /* Exports from portfwd.c */
\r
519 extern char *pfd_connect(struct PortForwarding **pf, char *hostname, int port,
\r
520 void *c, Conf *conf, int addressfamily);
\r
521 extern void pfd_close(struct PortForwarding *);
\r
522 extern int pfd_send(struct PortForwarding *, char *data, int len);
\r
523 extern void pfd_send_eof(struct PortForwarding *);
\r
524 extern void pfd_confirm(struct PortForwarding *);
\r
525 extern void pfd_unthrottle(struct PortForwarding *);
\r
526 extern void pfd_override_throttle(struct PortForwarding *, int enable);
\r
527 struct PortListener;
\r
528 /* desthost == NULL indicates dynamic (SOCKS) port forwarding */
\r
529 extern char *pfl_listen(char *desthost, int destport, char *srcaddr,
\r
530 int port, void *backhandle, Conf *conf,
\r
531 struct PortListener **pl, int address_family);
\r
532 extern void pfl_terminate(struct PortListener *);
\r
534 /* Exports from x11fwd.c */
\r
536 X11_TRANS_IPV4 = 0, X11_TRANS_IPV6 = 6, X11_TRANS_UNIX = 256
\r
538 struct X11Display {
\r
539 /* Broken-down components of the display name itself */
\r
544 /* OSX sometimes replaces all the above with a full Unix-socket pathname */
\r
545 char *unixsocketpath;
\r
547 /* PuTTY networking SockAddr to connect to the display, and associated
\r
553 /* Our local auth details for talking to the real X display. */
\r
554 int localauthproto;
\r
555 unsigned char *localauthdata;
\r
556 int localauthdatalen;
\r
558 struct X11FakeAuth {
\r
559 /* Auth details we invented for a virtual display on the SSH server. */
\r
561 unsigned char *data;
\r
566 /* The encrypted form of the first block, in XDM-AUTHORIZATION-1.
\r
567 * Used as part of the key when these structures are organised
\r
568 * into a tree. See x11_invent_fake_auth for explanation. */
\r
569 unsigned char *xa1_firstblock;
\r
572 * Used inside x11fwd.c to remember recently seen
\r
573 * XDM-AUTHORIZATION-1 strings, to avoid replay attacks.
\r
578 * What to do with an X connection matching this auth data.
\r
580 struct X11Display *disp;
\r
581 void *share_cs, *share_chan;
\r
583 void *x11_make_greeting(int endian, int protomajor, int protominor,
\r
584 int auth_proto, const void *auth_data, int auth_len,
\r
585 const char *peer_ip, int peer_port,
\r
587 int x11_authcmp(void *av, void *bv); /* for putting X11FakeAuth in a tree234 */
\r
589 * x11_setup_display() parses the display variable and fills in an
\r
590 * X11Display structure. Some remote auth details are invented;
\r
591 * the supplied authtype parameter configures the preferred
\r
592 * authorisation protocol to use at the remote end. The local auth
\r
593 * details are looked up by calling platform_get_x11_auth.
\r
595 extern struct X11Display *x11_setup_display(const char *display, Conf *);
\r
596 void x11_free_display(struct X11Display *disp);
\r
597 struct X11FakeAuth *x11_invent_fake_auth(tree234 *t, int authtype);
\r
598 void x11_free_fake_auth(struct X11FakeAuth *auth);
\r
599 struct X11Connection; /* opaque outside x11fwd.c */
\r
600 struct X11Connection *x11_init(tree234 *authtree, void *, const char *, int);
\r
601 extern void x11_close(struct X11Connection *);
\r
602 extern int x11_send(struct X11Connection *, char *, int);
\r
603 extern void x11_send_eof(struct X11Connection *s);
\r
604 extern void x11_unthrottle(struct X11Connection *s);
\r
605 extern void x11_override_throttle(struct X11Connection *s, int enable);
\r
606 char *x11_display(const char *display);
\r
607 /* Platform-dependent X11 functions */
\r
608 extern void platform_get_x11_auth(struct X11Display *display, Conf *);
\r
609 /* examine a mostly-filled-in X11Display and fill in localauth* */
\r
610 extern const int platform_uses_x11_unix_by_default;
\r
611 /* choose default X transport in the absence of a specified one */
\r
612 SockAddr platform_get_x11_unix_address(const char *path, int displaynum);
\r
613 /* make up a SockAddr naming the address for displaynum */
\r
614 char *platform_get_x_display(void);
\r
615 /* allocated local X display string, if any */
\r
616 /* Callbacks in x11.c usable _by_ platform X11 functions */
\r
618 * This function does the job of platform_get_x11_auth, provided
\r
619 * it is told where to find a normally formatted .Xauthority file:
\r
620 * it opens that file, parses it to find an auth record which
\r
621 * matches the display details in "display", and fills in the
\r
622 * localauth fields.
\r
624 * It is expected that most implementations of
\r
625 * platform_get_x11_auth() will work by finding their system's
\r
626 * .Xauthority file, adjusting the display details if necessary
\r
627 * for local oddities like Unix-domain socket transport, and
\r
628 * calling this function to do the rest of the work.
\r
630 void x11_get_auth_from_authfile(struct X11Display *display,
\r
631 const char *authfilename);
\r
632 int x11_identify_auth_proto(const char *proto);
\r
633 void *x11_dehexify(const char *hex, int *outlen);
\r
635 Bignum copybn(Bignum b);
\r
636 Bignum bn_power_2(int n);
\r
637 void bn_restore_invariant(Bignum b);
\r
638 Bignum bignum_from_long(unsigned long n);
\r
639 void freebn(Bignum b);
\r
640 Bignum modpow(Bignum base, Bignum exp, Bignum mod);
\r
641 Bignum modmul(Bignum a, Bignum b, Bignum mod);
\r
642 Bignum modsub(const Bignum a, const Bignum b, const Bignum n);
\r
643 void decbn(Bignum n);
\r
644 extern Bignum Zero, One;
\r
645 Bignum bignum_from_bytes(const unsigned char *data, int nbytes);
\r
646 Bignum bignum_from_bytes_le(const unsigned char *data, int nbytes);
\r
647 Bignum bignum_random_in_range(const Bignum lower, const Bignum upper);
\r
648 int ssh1_read_bignum(const unsigned char *data, int len, Bignum * result);
\r
649 int bignum_bitcount(Bignum bn);
\r
650 int ssh1_bignum_length(Bignum bn);
\r
651 int ssh2_bignum_length(Bignum bn);
\r
652 int bignum_byte(Bignum bn, int i);
\r
653 int bignum_bit(Bignum bn, int i);
\r
654 void bignum_set_bit(Bignum bn, int i, int value);
\r
655 int ssh1_write_bignum(void *data, Bignum bn);
\r
656 Bignum biggcd(Bignum a, Bignum b);
\r
657 unsigned short bignum_mod_short(Bignum number, unsigned short modulus);
\r
658 Bignum bignum_add_long(Bignum number, unsigned long addend);
\r
659 Bignum bigadd(Bignum a, Bignum b);
\r
660 Bignum bigsub(Bignum a, Bignum b);
\r
661 Bignum bigmul(Bignum a, Bignum b);
\r
662 Bignum bigmuladd(Bignum a, Bignum b, Bignum addend);
\r
663 Bignum bigdiv(Bignum a, Bignum b);
\r
664 Bignum bigmod(Bignum a, Bignum b);
\r
665 Bignum modinv(Bignum number, Bignum modulus);
\r
666 Bignum bignum_bitmask(Bignum number);
\r
667 Bignum bignum_rshift(Bignum number, int shift);
\r
668 Bignum bignum_lshift(Bignum number, int shift);
\r
669 int bignum_cmp(Bignum a, Bignum b);
\r
670 char *bignum_decimal(Bignum x);
\r
671 Bignum bignum_from_decimal(const char *decimal);
\r
674 void diagbn(char *prefix, Bignum md);
\r
677 int dh_is_gex(const struct ssh_kex *kex);
\r
678 void *dh_setup_group(const struct ssh_kex *kex);
\r
679 void *dh_setup_gex(Bignum pval, Bignum gval);
\r
680 void dh_cleanup(void *);
\r
681 Bignum dh_create_e(void *, int nbits);
\r
682 const char *dh_validate_f(void *handle, Bignum f);
\r
683 Bignum dh_find_K(void *, Bignum f);
\r
685 int loadrsakey(const Filename *filename, struct RSAKey *key,
\r
686 const char *passphrase, const char **errorstr);
\r
687 int rsakey_encrypted(const Filename *filename, char **comment);
\r
688 int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
\r
689 char **commentptr, const char **errorstr);
\r
691 int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
\r
693 extern int base64_decode_atom(const char *atom, unsigned char *out);
\r
694 extern int base64_lines(int datalen);
\r
695 extern void base64_encode_atom(const unsigned char *data, int n, char *out);
\r
696 extern void base64_encode(FILE *fp, const unsigned char *data, int datalen,
\r
699 /* ssh2_load_userkey can return this as an error */
\r
700 extern struct ssh2_userkey ssh2_wrong_passphrase;
\r
701 #define SSH2_WRONG_PASSPHRASE (&ssh2_wrong_passphrase)
\r
703 int ssh2_userkey_encrypted(const Filename *filename, char **comment);
\r
704 struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
\r
705 const char *passphrase,
\r
706 const char **errorstr);
\r
707 unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
\r
708 int *pub_blob_len, char **commentptr,
\r
709 const char **errorstr);
\r
710 int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
\r
712 const struct ssh_signkey *find_pubkey_alg(const char *name);
\r
713 const struct ssh_signkey *find_pubkey_alg_len(int namelen, const char *name);
\r
716 SSH_KEYTYPE_UNOPENABLE,
\r
717 SSH_KEYTYPE_UNKNOWN,
\r
718 SSH_KEYTYPE_SSH1, SSH_KEYTYPE_SSH2,
\r
720 * The OpenSSH key types deserve a little explanation. OpenSSH has
\r
721 * two physical formats for private key storage: an old PEM-based
\r
722 * one largely dictated by their use of OpenSSL and full of ASN.1,
\r
723 * and a new one using the same private key formats used over the
\r
724 * wire for talking to ssh-agent. The old format can only support
\r
725 * a subset of the key types, because it needs redesign for each
\r
726 * key type, and after a while they decided to move to the new
\r
727 * format so as not to have to do that.
\r
729 * On input, key files are identified as either
\r
730 * SSH_KEYTYPE_OPENSSH_PEM or SSH_KEYTYPE_OPENSSH_NEW, describing
\r
731 * accurately which actual format the keys are stored in.
\r
733 * On output, however, we default to following OpenSSH's own
\r
734 * policy of writing out PEM-style keys for maximum backwards
\r
735 * compatibility if the key type supports it, and otherwise
\r
736 * switching to the new format. So the formats you can select for
\r
737 * output are SSH_KEYTYPE_OPENSSH_NEW (forcing the new format for
\r
738 * any key type), and SSH_KEYTYPE_OPENSSH_AUTO to use the oldest
\r
739 * format supported by whatever key type you're writing out.
\r
741 * So we have three type codes, but only two of them usable in any
\r
742 * given circumstance. An input key file will never be identified
\r
743 * as AUTO, only PEM or NEW; key export UIs should not be able to
\r
744 * select PEM, only AUTO or NEW.
\r
746 SSH_KEYTYPE_OPENSSH_AUTO,
\r
747 SSH_KEYTYPE_OPENSSH_PEM,
\r
748 SSH_KEYTYPE_OPENSSH_NEW,
\r
749 SSH_KEYTYPE_SSHCOM,
\r
751 * Public-key-only formats, which we still want to be able to read
\r
752 * for various purposes.
\r
754 SSH_KEYTYPE_SSH1_PUBLIC,
\r
755 SSH_KEYTYPE_SSH2_PUBLIC_RFC4716,
\r
756 SSH_KEYTYPE_SSH2_PUBLIC_OPENSSH
\r
758 char *ssh1_pubkey_str(struct RSAKey *ssh1key);
\r
759 void ssh1_write_pubkey(FILE *fp, struct RSAKey *ssh1key);
\r
760 char *ssh2_pubkey_openssh_str(struct ssh2_userkey *key);
\r
761 void ssh2_write_pubkey(FILE *fp, const char *comment,
\r
762 const void *v_pub_blob, int pub_len,
\r
764 char *ssh2_fingerprint_blob(const void *blob, int bloblen);
\r
765 char *ssh2_fingerprint(const struct ssh_signkey *alg, void *data);
\r
766 int key_type(const Filename *filename);
\r
767 const char *key_type_to_str(int type);
\r
769 int import_possible(int type);
\r
770 int import_target_type(int type);
\r
771 int import_encrypted(const Filename *filename, int type, char **comment);
\r
772 int import_ssh1(const Filename *filename, int type,
\r
773 struct RSAKey *key, char *passphrase, const char **errmsg_p);
\r
774 struct ssh2_userkey *import_ssh2(const Filename *filename, int type,
\r
775 char *passphrase, const char **errmsg_p);
\r
776 int export_ssh1(const Filename *filename, int type,
\r
777 struct RSAKey *key, char *passphrase);
\r
778 int export_ssh2(const Filename *filename, int type,
\r
779 struct ssh2_userkey *key, char *passphrase);
\r
781 void des3_decrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
\r
782 void des3_encrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
\r
783 void des3_decrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
\r
784 unsigned char *blk, int len);
\r
785 void des3_encrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
\r
786 unsigned char *blk, int len);
\r
787 void aes256_encrypt_pubkey(unsigned char *key, unsigned char *blk,
\r
789 void aes256_decrypt_pubkey(unsigned char *key, unsigned char *blk,
\r
792 void des_encrypt_xdmauth(const unsigned char *key,
\r
793 unsigned char *blk, int len);
\r
794 void des_decrypt_xdmauth(const unsigned char *key,
\r
795 unsigned char *blk, int len);
\r
797 void openssh_bcrypt(const char *passphrase,
\r
798 const unsigned char *salt, int saltbytes,
\r
799 int rounds, unsigned char *out, int outbytes);
\r
802 * For progress updates in the key generation utility.
\r
804 #define PROGFN_INITIALISE 1
\r
805 #define PROGFN_LIN_PHASE 2
\r
806 #define PROGFN_EXP_PHASE 3
\r
807 #define PROGFN_PHASE_EXTENT 4
\r
808 #define PROGFN_READY 5
\r
809 #define PROGFN_PROGRESS 6
\r
810 typedef void (*progfn_t) (void *param, int action, int phase, int progress);
\r
812 int rsa_generate(struct RSAKey *key, int bits, progfn_t pfn,
\r
814 int dsa_generate(struct dss_key *key, int bits, progfn_t pfn,
\r
816 int ec_generate(struct ec_key *key, int bits, progfn_t pfn,
\r
818 int ec_edgenerate(struct ec_key *key, int bits, progfn_t pfn,
\r
820 Bignum primegen(int bits, int modulus, int residue, Bignum factor,
\r
821 int phase, progfn_t pfn, void *pfnparam, unsigned firstbits);
\r
822 void invent_firstbits(unsigned *one, unsigned *two);
\r
826 * zlib compression.
\r
828 void *zlib_compress_init(void);
\r
829 void zlib_compress_cleanup(void *);
\r
830 void *zlib_decompress_init(void);
\r
831 void zlib_decompress_cleanup(void *);
\r
832 int zlib_compress_block(void *, unsigned char *block, int len,
\r
833 unsigned char **outblock, int *outlen);
\r
834 int zlib_decompress_block(void *, unsigned char *block, int len,
\r
835 unsigned char **outblock, int *outlen);
\r
838 * Connection-sharing API provided by platforms. This function must
\r
840 * - return SHARE_NONE and do nothing
\r
841 * - return SHARE_DOWNSTREAM and set *sock to a Socket connected to
\r
843 * - return SHARE_UPSTREAM and set *sock to a Socket connected to
\r
846 enum { SHARE_NONE, SHARE_DOWNSTREAM, SHARE_UPSTREAM };
\r
847 int platform_ssh_share(const char *name, Conf *conf,
\r
848 Plug downplug, Plug upplug, Socket *sock,
\r
849 char **logtext, char **ds_err, char **us_err,
\r
850 int can_upstream, int can_downstream);
\r
851 void platform_ssh_share_cleanup(const char *name);
\r
854 * SSH-1 message type codes.
\r
856 #define SSH1_MSG_DISCONNECT 1 /* 0x1 */
\r
857 #define SSH1_SMSG_PUBLIC_KEY 2 /* 0x2 */
\r
858 #define SSH1_CMSG_SESSION_KEY 3 /* 0x3 */
\r
859 #define SSH1_CMSG_USER 4 /* 0x4 */
\r
860 #define SSH1_CMSG_AUTH_RSA 6 /* 0x6 */
\r
861 #define SSH1_SMSG_AUTH_RSA_CHALLENGE 7 /* 0x7 */
\r
862 #define SSH1_CMSG_AUTH_RSA_RESPONSE 8 /* 0x8 */
\r
863 #define SSH1_CMSG_AUTH_PASSWORD 9 /* 0x9 */
\r
864 #define SSH1_CMSG_REQUEST_PTY 10 /* 0xa */
\r
865 #define SSH1_CMSG_WINDOW_SIZE 11 /* 0xb */
\r
866 #define SSH1_CMSG_EXEC_SHELL 12 /* 0xc */
\r
867 #define SSH1_CMSG_EXEC_CMD 13 /* 0xd */
\r
868 #define SSH1_SMSG_SUCCESS 14 /* 0xe */
\r
869 #define SSH1_SMSG_FAILURE 15 /* 0xf */
\r
870 #define SSH1_CMSG_STDIN_DATA 16 /* 0x10 */
\r
871 #define SSH1_SMSG_STDOUT_DATA 17 /* 0x11 */
\r
872 #define SSH1_SMSG_STDERR_DATA 18 /* 0x12 */
\r
873 #define SSH1_CMSG_EOF 19 /* 0x13 */
\r
874 #define SSH1_SMSG_EXIT_STATUS 20 /* 0x14 */
\r
875 #define SSH1_MSG_CHANNEL_OPEN_CONFIRMATION 21 /* 0x15 */
\r
876 #define SSH1_MSG_CHANNEL_OPEN_FAILURE 22 /* 0x16 */
\r
877 #define SSH1_MSG_CHANNEL_DATA 23 /* 0x17 */
\r
878 #define SSH1_MSG_CHANNEL_CLOSE 24 /* 0x18 */
\r
879 #define SSH1_MSG_CHANNEL_CLOSE_CONFIRMATION 25 /* 0x19 */
\r
880 #define SSH1_SMSG_X11_OPEN 27 /* 0x1b */
\r
881 #define SSH1_CMSG_PORT_FORWARD_REQUEST 28 /* 0x1c */
\r
882 #define SSH1_MSG_PORT_OPEN 29 /* 0x1d */
\r
883 #define SSH1_CMSG_AGENT_REQUEST_FORWARDING 30 /* 0x1e */
\r
884 #define SSH1_SMSG_AGENT_OPEN 31 /* 0x1f */
\r
885 #define SSH1_MSG_IGNORE 32 /* 0x20 */
\r
886 #define SSH1_CMSG_EXIT_CONFIRMATION 33 /* 0x21 */
\r
887 #define SSH1_CMSG_X11_REQUEST_FORWARDING 34 /* 0x22 */
\r
888 #define SSH1_CMSG_AUTH_RHOSTS_RSA 35 /* 0x23 */
\r
889 #define SSH1_MSG_DEBUG 36 /* 0x24 */
\r
890 #define SSH1_CMSG_REQUEST_COMPRESSION 37 /* 0x25 */
\r
891 #define SSH1_CMSG_AUTH_TIS 39 /* 0x27 */
\r
892 #define SSH1_SMSG_AUTH_TIS_CHALLENGE 40 /* 0x28 */
\r
893 #define SSH1_CMSG_AUTH_TIS_RESPONSE 41 /* 0x29 */
\r
894 #define SSH1_CMSG_AUTH_CCARD 70 /* 0x46 */
\r
895 #define SSH1_SMSG_AUTH_CCARD_CHALLENGE 71 /* 0x47 */
\r
896 #define SSH1_CMSG_AUTH_CCARD_RESPONSE 72 /* 0x48 */
\r
898 #define SSH1_AUTH_RHOSTS 1 /* 0x1 */
\r
899 #define SSH1_AUTH_RSA 2 /* 0x2 */
\r
900 #define SSH1_AUTH_PASSWORD 3 /* 0x3 */
\r
901 #define SSH1_AUTH_RHOSTS_RSA 4 /* 0x4 */
\r
902 #define SSH1_AUTH_TIS 5 /* 0x5 */
\r
903 #define SSH1_AUTH_CCARD 16 /* 0x10 */
\r
905 #define SSH1_PROTOFLAG_SCREEN_NUMBER 1 /* 0x1 */
\r
906 /* Mask for protoflags we will echo back to server if seen */
\r
907 #define SSH1_PROTOFLAGS_SUPPORTED 0 /* 0x1 */
\r
910 * SSH-2 message type codes.
\r
912 #define SSH2_MSG_DISCONNECT 1 /* 0x1 */
\r
913 #define SSH2_MSG_IGNORE 2 /* 0x2 */
\r
914 #define SSH2_MSG_UNIMPLEMENTED 3 /* 0x3 */
\r
915 #define SSH2_MSG_DEBUG 4 /* 0x4 */
\r
916 #define SSH2_MSG_SERVICE_REQUEST 5 /* 0x5 */
\r
917 #define SSH2_MSG_SERVICE_ACCEPT 6 /* 0x6 */
\r
918 #define SSH2_MSG_KEXINIT 20 /* 0x14 */
\r
919 #define SSH2_MSG_NEWKEYS 21 /* 0x15 */
\r
920 #define SSH2_MSG_KEXDH_INIT 30 /* 0x1e */
\r
921 #define SSH2_MSG_KEXDH_REPLY 31 /* 0x1f */
\r
922 #define SSH2_MSG_KEX_DH_GEX_REQUEST_OLD 30 /* 0x1e */
\r
923 #define SSH2_MSG_KEX_DH_GEX_REQUEST 34 /* 0x22 */
\r
924 #define SSH2_MSG_KEX_DH_GEX_GROUP 31 /* 0x1f */
\r
925 #define SSH2_MSG_KEX_DH_GEX_INIT 32 /* 0x20 */
\r
926 #define SSH2_MSG_KEX_DH_GEX_REPLY 33 /* 0x21 */
\r
927 #define SSH2_MSG_KEXRSA_PUBKEY 30 /* 0x1e */
\r
928 #define SSH2_MSG_KEXRSA_SECRET 31 /* 0x1f */
\r
929 #define SSH2_MSG_KEXRSA_DONE 32 /* 0x20 */
\r
930 #define SSH2_MSG_KEX_ECDH_INIT 30 /* 0x1e */
\r
931 #define SSH2_MSG_KEX_ECDH_REPLY 31 /* 0x1f */
\r
932 #define SSH2_MSG_KEX_ECMQV_INIT 30 /* 0x1e */
\r
933 #define SSH2_MSG_KEX_ECMQV_REPLY 31 /* 0x1f */
\r
934 #define SSH2_MSG_USERAUTH_REQUEST 50 /* 0x32 */
\r
935 #define SSH2_MSG_USERAUTH_FAILURE 51 /* 0x33 */
\r
936 #define SSH2_MSG_USERAUTH_SUCCESS 52 /* 0x34 */
\r
937 #define SSH2_MSG_USERAUTH_BANNER 53 /* 0x35 */
\r
938 #define SSH2_MSG_USERAUTH_PK_OK 60 /* 0x3c */
\r
939 #define SSH2_MSG_USERAUTH_PASSWD_CHANGEREQ 60 /* 0x3c */
\r
940 #define SSH2_MSG_USERAUTH_INFO_REQUEST 60 /* 0x3c */
\r
941 #define SSH2_MSG_USERAUTH_INFO_RESPONSE 61 /* 0x3d */
\r
942 #define SSH2_MSG_GLOBAL_REQUEST 80 /* 0x50 */
\r
943 #define SSH2_MSG_REQUEST_SUCCESS 81 /* 0x51 */
\r
944 #define SSH2_MSG_REQUEST_FAILURE 82 /* 0x52 */
\r
945 #define SSH2_MSG_CHANNEL_OPEN 90 /* 0x5a */
\r
946 #define SSH2_MSG_CHANNEL_OPEN_CONFIRMATION 91 /* 0x5b */
\r
947 #define SSH2_MSG_CHANNEL_OPEN_FAILURE 92 /* 0x5c */
\r
948 #define SSH2_MSG_CHANNEL_WINDOW_ADJUST 93 /* 0x5d */
\r
949 #define SSH2_MSG_CHANNEL_DATA 94 /* 0x5e */
\r
950 #define SSH2_MSG_CHANNEL_EXTENDED_DATA 95 /* 0x5f */
\r
951 #define SSH2_MSG_CHANNEL_EOF 96 /* 0x60 */
\r
952 #define SSH2_MSG_CHANNEL_CLOSE 97 /* 0x61 */
\r
953 #define SSH2_MSG_CHANNEL_REQUEST 98 /* 0x62 */
\r
954 #define SSH2_MSG_CHANNEL_SUCCESS 99 /* 0x63 */
\r
955 #define SSH2_MSG_CHANNEL_FAILURE 100 /* 0x64 */
\r
956 #define SSH2_MSG_USERAUTH_GSSAPI_RESPONSE 60
\r
957 #define SSH2_MSG_USERAUTH_GSSAPI_TOKEN 61
\r
958 #define SSH2_MSG_USERAUTH_GSSAPI_EXCHANGE_COMPLETE 63
\r
959 #define SSH2_MSG_USERAUTH_GSSAPI_ERROR 64
\r
960 #define SSH2_MSG_USERAUTH_GSSAPI_ERRTOK 65
\r
961 #define SSH2_MSG_USERAUTH_GSSAPI_MIC 66
\r
964 * SSH-1 agent messages.
\r
966 #define SSH1_AGENTC_REQUEST_RSA_IDENTITIES 1
\r
967 #define SSH1_AGENT_RSA_IDENTITIES_ANSWER 2
\r
968 #define SSH1_AGENTC_RSA_CHALLENGE 3
\r
969 #define SSH1_AGENT_RSA_RESPONSE 4
\r
970 #define SSH1_AGENTC_ADD_RSA_IDENTITY 7
\r
971 #define SSH1_AGENTC_REMOVE_RSA_IDENTITY 8
\r
972 #define SSH1_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9 /* openssh private? */
\r
975 * Messages common to SSH-1 and OpenSSH's SSH-2.
\r
977 #define SSH_AGENT_FAILURE 5
\r
978 #define SSH_AGENT_SUCCESS 6
\r
981 * OpenSSH's SSH-2 agent messages.
\r
983 #define SSH2_AGENTC_REQUEST_IDENTITIES 11
\r
984 #define SSH2_AGENT_IDENTITIES_ANSWER 12
\r
985 #define SSH2_AGENTC_SIGN_REQUEST 13
\r
986 #define SSH2_AGENT_SIGN_RESPONSE 14
\r
987 #define SSH2_AGENTC_ADD_IDENTITY 17
\r
988 #define SSH2_AGENTC_REMOVE_IDENTITY 18
\r
989 #define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
\r
992 * Assorted other SSH-related enumerations.
\r
994 #define SSH2_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT 1 /* 0x1 */
\r
995 #define SSH2_DISCONNECT_PROTOCOL_ERROR 2 /* 0x2 */
\r
996 #define SSH2_DISCONNECT_KEY_EXCHANGE_FAILED 3 /* 0x3 */
\r
997 #define SSH2_DISCONNECT_HOST_AUTHENTICATION_FAILED 4 /* 0x4 */
\r
998 #define SSH2_DISCONNECT_MAC_ERROR 5 /* 0x5 */
\r
999 #define SSH2_DISCONNECT_COMPRESSION_ERROR 6 /* 0x6 */
\r
1000 #define SSH2_DISCONNECT_SERVICE_NOT_AVAILABLE 7 /* 0x7 */
\r
1001 #define SSH2_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED 8 /* 0x8 */
\r
1002 #define SSH2_DISCONNECT_HOST_KEY_NOT_VERIFIABLE 9 /* 0x9 */
\r
1003 #define SSH2_DISCONNECT_CONNECTION_LOST 10 /* 0xa */
\r
1004 #define SSH2_DISCONNECT_BY_APPLICATION 11 /* 0xb */
\r
1005 #define SSH2_DISCONNECT_TOO_MANY_CONNECTIONS 12 /* 0xc */
\r
1006 #define SSH2_DISCONNECT_AUTH_CANCELLED_BY_USER 13 /* 0xd */
\r
1007 #define SSH2_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE 14 /* 0xe */
\r
1008 #define SSH2_DISCONNECT_ILLEGAL_USER_NAME 15 /* 0xf */
\r
1010 #define SSH2_OPEN_ADMINISTRATIVELY_PROHIBITED 1 /* 0x1 */
\r
1011 #define SSH2_OPEN_CONNECT_FAILED 2 /* 0x2 */
\r
1012 #define SSH2_OPEN_UNKNOWN_CHANNEL_TYPE 3 /* 0x3 */
\r
1013 #define SSH2_OPEN_RESOURCE_SHORTAGE 4 /* 0x4 */
\r
1015 #define SSH2_EXTENDED_DATA_STDERR 1 /* 0x1 */
\r
1018 * Need this to warn about support for the original SSH-2 keyfile
\r
1021 void old_keyfile_warning(void);
\r