Now that we use real gss_buffer_ts, there's no need to muck about with
[u/mdw/putty] / ssh.h
CommitLineData
df3c4460 1#include <stdio.h>
37508af4 2#include <string.h>
3
dcbde236 4#include "puttymem.h"
8def70c3 5#include "tree234.h"
d74d141c 6#include "network.h"
5c72ca61 7#include "int64.h"
9a30e26b 8#include "misc.h"
dcbde236 9
2871113a 10struct ssh_channel;
11
5471d09a 12extern void sshfwd_close(struct ssh_channel *c);
13extern int sshfwd_write(struct ssh_channel *c, char *, int);
14extern void sshfwd_unthrottle(struct ssh_channel *c, int bufsize);
15
e5574168 16/*
17 * Useful thing.
18 */
19#ifndef lenof
20#define lenof(x) ( (sizeof((x))) / (sizeof(*(x))))
21#endif
22
bea1ef5f 23#define SSH_CIPHER_IDEA 1
9697bfd2 24#define SSH_CIPHER_DES 2
bea1ef5f 25#define SSH_CIPHER_3DES 3
26#define SSH_CIPHER_BLOWFISH 6
27
e5574168 28#ifdef MSCRYPTOAPI
29#define APIEXTRA 8
30#else
31#define APIEXTRA 0
32#endif
33
3709bfe9 34#ifndef BIGNUM_INTERNAL
35typedef void *Bignum;
36#endif
7cca0d81 37
374330e2 38struct RSAKey {
39 int bits;
40 int bytes;
8f203108 41#ifdef MSCRYPTOAPI
42 unsigned long exponent;
43 unsigned char *modulus;
44#else
7cca0d81 45 Bignum modulus;
46 Bignum exponent;
47 Bignum private_exponent;
9400cf6f 48 Bignum p;
49 Bignum q;
50 Bignum iqmp;
65a22376 51#endif
52 char *comment;
9400cf6f 53};
54
5c72ca61 55struct dss_key {
56 Bignum p, q, g, y, x;
57};
58
0016d70b 59int makekey(unsigned char *data, int len, struct RSAKey *result,
7cca0d81 60 unsigned char **keystr, int order);
0016d70b 61int makeprivate(unsigned char *data, int len, struct RSAKey *result);
62int rsaencrypt(unsigned char *data, int length, struct RSAKey *key);
7cca0d81 63Bignum rsadecrypt(Bignum input, struct RSAKey *key);
64void rsasign(unsigned char *data, int length, struct RSAKey *key);
65void rsasanitise(struct RSAKey *key);
374330e2 66int rsastr_len(struct RSAKey *key);
67void rsastr_fmt(char *str, struct RSAKey *key);
1c2a93c4 68void rsa_fingerprint(char *str, int len, struct RSAKey *key);
014970c8 69int rsa_verify(struct RSAKey *key);
3f2d010c 70unsigned char *rsa_public_blob(struct RSAKey *key, int *len);
0016d70b 71int rsa_public_blob_len(void *data, int maxlen);
5c58ad2d 72void freersakey(struct RSAKey *key);
374330e2 73
74typedef unsigned int word32;
75typedef unsigned int uint32;
76
71bedafe 77unsigned long crc32_compute(const void *s, size_t len);
9a3a93a5 78unsigned long crc32_update(unsigned long crc_input, const void *s, size_t len);
79
80/* SSH CRC compensation attack detector */
0183b242 81void *crcda_make_context(void);
82void crcda_free_context(void *handle);
83int detect_attack(void *handle, unsigned char *buf, uint32 len,
84 unsigned char *IV);
374330e2 85
fae1a71b 86/*
87 * SSH2 RSA key exchange functions
88 */
89struct ssh_hash;
90void *ssh_rsakex_newkey(char *data, int len);
91void ssh_rsakex_freekey(void *key);
92int ssh_rsakex_klen(void *key);
93void ssh_rsakex_encrypt(const struct ssh_hash *h, unsigned char *in, int inlen,
94 unsigned char *out, int outlen,
95 void *key);
96
48672163 97typedef struct {
98 uint32 h[4];
99} MD5_Core_State;
100
374330e2 101struct MD5Context {
8f203108 102#ifdef MSCRYPTOAPI
103 unsigned long hHash;
104#else
48672163 105 MD5_Core_State core;
bb093ca7 106 unsigned char block[64];
48672163 107 int blkused;
108 uint32 lenhi, lenlo;
8f203108 109#endif
374330e2 110};
111
112void MD5Init(struct MD5Context *context);
113void MD5Update(struct MD5Context *context, unsigned char const *buf,
32874aea 114 unsigned len);
374330e2 115void MD5Final(unsigned char digest[16], struct MD5Context *context);
f33ba69e 116void MD5Simple(void const *p, unsigned len, unsigned char output[16]);
117
118void *hmacmd5_make_context(void);
119void hmacmd5_free_context(void *handle);
447f7a7b 120void hmacmd5_key(void *handle, void const *key, int len);
f33ba69e 121void hmacmd5_do_hmac(void *handle, unsigned char const *blk, int len,
122 unsigned char *hmac);
374330e2 123
e5574168 124typedef struct {
125 uint32 h[5];
126 unsigned char block[64];
127 int blkused;
128 uint32 lenhi, lenlo;
129} SHA_State;
32874aea 130void SHA_Init(SHA_State * s);
131void SHA_Bytes(SHA_State * s, void *p, int len);
132void SHA_Final(SHA_State * s, unsigned char *output);
7cca0d81 133void SHA_Simple(void *p, int len, unsigned char *output);
e5574168 134
5c72ca61 135void hmac_sha1_simple(void *key, int keylen, void *data, int datalen,
136 unsigned char *output);
062e5811 137typedef struct {
138 uint32 h[8];
139 unsigned char block[64];
140 int blkused;
141 uint32 lenhi, lenlo;
142} SHA256_State;
143void SHA256_Init(SHA256_State * s);
144void SHA256_Bytes(SHA256_State * s, const void *p, int len);
145void SHA256_Final(SHA256_State * s, unsigned char *output);
146void SHA256_Simple(const void *p, int len, unsigned char *output);
5c72ca61 147
148typedef struct {
149 uint64 h[8];
150 unsigned char block[128];
151 int blkused;
152 uint32 len[4];
153} SHA512_State;
154void SHA512_Init(SHA512_State * s);
155void SHA512_Bytes(SHA512_State * s, const void *p, int len);
156void SHA512_Final(SHA512_State * s, unsigned char *output);
157void SHA512_Simple(const void *p, int len, unsigned char *output);
158
374330e2 159struct ssh_cipher {
371e569c 160 void *(*make_context)(void);
161 void (*free_context)(void *);
2e85c969 162 void (*sesskey) (void *, unsigned char *key); /* for SSH-1 */
371e569c 163 void (*encrypt) (void *, unsigned char *blk, int len);
164 void (*decrypt) (void *, unsigned char *blk, int len);
0a3f1d48 165 int blksize;
371e569c 166 char *text_name;
0a3f1d48 167};
168
169struct ssh2_cipher {
371e569c 170 void *(*make_context)(void);
171 void (*free_context)(void *);
2e85c969 172 void (*setiv) (void *, unsigned char *key); /* for SSH-2 */
173 void (*setkey) (void *, unsigned char *key);/* for SSH-2 */
371e569c 174 void (*encrypt) (void *, unsigned char *blk, int len);
175 void (*decrypt) (void *, unsigned char *blk, int len);
e5574168 176 char *name;
177 int blksize;
d2a0e0be 178 int keylen;
97ab28d7 179 unsigned int flags;
180#define SSH_CIPHER_IS_CBC 1
371e569c 181 char *text_name;
e5574168 182};
183
0a3f1d48 184struct ssh2_ciphers {
185 int nciphers;
65a22376 186 const struct ssh2_cipher *const *list;
0a3f1d48 187};
188
e5574168 189struct ssh_mac {
e0e1a00d 190 void *(*make_context)(void);
191 void (*free_context)(void *);
192 void (*setkey) (void *, unsigned char *key);
193 void (*generate) (void *, unsigned char *blk, int len, unsigned long seq);
194 int (*verify) (void *, unsigned char *blk, int len, unsigned long seq);
e5574168 195 char *name;
196 int len;
6c135243 197 char *text_name;
e5574168 198};
199
b672f405 200struct ssh_hash {
201 void *(*init)(void); /* also allocates context */
202 void (*bytes)(void *, void *, int);
203 void (*final)(void *, unsigned char *); /* also frees context */
204 int hlen; /* output length in bytes */
c6daaa1a 205 char *text_name;
b672f405 206};
207
e5574168 208struct ssh_kex {
d1aaf71d 209 char *name, *groupname;
fae1a71b 210 enum { KEXTYPE_DH, KEXTYPE_RSA } main_type;
211 /* For DH */
212 const unsigned char *pdata, *gdata; /* NULL means group exchange */
d1aaf71d 213 int plen, glen;
b672f405 214 const struct ssh_hash *hash;
e5574168 215};
216
34557659 217struct ssh_kexes {
218 int nkexes;
219 const struct ssh_kex *const *list;
220};
221
e055a386 222struct ssh_signkey {
32874aea 223 void *(*newkey) (char *data, int len);
224 void (*freekey) (void *key);
225 char *(*fmtkey) (void *key);
226 unsigned char *(*public_blob) (void *key, int *len);
227 unsigned char *(*private_blob) (void *key, int *len);
228 void *(*createkey) (unsigned char *pub_blob, int pub_len,
229 unsigned char *priv_blob, int priv_len);
230 void *(*openssh_createkey) (unsigned char **blob, int *len);
231 int (*openssh_fmtkey) (void *key, unsigned char *blob, int len);
47a6b94c 232 int (*pubkey_bits) (void *blob, int len);
32874aea 233 char *(*fingerprint) (void *key);
234 int (*verifysig) (void *key, char *sig, int siglen,
235 char *data, int datalen);
236 unsigned char *(*sign) (void *key, char *data, int datalen,
237 int *siglen);
e5574168 238 char *name;
32874aea 239 char *keytype; /* for host key cache */
e5574168 240};
241
242struct ssh_compress {
243 char *name;
5366aed8 244 void *(*compress_init) (void);
245 void (*compress_cleanup) (void *);
246 int (*compress) (void *, unsigned char *block, int len,
32874aea 247 unsigned char **outblock, int *outlen);
5366aed8 248 void *(*decompress_init) (void);
249 void (*decompress_cleanup) (void *);
250 int (*decompress) (void *, unsigned char *block, int len,
32874aea 251 unsigned char **outblock, int *outlen);
5366aed8 252 int (*disable_compression) (void *);
253 char *text_name;
374330e2 254};
255
65a22376 256struct ssh2_userkey {
257 const struct ssh_signkey *alg; /* the key algorithm */
258 void *data; /* the key data */
259 char *comment; /* the key comment */
260};
261
754c0df9 262/* The maximum length of any hash algorithm used in kex. (bytes) */
263#define SSH2_KEX_MAX_HASH_LEN (32) /* SHA-256 */
264
65a22376 265extern const struct ssh_cipher ssh_3des;
266extern const struct ssh_cipher ssh_des;
267extern const struct ssh_cipher ssh_blowfish_ssh1;
268extern const struct ssh2_ciphers ssh2_3des;
0d7c43a6 269extern const struct ssh2_ciphers ssh2_des;
65a22376 270extern const struct ssh2_ciphers ssh2_aes;
271extern const struct ssh2_ciphers ssh2_blowfish;
a2add208 272extern const struct ssh2_ciphers ssh2_arcfour;
b672f405 273extern const struct ssh_hash ssh_sha1;
062e5811 274extern const struct ssh_hash ssh_sha256;
34557659 275extern const struct ssh_kexes ssh_diffiehellman_group1;
276extern const struct ssh_kexes ssh_diffiehellman_group14;
277extern const struct ssh_kexes ssh_diffiehellman_gex;
fae1a71b 278extern const struct ssh_kexes ssh_rsa_kex;
65a22376 279extern const struct ssh_signkey ssh_dss;
280extern const struct ssh_signkey ssh_rsa;
1993f323 281extern const struct ssh_mac ssh_hmac_md5;
282extern const struct ssh_mac ssh_hmac_sha1;
283extern const struct ssh_mac ssh_hmac_sha1_buggy;
6668a75e 284extern const struct ssh_mac ssh_hmac_sha1_96;
285extern const struct ssh_mac ssh_hmac_sha1_96_buggy;
1993f323 286
65a22376 287
900a4ee6 288/*
289 * PuTTY version number formatted as an SSH version string.
290 */
291extern char sshver[];
292
fd5e5847 293/*
294 * Gross hack: pscp will try to start SFTP but fall back to scp1 if
295 * that fails. This variable is the means by which scp.c can reach
296 * into the SSH code and find out which one it got.
297 */
51470298 298extern int ssh_fallback_cmd(void *handle);
fd5e5847 299
8f203108 300#ifndef MSCRYPTOAPI
32874aea 301void SHATransform(word32 * digest, word32 * data);
8f203108 302#endif
374330e2 303
304int random_byte(void);
305void random_add_noise(void *noise, int length);
6e522441 306void random_add_heavynoise(void *noise, int length);
c5e9c988 307
cbe2d68f 308void logevent(void *, const char *);
51470298 309
310/* Allocate and register a new channel for port forwarding */
311void *new_sock_channel(void *handle, Socket s);
6b78788a 312void ssh_send_port_open(void *channel, char *hostname, int port, char *org);
e5574168 313
322d09a8 314/* Exports from portfwd.c */
cbe2d68f 315extern const char *pfd_newconnect(Socket * s, char *hostname, int port,
05581745 316 void *c, const Config *cfg,
317 int addressfamily);
820ebe3b 318/* desthost == NULL indicates dynamic (SOCKS) port forwarding */
cbe2d68f 319extern const char *pfd_addforward(char *desthost, int destport, char *srcaddr,
320 int port, void *backhandle,
05581745 321 const Config *cfg, void **sockdata,
322 int address_family);
322d09a8 323extern void pfd_close(Socket s);
fda2feb1 324extern void pfd_terminate(void *sockdata);
322d09a8 325extern int pfd_send(Socket s, char *data, int len);
326extern void pfd_confirm(Socket s);
327extern void pfd_unthrottle(Socket s);
328extern void pfd_override_throttle(Socket s, int enable);
329
330/* Exports from x11fwd.c */
8def70c3 331enum {
332 X11_TRANS_IPV4 = 0, X11_TRANS_IPV6 = 6, X11_TRANS_UNIX = 256
333};
334struct X11Display {
335 /* Broken-down components of the display name itself */
336 int unixdomain;
337 char *hostname;
338 int displaynum;
339 int screennum;
340 /* OSX sometimes replaces all the above with a full Unix-socket pathname */
341 char *unixsocketpath;
342
343 /* PuTTY networking SockAddr to connect to the display, and associated
344 * gubbins */
345 SockAddr addr;
346 int port;
347 char *realhost;
348
349 /* Auth details we invented for the virtual display on the SSH server. */
350 int remoteauthproto;
351 unsigned char *remoteauthdata;
352 int remoteauthdatalen;
353 char *remoteauthprotoname;
354 char *remoteauthdatastring;
355
356 /* Our local auth details for talking to the real X display. */
357 int localauthproto;
358 unsigned char *localauthdata;
359 int localauthdatalen;
360
361 /*
362 * Used inside x11fwd.c to remember recently seen
363 * XDM-AUTHORIZATION-1 strings, to avoid replay attacks.
364 */
365 tree234 *xdmseen;
366};
367/*
368 * x11_setup_display() parses the display variable and fills in an
369 * X11Display structure. Some remote auth details are invented;
370 * the supplied authtype parameter configures the preferred
371 * authorisation protocol to use at the remote end. The local auth
372 * details are looked up by calling platform_get_x11_auth.
373 */
374extern struct X11Display *x11_setup_display(char *display, int authtype,
375 const Config *);
376void x11_free_display(struct X11Display *disp);
377extern const char *x11_init(Socket *, struct X11Display *, void *,
378 const char *, int, const Config *);
322d09a8 379extern void x11_close(Socket);
380extern int x11_send(Socket, char *, int);
322d09a8 381extern void x11_unthrottle(Socket s);
382extern void x11_override_throttle(Socket s, int enable);
fc0f17db 383char *x11_display(const char *display);
fc0f17db 384/* Platform-dependent X11 functions */
8def70c3 385extern void platform_get_x11_auth(struct X11Display *display,
386 const Config *);
387 /* examine a mostly-filled-in X11Display and fill in localauth* */
388extern const int platform_uses_x11_unix_by_default;
389 /* choose default X transport in the absence of a specified one */
390SockAddr platform_get_x11_unix_address(const char *path, int displaynum);
391 /* make up a SockAddr naming the address for displaynum */
46ed7b64 392char *platform_get_x_display(void);
8def70c3 393 /* allocated local X display string, if any */
394/* Callbacks in x11.c usable _by_ platform X11 functions */
395/*
396 * This function does the job of platform_get_x11_auth, provided
397 * it is told where to find a normally formatted .Xauthority file:
398 * it opens that file, parses it to find an auth record which
399 * matches the display details in "display", and fills in the
400 * localauth fields.
401 *
402 * It is expected that most implementations of
403 * platform_get_x11_auth() will work by finding their system's
404 * .Xauthority file, adjusting the display details if necessary
405 * for local oddities like Unix-domain socket transport, and
406 * calling this function to do the rest of the work.
407 */
408void x11_get_auth_from_authfile(struct X11Display *display,
409 const char *authfilename);
9bee6826 410
7cca0d81 411Bignum copybn(Bignum b);
3709bfe9 412Bignum bn_power_2(int n);
413void bn_restore_invariant(Bignum b);
5c72ca61 414Bignum bignum_from_long(unsigned long n);
e5574168 415void freebn(Bignum b);
59600f67 416Bignum modpow(Bignum base, Bignum exp, Bignum mod);
417Bignum modmul(Bignum a, Bignum b, Bignum mod);
7cca0d81 418void decbn(Bignum n);
419extern Bignum Zero, One;
27cd7fc2 420Bignum bignum_from_bytes(const unsigned char *data, int nbytes);
0016d70b 421int ssh1_read_bignum(const unsigned char *data, int len, Bignum * result);
ddecd643 422int bignum_bitcount(Bignum bn);
5c58ad2d 423int ssh1_bignum_length(Bignum bn);
260f3dec 424int ssh2_bignum_length(Bignum bn);
5c58ad2d 425int bignum_byte(Bignum bn, int i);
9400cf6f 426int bignum_bit(Bignum bn, int i);
427void bignum_set_bit(Bignum bn, int i, int value);
5c58ad2d 428int ssh1_write_bignum(void *data, Bignum bn);
9400cf6f 429Bignum biggcd(Bignum a, Bignum b);
430unsigned short bignum_mod_short(Bignum number, unsigned short modulus);
431Bignum bignum_add_long(Bignum number, unsigned long addend);
432Bignum bigmul(Bignum a, Bignum b);
5c72ca61 433Bignum bigmuladd(Bignum a, Bignum b, Bignum addend);
434Bignum bigdiv(Bignum a, Bignum b);
435Bignum bigmod(Bignum a, Bignum b);
9400cf6f 436Bignum modinv(Bignum number, Bignum modulus);
3709bfe9 437Bignum bignum_bitmask(Bignum number);
9400cf6f 438Bignum bignum_rshift(Bignum number, int shift);
8c3cd914 439int bignum_cmp(Bignum a, Bignum b);
6e522441 440char *bignum_decimal(Bignum x);
e5574168 441
a3412f52 442#ifdef DEBUG
443void diagbn(char *prefix, Bignum md);
444#endif
445
d1aaf71d 446void *dh_setup_group(const struct ssh_kex *kex);
447void *dh_setup_gex(Bignum pval, Bignum gval);
27cd7fc2 448void dh_cleanup(void *);
449Bignum dh_create_e(void *, int nbits);
450Bignum dh_find_K(void *, Bignum f);
7cca0d81 451
9a30e26b 452int loadrsakey(const Filename *filename, struct RSAKey *key,
222d54dc 453 char *passphrase, const char **errorstr);
9a30e26b 454int rsakey_encrypted(const Filename *filename, char **comment);
222d54dc 455int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen,
4bcf919e 456 char **commentptr, const char **errorstr);
7cca0d81 457
9a30e26b 458int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
65a22376 459
df3c4460 460extern int base64_decode_atom(char *atom, unsigned char *out);
461extern int base64_lines(int datalen);
462extern void base64_encode_atom(unsigned char *data, int n, char *out);
463extern void base64_encode(FILE *fp, unsigned char *data, int datalen, int cpl);
65a22376 464
465/* ssh2_load_userkey can return this as an error */
466extern struct ssh2_userkey ssh2_wrong_passphrase;
467#define SSH2_WRONG_PASSPHRASE (&ssh2_wrong_passphrase)
468
9a30e26b 469int ssh2_userkey_encrypted(const Filename *filename, char **comment);
470struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
222d54dc 471 char *passphrase, const char **errorstr);
8a9977e5 472unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
473 int *pub_blob_len, char **commentptr,
474 const char **errorstr);
9a30e26b 475int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
32874aea 476 char *passphrase);
47a6b94c 477const struct ssh_signkey *find_pubkey_alg(const char *name);
65a22376 478
231ee168 479enum {
480 SSH_KEYTYPE_UNOPENABLE,
481 SSH_KEYTYPE_UNKNOWN,
482 SSH_KEYTYPE_SSH1, SSH_KEYTYPE_SSH2,
483 SSH_KEYTYPE_OPENSSH, SSH_KEYTYPE_SSHCOM
484};
9a30e26b 485int key_type(const Filename *filename);
231ee168 486char *key_type_to_str(int type);
6e522441 487
9dda6459 488int import_possible(int type);
489int import_target_type(int type);
9a30e26b 490int import_encrypted(const Filename *filename, int type, char **comment);
491int import_ssh1(const Filename *filename, int type,
1e87cce5 492 struct RSAKey *key, char *passphrase, const char **errmsg_p);
9a30e26b 493struct ssh2_userkey *import_ssh2(const Filename *filename, int type,
1e87cce5 494 char *passphrase, const char **errmsg_p);
9a30e26b 495int export_ssh1(const Filename *filename, int type,
496 struct RSAKey *key, char *passphrase);
497int export_ssh2(const Filename *filename, int type,
4801c01c 498 struct ssh2_userkey *key, char *passphrase);
9dda6459 499
65a22376 500void des3_decrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
501void des3_encrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
9dda6459 502void des3_decrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
503 unsigned char *blk, int len);
504void des3_encrypt_pubkey_ossh(unsigned char *key, unsigned char *iv,
505 unsigned char *blk, int len);
32874aea 506void aes256_encrypt_pubkey(unsigned char *key, unsigned char *blk,
507 int len);
508void aes256_decrypt_pubkey(unsigned char *key, unsigned char *blk,
509 int len);
9400cf6f 510
2f92b717 511void des_encrypt_xdmauth(unsigned char *key, unsigned char *blk, int len);
b3ebaa28 512void des_decrypt_xdmauth(unsigned char *key, unsigned char *blk, int len);
2f92b717 513
9400cf6f 514/*
515 * For progress updates in the key generation utility.
516 */
7c7f6893 517#define PROGFN_INITIALISE 1
518#define PROGFN_LIN_PHASE 2
519#define PROGFN_EXP_PHASE 3
520#define PROGFN_PHASE_EXTENT 4
521#define PROGFN_READY 5
522#define PROGFN_PROGRESS 6
5c72ca61 523typedef void (*progfn_t) (void *param, int action, int phase, int progress);
9400cf6f 524
32874aea 525int rsa_generate(struct RSAKey *key, int bits, progfn_t pfn,
526 void *pfnparam);
5c72ca61 527int dsa_generate(struct dss_key *key, int bits, progfn_t pfn,
528 void *pfnparam);
529Bignum primegen(int bits, int modulus, int residue, Bignum factor,
530 int phase, progfn_t pfn, void *pfnparam);
4ba9b64b 531
d74d141c 532
4ba9b64b 533/*
534 * zlib compression.
535 */
5366aed8 536void *zlib_compress_init(void);
537void zlib_compress_cleanup(void *);
538void *zlib_decompress_init(void);
539void zlib_decompress_cleanup(void *);
540int zlib_compress_block(void *, unsigned char *block, int len,
4ba9b64b 541 unsigned char **outblock, int *outlen);
5366aed8 542int zlib_decompress_block(void *, unsigned char *block, int len,
4ba9b64b 543 unsigned char **outblock, int *outlen);
1983e559 544
545/*
2e85c969 546 * SSH-1 agent messages.
1983e559 547 */
548#define SSH1_AGENTC_REQUEST_RSA_IDENTITIES 1
549#define SSH1_AGENT_RSA_IDENTITIES_ANSWER 2
550#define SSH1_AGENTC_RSA_CHALLENGE 3
551#define SSH1_AGENT_RSA_RESPONSE 4
552#define SSH1_AGENTC_ADD_RSA_IDENTITY 7
553#define SSH1_AGENTC_REMOVE_RSA_IDENTITY 8
32874aea 554#define SSH1_AGENTC_REMOVE_ALL_RSA_IDENTITIES 9 /* openssh private? */
1983e559 555
556/*
2e85c969 557 * Messages common to SSH-1 and OpenSSH's SSH-2.
1983e559 558 */
559#define SSH_AGENT_FAILURE 5
560#define SSH_AGENT_SUCCESS 6
561
562/*
2e85c969 563 * OpenSSH's SSH-2 agent messages.
1983e559 564 */
565#define SSH2_AGENTC_REQUEST_IDENTITIES 11
566#define SSH2_AGENT_IDENTITIES_ANSWER 12
567#define SSH2_AGENTC_SIGN_REQUEST 13
568#define SSH2_AGENT_SIGN_RESPONSE 14
569#define SSH2_AGENTC_ADD_IDENTITY 17
570#define SSH2_AGENTC_REMOVE_IDENTITY 18
571#define SSH2_AGENTC_REMOVE_ALL_IDENTITIES 19
7bedb13c 572
573/*
2e85c969 574 * Need this to warn about support for the original SSH-2 keyfile
7bedb13c 575 * format.
576 */
577void old_keyfile_warning(void);