mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-18 11:31:00 -05:00
Remove the list of key algorithms in pageant.c.
The only reason those couldn't be replaced with a call to the centralised find_pubkey_alg is because that function takes a zero- terminated string and instead we had a (length,pointer) string. Easily fixed; there's now a find_pubkey_alg_len(), and we call that. This also fixes a string-matching bug in which the sense of memcmp was reversed by mistake for ECDSA keys!
This commit is contained in:
14
pageant.c
14
pageant.c
@ -682,18 +682,8 @@ void *pageant_handle_msg(const void *msg, int msglen, int *outlen,
|
||||
p += alglen;
|
||||
|
||||
key = snew(struct ssh2_userkey);
|
||||
/* Add further algorithm names here. */
|
||||
if (alglen == 7 && !memcmp(alg, "ssh-rsa", 7))
|
||||
key->alg = &ssh_rsa;
|
||||
else if (alglen == 7 && !memcmp(alg, "ssh-dss", 7))
|
||||
key->alg = &ssh_dss;
|
||||
else if (alglen == 19 && memcmp(alg, "ecdsa-sha2-nistp256", 19))
|
||||
key->alg = &ssh_ecdsa_nistp256;
|
||||
else if (alglen == 19 && memcmp(alg, "ecdsa-sha2-nistp384", 19))
|
||||
key->alg = &ssh_ecdsa_nistp384;
|
||||
else if (alglen == 19 && memcmp(alg, "ecdsa-sha2-nistp521", 19))
|
||||
key->alg = &ssh_ecdsa_nistp521;
|
||||
else {
|
||||
key->alg = find_pubkey_alg_len(alglen, alg);
|
||||
if (!key->alg) {
|
||||
sfree(key);
|
||||
fail_reason = "algorithm unknown";
|
||||
goto failure;
|
||||
|
Reference in New Issue
Block a user