1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-05 21:42:47 -05:00

Give rsa_fingerprint() a new name and API.

It's an SSH-1 specific function, so it should have a name reflecting
that, and it didn't. Also it had one of those outdated APIs involving
passing it a client-allocated buffer and size. Now it has a sensible
name, and internally it constructs the output string using a strbuf
and returns it dynamically allocated.
This commit is contained in:
Simon Tatham
2018-06-03 08:08:53 +01:00
parent 3f1f7c3ce7
commit ae3863679d
7 changed files with 46 additions and 54 deletions

14
ssh.c
View File

@ -4130,13 +4130,10 @@ static void do_ssh1_login(void *vctx)
* Log the host key fingerprint.
*/
if (!get_err(pktin)) {
char logmsg[80];
char *fingerprint = rsa_ssh1_fingerprint(&s->hostkey);
logevent("Host key fingerprint is:");
strcpy(logmsg, " ");
s->hostkey.comment = NULL;
rsa_fingerprint(logmsg + strlen(logmsg),
sizeof(logmsg) - strlen(logmsg), &s->hostkey);
logevent(logmsg);
logeventf(ssh, " %s", fingerprint);
sfree(fingerprint);
}
ssh->v1_remote_protoflags = get_uint32(pktin);
@ -4186,13 +4183,14 @@ static void do_ssh1_login(void *vctx)
* First format the key into a string.
*/
int len = rsastr_len(&s->hostkey);
char fingerprint[100];
char *fingerprint;
char *keystr = snewn(len, char);
rsastr_fmt(keystr, &s->hostkey);
rsa_fingerprint(fingerprint, sizeof(fingerprint), &s->hostkey);
fingerprint = rsa_ssh1_fingerprint(&s->hostkey);
/* First check against manually configured host keys. */
s->dlgret = verify_ssh_manual_host_key(ssh, fingerprint, NULL, NULL);
sfree(fingerprint);
if (s->dlgret == 0) { /* did not match */
bombout(("Host key did not appear in manually configured list"));
sfree(keystr);