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

@ -219,19 +219,12 @@ static char *make_dirname(const char *pi_name, char **logtext)
*/
{
SHA256_State sha;
unsigned len;
unsigned char lenbuf[4];
unsigned char digest[32];
char retbuf[65];
SHA256_Init(&sha);
PUT_32BIT(lenbuf, SALT_SIZE);
SHA256_Bytes(&sha, lenbuf, 4);
SHA256_Bytes(&sha, saltbuf, SALT_SIZE);
len = strlen(pi_name);
PUT_32BIT(lenbuf, len);
SHA256_Bytes(&sha, lenbuf, 4);
SHA256_Bytes(&sha, pi_name, len);
put_string(&sha, saltbuf, SALT_SIZE);
put_stringz(&sha, pi_name);
SHA256_Final(&sha, digest);
/*