1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-14 17:47:33 -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

@ -56,16 +56,13 @@ void bcrypt_genblock(int counter,
{
SHA512_State shastate;
unsigned char hashed_salt[64];
unsigned char countbuf[4];
/* Hash the input salt with the counter value optionally suffixed
* to get our real 32-byte salt */
SHA512_Init(&shastate);
SHA512_Bytes(&shastate, salt, saltbytes);
if (counter) {
PUT_32BIT_MSB_FIRST(countbuf, counter);
SHA512_Bytes(&shastate, countbuf, 4);
}
put_data(&shastate, salt, saltbytes);
if (counter)
put_uint32(&shastate, counter);
SHA512_Final(&shastate, hashed_salt);
bcrypt_hash(hashed_passphrase, 64, hashed_salt, 64, output);