mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-10 07:43:48 -05:00
Make ssh_hash and ssh_mac expose a BinarySink.
Just as I did a few commits ago with the low-level SHA_Bytes type functions, the ssh_hash and ssh_mac abstract types now no longer have a direct foo->bytes() update method at all. Instead, each one has a foo->sink() function that returns a BinarySink with the same lifetime as the hash context, and then the caller can feed data into that in the usual way. This lets me get rid of a couple more duplicate marshalling routines in ssh.c: hash_string(), hash_uint32(), hash_mpint().
This commit is contained in:
4
ssh.h
4
ssh.h
@ -365,7 +365,7 @@ struct ssh_mac {
|
||||
int (*verify) (void *, unsigned char *blk, int len, unsigned long seq);
|
||||
/* partial-packet operations */
|
||||
void (*start) (void *);
|
||||
void (*bytes) (void *, unsigned char const *, int);
|
||||
BinarySink *(*sink) (void *);
|
||||
void (*genresult) (void *, unsigned char *);
|
||||
int (*verresult) (void *, unsigned char const *);
|
||||
const char *name, *etm_name;
|
||||
@ -376,7 +376,7 @@ struct ssh_mac {
|
||||
struct ssh_hash {
|
||||
void *(*init)(void); /* also allocates context */
|
||||
void *(*copy)(const void *);
|
||||
void (*bytes)(void *, const void *, int);
|
||||
BinarySink *(*sink) (void *);
|
||||
void (*final)(void *, unsigned char *); /* also frees context */
|
||||
void (*free)(void *);
|
||||
int hlen; /* output length in bytes */
|
||||
|
Reference in New Issue
Block a user