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

cryptsuite: test hardware and software SHA, if possible.

Like the AES code before it, I've now exposed the explicit _sw and _hw
vtables for SHA-256 and SHA-1 through the testcrypt system, and now
cryptsuite will run the standard test vectors for those hashes over
both implementations, on a platform where more than one is available.
This commit is contained in:
Simon Tatham
2019-01-23 18:54:12 +00:00
parent 9285c1b93c
commit ba4eeff9cb
3 changed files with 90 additions and 53 deletions

View File

@ -185,7 +185,11 @@ static const ssh_hashalg *get_hashalg(BinarySource *in)
} algs[] = {
{"md5", &ssh_md5},
{"sha1", &ssh_sha1},
{"sha1_sw", &ssh_sha1_sw},
{"sha1_hw", &ssh_sha1_hw},
{"sha256", &ssh_sha256},
{"sha256_sw", &ssh_sha256_sw},
{"sha256_hw", &ssh_sha256_hw},
{"sha384", &ssh_sha384},
{"sha512", &ssh_sha512},
};
@ -510,6 +514,14 @@ static void return_opt_val_cipher(strbuf *out, ssh_cipher *c)
return_val_cipher(out, c);
}
static void return_opt_val_hash(strbuf *out, ssh_hash *h)
{
if (!h)
strbuf_catf(out, "NULL\n");
else
return_val_hash(out, h);
}
static void handle_hello(BinarySource *in, strbuf *out)
{
strbuf_catf(out, "hello, world\n");