pki_crypto: Always copy ecdsa_nid into duplicated ECDSA keys

BUG: https://red.libssh.org/issues/147

Signed-off-by: Alan Dunn <amdunn@gmail.com>
This commit is contained in:
Alan Dunn
2014-02-17 09:17:18 -06:00
committed by Andreas Schneider
parent 15f3988bc8
commit 3d9b1693eb

View File

@@ -345,13 +345,13 @@ ssh_key pki_key_dup(const ssh_key key, int demote)
break;
case SSH_KEYTYPE_ECDSA:
#ifdef HAVE_OPENSSL_ECC
new->ecdsa_nid = key->ecdsa_nid;
/* privkey -> pubkey */
if (demote && ssh_key_is_private(key)) {
const EC_POINT *p;
int ok;
new->ecdsa_nid = key->ecdsa_nid;
new->ecdsa = EC_KEY_new_by_curve_name(key->ecdsa_nid);
if (new->ecdsa == NULL) {
goto fail;