1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-16 10:37:38 -05:00

Identify hash function implementations in the Event Log.

Similarly to the 'AES (unaccelerated)' naming scheme I added in the
AES rewrite, the hash functions that have multiple implementations now
each come with an annotation saying which one they are.

This was more tricky for hashes than for ciphers, because the
annotation for a hash has to be a separate string literal from the
base text name, so that it can propagate into the name field for each
HMAC wrapper without looking silly.
This commit is contained in:
Simon Tatham
2019-01-23 07:29:53 +00:00
parent dc2fdb8acf
commit 9285c1b93c
8 changed files with 50 additions and 28 deletions

10
ssh.h
View File

@ -664,7 +664,9 @@ struct ssh_hashalg {
void (*free)(ssh_hash *);
int hlen; /* output length in bytes */
int blocklen; /* length of the hash's input block, or 0 for N/A */
const char *text_name;
const char *text_basename; /* the semantic name of the hash */
const char *annotation; /* extra info, e.g. which of multiple impls */
const char *text_name; /* both combined, e.g. "SHA-n (unaccelerated)" */
};
#define ssh_hash_new(alg) ((alg)->new(alg))
@ -673,6 +675,12 @@ struct ssh_hashalg {
#define ssh_hash_free(ctx) ((ctx)->vt->free(ctx))
#define ssh_hash_alg(ctx) ((ctx)->vt)
/* Handy macros for defining all those text-name fields at once */
#define HASHALG_NAMES_BARE(base) \
base, NULL, base
#define HASHALG_NAMES_ANNOTATED(base, annotation) \
base, annotation, base " (" annotation ")"
void hash_simple(const ssh_hashalg *alg, ptrlen data, void *output);
struct ssh_kex {