1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-06-30 19:12:48 -05:00

Access all hashes and MACs through the standard API.

All the hash-specific state structures, and the functions that
directly accessed them, are now local to the source files implementing
the hashes themselves. Everywhere we previously used those types or
functions, we're now using the standard ssh_hash or ssh2_mac API.

The 'simple' functions (hmacmd5_simple, SHA_Simple etc) are now a pair
of wrappers in sshauxcrypt.c, each of which takes an algorithm
structure and can do the same conceptual thing regardless of what it
is.
This commit is contained in:
Simon Tatham
2019-01-20 16:15:14 +00:00
parent acdcf2bfaa
commit 0d2d20aad0
19 changed files with 232 additions and 274 deletions

View File

@ -47,7 +47,6 @@ static char *obfuscate_name(const char *realname)
*/
char *cryptdata;
int cryptlen;
SHA256_State sha;
unsigned char digest[32];
char retbuf[65];
int i;
@ -87,9 +86,11 @@ static char *obfuscate_name(const char *realname)
* We don't want to give away the length of the hostname either,
* so having got it back out of CryptProtectMemory we now hash it.
*/
SHA256_Init(&sha);
put_string(&sha, cryptdata, cryptlen);
SHA256_Final(&sha, digest);
{
ssh_hash *h = ssh_hash_new(&ssh_sha256);
put_string(h, cryptdata, cryptlen);
ssh_hash_final(h, digest);
}
sfree(cryptdata);