1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-09 23:33:46 -05:00

Add copy and free methods to 'struct ssh_hash'.

This permits a hash state to be cloned in the middle of being used, so
that multiple strings with the same prefix can be hashed without
having to repeat all the computation over the prefix.

Having done that, we'll also sometimes need to free a hash state that
we aren't generating actual hash output from, so we need a free method
as well.
This commit is contained in:
Simon Tatham
2015-08-21 23:13:59 +01:00
parent 67629cc0ba
commit 1df12e3915
4 changed files with 66 additions and 10 deletions

2
ssh.h
View File

@ -353,8 +353,10 @@ struct ssh_mac {
struct ssh_hash {
void *(*init)(void); /* also allocates context */
void *(*copy)(const void *);
void (*bytes)(void *, const void *, int);
void (*final)(void *, unsigned char *); /* also frees context */
void (*free)(void *);
int hlen; /* output length in bytes */
const char *text_name;
};