=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ssh/hostfile.c,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- src/usr.bin/ssh/hostfile.c 2020/06/26 05:42:16 1.82 +++ src/usr.bin/ssh/hostfile.c 2020/10/04 09:45:01 1.83 @@ -1,4 +1,4 @@ -/* $OpenBSD: hostfile.c,v 1.82 2020/06/26 05:42:16 djm Exp $ */ +/* $OpenBSD: hostfile.c,v 1.83 2020/10/04 09:45:01 djm Exp $ */ /* * Author: Tatu Ylonen * Copyright (c) 1995 Tatu Ylonen , Espoo, Finland @@ -336,7 +336,7 @@ */ static HostStatus check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, - struct sshkey *k, int keytype, const struct hostkey_entry **found) + struct sshkey *k, int keytype, int nid, const struct hostkey_entry **found) { u_int i; HostStatus end_return = HOST_NEW; @@ -352,6 +352,10 @@ if (k == NULL) { if (hostkeys->entries[i].key->type != keytype) continue; + if (nid != -1 && + sshkey_type_plain(keytype) == KEY_ECDSA && + hostkeys->entries[i].key->ecdsa_nid != nid) + continue; end_return = HOST_FOUND; if (found != NULL) *found = hostkeys->entries + i; @@ -394,14 +398,14 @@ { if (key == NULL) fatal("no key to look up"); - return check_hostkeys_by_key_or_type(hostkeys, key, 0, found); + return check_hostkeys_by_key_or_type(hostkeys, key, 0, -1, found); } int -lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype, +lookup_key_in_hostkeys_by_type(struct hostkeys *hostkeys, int keytype, int nid, const struct hostkey_entry **found) { - return (check_hostkeys_by_key_or_type(hostkeys, NULL, keytype, + return (check_hostkeys_by_key_or_type(hostkeys, NULL, keytype, nid, found) == HOST_FOUND); }