knownhosts: Use the correct name for ECDSA keys for host key negotiation

The conversion from  ssh_keytype_e  to string does not work for ECDSA keys,
because different key lengths have different string representation.

The usage of  type_c  should work also for every other key type in future,
but it does not reflrect different signature types (SHA2 extension for RSA
keys), but this early in the key exchange phase, we can not make any
assumptions about supported extensions by the server.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2018-10-18 13:46:52 +02:00
committed by Andreas Schneider
parent 9285e8516b
commit 893b69d82b

View File

@@ -340,12 +340,10 @@ struct ssh_list *ssh_known_hosts_get_algorithms(ssh_session session)
it != NULL;
it = ssh_list_get_iterator(entry_list)) {
struct ssh_knownhosts_entry *entry = NULL;
enum ssh_keytypes_e key_type;
const char *algo = NULL;
entry = ssh_iterator_value(struct ssh_knownhosts_entry *, it);
key_type = ssh_key_type(entry->publickey);
algo = ssh_key_type_to_char(key_type);
algo = entry->publickey->type_c;
rc = ssh_list_append(list, algo);
if (rc != SSH_OK) {