agent: Fix SSH public key for EdDSA. (was: SSH with ed25519)

NIIBE Yutaka gniibe at fsij.org
Mon Aug 31 08:21:58 CEST 2015


On 08/12/2015 10:46 PM, NIIBE Yutaka wrote:
> I forgot when I tested OpenSSH with Ed25519, it worked at that
> time.  Today, I needed a patch like this:
> 
> diff --git a/agent/command-ssh.c b/agent/command-ssh.c
> index 2a3037c..7526634 100644
> --- a/agent/command-ssh.c
> +++ b/agent/command-ssh.c
> @@ -1964,6 +1964,11 @@ ssh_key_to_blob (gcry_sexp_t sexp, int with_secret,
>                err = gpg_error (GPG_ERR_INV_SEXP);
>                goto out;
>              }
> +	  if (data[0] == 0x40)
> +	    {
> +	      data++;
> +	      datalen--;
> +	    }
>            err = stream_write_string (stream, data, datalen);
>            if (err)
>              goto out;

I committed following fix.  Since the function ssh_key_to_blob can
be called WITH_SECRET=1, we need to distinguish elements.


* agent/command-ssh.c (ssh_key_to_blob): Remove the prefix 0x40.


diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 3d29f97..689241f 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -1964,6 +1964,11 @@ ssh_key_to_blob (gcry_sexp_t sexp, int with_secret,
               err = gpg_error (GPG_ERR_INV_SEXP);
               goto out;
             }
+          if (*p_elems == 'q')
+            { /* Remove the prefix 0x40.  */
+              data++;
+              datalen--;
+            }
           err = stream_write_string (stream, data, datalen);
           if (err)
             goto out;
-- 



More information about the Gnupg-devel mailing list