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

@ -228,7 +228,6 @@ void pageant_handle_msg(BinarySink *bs,
ptrlen session_id;
unsigned response_type;
unsigned char response_md5[16];
struct MD5Context md5c;
int i;
plog(logctx, logfn, "request: SSH1_AGENTC_RSA_CHALLENGE");
@ -266,11 +265,13 @@ void pageant_handle_msg(BinarySink *bs,
}
response = rsa_ssh1_decrypt(challenge, key);
MD5Init(&md5c);
for (i = 0; i < 32; i++)
put_byte(&md5c, mp_get_byte(response, 31 - i));
put_datapl(&md5c, session_id);
MD5Final(response_md5, &md5c);
{
ssh_hash *h = ssh_hash_new(&ssh_md5);
for (i = 0; i < 32; i++)
put_byte(h, mp_get_byte(response, 31 - i));
put_datapl(h, session_id);
ssh_hash_final(h, response_md5);
}
put_byte(bs, SSH1_AGENT_RSA_RESPONSE);
put_data(bs, response_md5, 16);