1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-01 11:32:48 -05:00

Replace all uses of SHA*_Bytes / MD5Update.

In fact, those functions don't even exist any more. The only way to
get data into a primitive hash state is via the new put_* system. Of
course, that means put_data() is a viable replacement for every
previous call to one of the per-hash update functions - but just
mechanically doing that would have missed the opportunity to simplify
a lot of the call sites.
This commit is contained in:
Simon Tatham
2018-05-24 10:03:36 +01:00
parent f1b1b1d260
commit 4988fd410c
15 changed files with 138 additions and 203 deletions

View File

@ -49,7 +49,6 @@ static char *obfuscate_name(const char *realname)
char *cryptdata;
int cryptlen;
SHA256_State sha;
unsigned char lenbuf[4];
unsigned char digest[32];
char retbuf[65];
int i;
@ -90,9 +89,7 @@ static char *obfuscate_name(const char *realname)
* so having got it back out of CryptProtectMemory we now hash it.
*/
SHA256_Init(&sha);
PUT_32BIT_MSB_FIRST(lenbuf, cryptlen);
SHA256_Bytes(&sha, lenbuf, 4);
SHA256_Bytes(&sha, cryptdata, cryptlen);
put_string(&sha, cryptdata, cryptlen);
SHA256_Final(&sha, digest);
sfree(cryptdata);