diff options
author | NIIBE Yutaka <[email protected]> | 2015-09-16 01:37:38 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2015-09-16 01:37:38 +0000 |
commit | 7d5999f0964c9412c0e18eb1adefdb729be68cd4 (patch) | |
tree | ce8aace75612f749bb814395b3608a9d66bf14ff | |
parent | po: Update Japanese translation. (diff) | |
download | gnupg-7d5999f0964c9412c0e18eb1adefdb729be68cd4.tar.gz gnupg-7d5999f0964c9412c0e18eb1adefdb729be68cd4.zip |
agent: Fix registering SSH Key of Ed25519.
* agent/command-ssh.c (stream_read_string): Add the prefix of 0x40.
--
GnuPG-bug-id: 2096
-rw-r--r-- | agent/command-ssh.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c index 88686200a..8be125503 100644 --- a/agent/command-ssh.c +++ b/agent/command-ssh.c @@ -580,8 +580,9 @@ stream_read_string (estream_t stream, unsigned int secure, /* Read a binary string from STREAM and store it as an opaque MPI at - R_MPI. Depending on SECURE use secure memory. If the string is - too large for key material return an error. */ + R_MPI, adding 0x40 (this is the prefix for EdDSA key in OpenPGP). + Depending on SECURE use secure memory. If the string is too large + for key material return an error. */ static gpg_error_t stream_read_blob (estream_t stream, unsigned int secure, gcry_mpi_t *r_mpi) { @@ -607,9 +608,9 @@ stream_read_blob (estream_t stream, unsigned int secure, gcry_mpi_t *r_mpi) /* Allocate space. */ if (secure) - buffer = xtrymalloc_secure (length? length:1); + buffer = xtrymalloc_secure (length+1); else - buffer = xtrymalloc (length?length:1); + buffer = xtrymalloc (length+1); if (!buffer) { err = gpg_error_from_syserror (); @@ -617,11 +618,12 @@ stream_read_blob (estream_t stream, unsigned int secure, gcry_mpi_t *r_mpi) } /* Read data. */ - err = stream_read_data (stream, buffer, length); + err = stream_read_data (stream, buffer + 1, length); if (err) goto leave; - *r_mpi = gcry_mpi_set_opaque (NULL, buffer, 8*length); + buffer[0] = 0x40; + *r_mpi = gcry_mpi_set_opaque (NULL, buffer, 8*(length+1)); buffer = NULL; leave: |