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

[PATCH 1/6] pki_crypto: Always copy ecdsa_nid into duplicated ECDSA keys


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

Signed-off-by: Alan Dunn <amdunn@xxxxxxxxx>
---
 src/pki_crypto.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/pki_crypto.c b/src/pki_crypto.c
index b5a48a4..89bb538 100644
--- a/src/pki_crypto.c
+++ b/src/pki_crypto.c
@@ -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;
-- 
1.7.9.5


References:
[PATCH 0/6] Fix ability to use ECDSA keysAlan Dunn <amdunn@xxxxxxxxx>
Archive administrator: postmaster@lists.cynapses.org