Private host key is sent instead of public in DH KEX?

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

 



Hello,

Can someone please tell me if I am right or wrong that in the code below
private key can be sent (in DH KEX) instead of public one (need_private is
0). Both keys are available (sensitive_data.host_keys[i] and
sensitive_data.host_pubkeys[i] are not NULL).
I hope I am just missing something here.

Thanks.

static Key *
get_hostkey_by_type(int type, int nid, int need_private, struct ssh *ssh)
{
    int i;
    Key *key;

    for (i = 0; i < options.num_host_key_files; i++) {
        switch (type) {
        case KEY_RSA_CERT:
        case KEY_DSA_CERT:
        case KEY_ECDSA_CERT:
        case KEY_ED25519_CERT:
            key = sensitive_data.host_certificates[i];
            break;
        default:
            key = sensitive_data.host_keys[i];
            if (key == NULL && !need_private)
                key = sensitive_data.host_pubkeys[i];
            break;
        }
        if (key != NULL && key->type == type &&
            (key->type != KEY_ECDSA || key->ecdsa_nid == nid))
            return need_private ?
                sensitive_data.host_keys[i] : key;
    }
    return NULL;
}
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev@xxxxxxxxxxx
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev



[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux