mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-06 22:12:47 -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:
21
cproxy.c
21
cproxy.c
@ -18,22 +18,15 @@
|
||||
static void hmacmd5_chap(const unsigned char *challenge, int challen,
|
||||
const char *passwd, unsigned char *response)
|
||||
{
|
||||
struct hmacmd5_context *hmacmd5_ctx;
|
||||
int pwlen;
|
||||
ptrlen key = ptrlen_from_asciz(passwd);
|
||||
unsigned char md5buf[16];
|
||||
|
||||
hmacmd5_ctx = hmacmd5_make_context();
|
||||
|
||||
pwlen = strlen(passwd);
|
||||
if (pwlen>64) {
|
||||
unsigned char md5buf[16];
|
||||
MD5Simple(passwd, pwlen, md5buf);
|
||||
hmacmd5_key(hmacmd5_ctx, md5buf, 16);
|
||||
} else {
|
||||
hmacmd5_key(hmacmd5_ctx, passwd, pwlen);
|
||||
if (key.len > 64) {
|
||||
hash_simple(&ssh_md5, key, md5buf);
|
||||
key = make_ptrlen(md5buf, 16);
|
||||
}
|
||||
|
||||
hmacmd5_do_hmac(hmacmd5_ctx, challenge, challen, response);
|
||||
hmacmd5_free_context(hmacmd5_ctx);
|
||||
mac_simple(&ssh_hmac_md5, key, make_ptrlen(challenge, challen), response);
|
||||
smemclr(md5buf, sizeof(md5buf));
|
||||
}
|
||||
|
||||
void proxy_socks5_offerencryptedauth(BinarySink *bs)
|
||||
|
Reference in New Issue
Block a user