Rename crc32() to crc32_compute(), to avoid clashing catastrophically
[u/mdw/putty] / ssh.h
diff --git a/ssh.h b/ssh.h
index 4a1d03d..11f2d19 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -4,6 +4,7 @@
 #include "puttymem.h"
 #include "network.h"
 #include "int64.h"
+#include "misc.h"
 
 struct ssh_channel;
 
@@ -72,7 +73,7 @@ void freersakey(struct RSAKey *key);
 typedef unsigned int word32;
 typedef unsigned int uint32;
 
-unsigned long crc32(const void *s, size_t len);
+unsigned long crc32_compute(const void *s, size_t len);
 unsigned long crc32_update(unsigned long crc_input, const void *s, size_t len);
 
 /* SSH CRC compensation attack detector */
@@ -249,16 +250,19 @@ int random_byte(void);
 void random_add_noise(void *noise, int length);
 void random_add_heavynoise(void *noise, int length);
 
-void logevent(void *, char *);
+void logevent(void *, const char *);
 
 /* Allocate and register a new channel for port forwarding */
 void *new_sock_channel(void *handle, Socket s);
 void ssh_send_port_open(void *channel, char *hostname, int port, char *org);
 
 /* Exports from portfwd.c */
-extern char *pfd_newconnect(Socket * s, char *hostname, int port, void *c);
-extern char *pfd_addforward(char *desthost, int destport, char *srcaddr,
-                           int port, void *backhandle);
+extern const char *pfd_newconnect(Socket * s, char *hostname, int port,
+                                 void *c, const Config *cfg);
+/* desthost == NULL indicates dynamic (SOCKS) port forwarding */
+extern const char *pfd_addforward(char *desthost, int destport, char *srcaddr,
+                                 int port, void *backhandle,
+                                 const Config *cfg);
 extern void pfd_close(Socket s);
 extern int pfd_send(Socket s, char *data, int len);
 extern void pfd_confirm(Socket s);
@@ -266,10 +270,12 @@ extern void pfd_unthrottle(Socket s);
 extern void pfd_override_throttle(Socket s, int enable);
 
 /* Exports from x11fwd.c */
-extern char *x11_init(Socket *, char *, void *, void *);
+extern const char *x11_init(Socket *, char *, void *, void *, const char *,
+                           int, const Config *);
 extern void x11_close(Socket);
 extern int x11_send(Socket, char *, int);
-extern void *x11_invent_auth(char *, int, char *, int);
+extern void *x11_invent_auth(char *, int, char *, int, int);
+extern void x11_free_auth(void *);
 extern void x11_unthrottle(Socket s);
 extern void x11_override_throttle(Socket s, int enable);
 extern int x11_get_screen_number(char *display);
@@ -310,17 +316,22 @@ Bignum bignum_rshift(Bignum number, int shift);
 int bignum_cmp(Bignum a, Bignum b);
 char *bignum_decimal(Bignum x);
 
+#ifdef DEBUG
+void diagbn(char *prefix, Bignum md);
+#endif
+
 void *dh_setup_group1(void);
 void *dh_setup_group(Bignum pval, Bignum gval);
 void dh_cleanup(void *);
 Bignum dh_create_e(void *, int nbits);
 Bignum dh_find_K(void *, Bignum f);
 
-int loadrsakey(char *filename, struct RSAKey *key, char *passphrase);
-int rsakey_encrypted(char *filename, char **comment);
-int rsakey_pubblob(char *filename, void **blob, int *bloblen);
+int loadrsakey(const Filename *filename, struct RSAKey *key,
+              char *passphrase);
+int rsakey_encrypted(const Filename *filename, char **comment);
+int rsakey_pubblob(const Filename *filename, void **blob, int *bloblen);
 
-int saversakey(char *filename, struct RSAKey *key, char *passphrase);
+int saversakey(const Filename *filename, struct RSAKey *key, char *passphrase);
 
 extern int base64_decode_atom(char *atom, unsigned char *out);
 extern int base64_lines(int datalen);
@@ -331,11 +342,12 @@ extern void base64_encode(FILE *fp, unsigned char *data, int datalen, int cpl);
 extern struct ssh2_userkey ssh2_wrong_passphrase;
 #define SSH2_WRONG_PASSPHRASE (&ssh2_wrong_passphrase)
 
-int ssh2_userkey_encrypted(char *filename, char **comment);
-struct ssh2_userkey *ssh2_load_userkey(char *filename, char *passphrase);
-char *ssh2_userkey_loadpub(char *filename, char **algorithm,
+int ssh2_userkey_encrypted(const Filename *filename, char **comment);
+struct ssh2_userkey *ssh2_load_userkey(const Filename *filename,
+                                      char *passphrase);
+char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
                           int *pub_blob_len);
-int ssh2_save_userkey(char *filename, struct ssh2_userkey *key,
+int ssh2_save_userkey(const Filename *filename, struct ssh2_userkey *key,
                      char *passphrase);
 
 enum {
@@ -344,16 +356,19 @@ enum {
     SSH_KEYTYPE_SSH1, SSH_KEYTYPE_SSH2,
     SSH_KEYTYPE_OPENSSH, SSH_KEYTYPE_SSHCOM
 };
-int key_type(char *filename);
+int key_type(const Filename *filename);
 char *key_type_to_str(int type);
 
 int import_possible(int type);
 int import_target_type(int type);
-int import_encrypted(char *filename, int type, char **comment);
-int import_ssh1(char *filename, int type, struct RSAKey *key,char *passphrase);
-struct ssh2_userkey *import_ssh2(char *filename, int type, char *passphrase);
-int export_ssh1(char *filename, int type, struct RSAKey *key,char *passphrase);
-int export_ssh2(char *filename, int type,
+int import_encrypted(const Filename *filename, int type, char **comment);
+int import_ssh1(const Filename *filename, int type,
+               struct RSAKey *key, char *passphrase);
+struct ssh2_userkey *import_ssh2(const Filename *filename, int type,
+                                char *passphrase);
+int export_ssh1(const Filename *filename, int type,
+               struct RSAKey *key, char *passphrase);
+int export_ssh2(const Filename *filename, int type,
                 struct ssh2_userkey *key, char *passphrase);
 
 void des3_decrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
@@ -368,6 +383,7 @@ void aes256_decrypt_pubkey(unsigned char *key, unsigned char *blk,
                           int len);
 
 void des_encrypt_xdmauth(unsigned char *key, unsigned char *blk, int len);
+void des_decrypt_xdmauth(unsigned char *key, unsigned char *blk, int len);
 
 /*
  * For progress updates in the key generation utility.