SSH ciphers now use dynamically allocated contexts.
[u/mdw/putty] / ssh.h
diff --git a/ssh.h b/ssh.h
index 0cbdd47..a99b633 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -123,22 +123,26 @@ void SHA512_Final(SHA512_State * s, unsigned char *output);
 void SHA512_Simple(const void *p, int len, unsigned char *output);
 
 struct ssh_cipher {
-    void (*sesskey) (unsigned char *key);      /* for ssh 1 */
-    void (*encrypt) (unsigned char *blk, int len);
-    void (*decrypt) (unsigned char *blk, int len);
+    void *(*make_context)(void);
+    void (*free_context)(void *);
+    void (*sesskey) (void *, unsigned char *key);      /* for ssh 1 */
+    void (*encrypt) (void *, unsigned char *blk, int len);
+    void (*decrypt) (void *, unsigned char *blk, int len);
     int blksize;
+    char *text_name;
 };
 
 struct ssh2_cipher {
-    void (*setcsiv) (unsigned char *key);      /* for ssh 2 */
-    void (*setcskey) (unsigned char *key);     /* for ssh 2 */
-    void (*setsciv) (unsigned char *key);      /* for ssh 2 */
-    void (*setsckey) (unsigned char *key);     /* for ssh 2 */
-    void (*encrypt) (unsigned char *blk, int len);
-    void (*decrypt) (unsigned char *blk, int len);
+    void *(*make_context)(void);
+    void (*free_context)(void *);
+    void (*setiv) (void *, unsigned char *key);        /* for ssh 2 */
+    void (*setkey) (void *, unsigned char *key);/* for ssh 2 */
+    void (*encrypt) (void *, unsigned char *blk, int len);
+    void (*decrypt) (void *, unsigned char *blk, int len);
     char *name;
     int blksize;
     int keylen;
+    char *text_name;
 };
 
 struct ssh2_ciphers {
@@ -227,7 +231,7 @@ extern char sshver[];
  * that fails. This variable is the means by which scp.c can reach
  * into the SSH code and find out which one it got.
  */
-extern int ssh_fallback_cmd;
+extern int ssh_fallback_cmd(void *handle);
 
 #ifndef MSCRYPTOAPI
 void SHATransform(word32 * digest, word32 * data);
@@ -238,8 +242,11 @@ void random_add_noise(void *noise, int length);
 void random_add_heavynoise(void *noise, int length);
 
 void logevent(char *);
-void *new_sock_channel(Socket s); // allocates and register a new channel for port forwarding
-void ssh_send_port_open(void *channel, char *hostname, int port, char *org);
+
+/* Allocate and register a new channel for port forwarding */
+void *new_sock_channel(void *handle, Socket s);
+void ssh_send_port_open(void *handle, void *channel,
+                       char *hostname, int port, char *org);
 
 Bignum copybn(Bignum b);
 Bignum bn_power_2(int n);
@@ -311,6 +318,9 @@ 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,
+                struct ssh2_userkey *key, char *passphrase);
 
 void des3_decrypt_pubkey(unsigned char *key, unsigned char *blk, int len);
 void des3_encrypt_pubkey(unsigned char *key, unsigned char *blk, int len);