SSH CRC attack detector now uses a dynamically allocated context.
[u/mdw/putty] / ssh.h
diff --git a/ssh.h b/ssh.h
index a99b633..bf57b8f 100644 (file)
--- a/ssh.h
+++ b/ssh.h
@@ -75,7 +75,10 @@ unsigned long crc32(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 */
-int detect_attack(unsigned char *buf, uint32 len, unsigned char *IV);
+void *crcda_make_context(void);
+void crcda_free_context(void *handle);
+int detect_attack(void *handle, unsigned char *buf, uint32 len,
+                 unsigned char *IV);
 
 typedef struct {
     uint32 h[4];
@@ -151,10 +154,11 @@ struct ssh2_ciphers {
 };
 
 struct ssh_mac {
-    void (*setcskey) (unsigned char *key);
-    void (*setsckey) (unsigned char *key);
-    void (*generate) (unsigned char *blk, int len, unsigned long seq);
-    int (*verify) (unsigned char *blk, int len, unsigned long seq);
+    void *(*make_context)(void);
+    void (*free_context)(void *);
+    void (*setkey) (void *, unsigned char *key);
+    void (*generate) (void *, unsigned char *blk, int len, unsigned long seq);
+    int (*verify) (void *, unsigned char *blk, int len, unsigned long seq);
     char *name;
     int len;
 };