Emit a distinct error message when the SSH server's host key is invalid.

This also means that FUZZING can just ignore host-key verification
failure while preserving invalid-host-key errors.
This commit is contained in:
Ben Harris 2015-10-18 20:16:39 +01:00
Родитель 12702cb17e
Коммит 7a5cb2838f
1 изменённых файлов: 7 добавлений и 3 удалений

10
ssh.c
Просмотреть файл

@ -7126,13 +7126,17 @@ static void do_ssh2_transport(Ssh ssh, const void *vin, int inlen,
dmemdump(s->exchange_hash, ssh->kex->hash->hlen);
#endif
if (!s->hkey ||
!ssh->hostkey->verifysig(s->hkey, s->sigdata, s->siglen,
if (!s->hkey) {
bombout(("Server's host key is invalid"));
crStopV;
}
if (!ssh->hostkey->verifysig(s->hkey, s->sigdata, s->siglen,
(char *)s->exchange_hash,
ssh->kex->hash->hlen)) {
#ifndef FUZZING
bombout(("Server's host key did not match the signature supplied"));
crStopV;
crStopV;f
#endif
}