mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-01 19:42:48 -05:00
Adopt the new hash API functions where they're useful.
This commit switches as many ssh_hash_free / ssh_hash_new pairs as possible to reuse the previous hash object via ssh_hash_reset. Also a few other cleanups: use the wrapper function hash_simple() where possible, and I've also introduced ssh_hash_digest_nondestructive() and switched to that where possible as well.
This commit is contained in:
7
ssh.h
7
ssh.h
@ -748,6 +748,13 @@ static inline ssh_hash *ssh_hash_copyfrom(ssh_hash *dest, ssh_hash *src)
|
||||
static inline void ssh_hash_final(ssh_hash *h, unsigned char *out)
|
||||
{ h->vt->digest(h, out); h->vt->free(h); }
|
||||
|
||||
/* ssh_hash_digest_nondestructive generates a finalised hash from the
|
||||
* given object without changing its state, so you can continue
|
||||
* appending data to get a hash of an extended string. */
|
||||
static inline void ssh_hash_digest_nondestructive(ssh_hash *h,
|
||||
unsigned char *out)
|
||||
{ ssh_hash_final(ssh_hash_copy(h), out); }
|
||||
|
||||
/* Handy macros for defining all those text-name fields at once */
|
||||
#define HASHALG_NAMES_BARE(base) \
|
||||
base, NULL, base
|
||||
|
Reference in New Issue
Block a user