aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2020-05-26 02:53:56 +0000
committerNIIBE Yutaka <[email protected]>2020-05-26 02:53:56 +0000
commitf3d07c634e7bc18f517b9059ed23a3cdd23ef7a4 (patch)
tree6b84b4ce7f5814ff1434cbf189650fad84c769d9
parentecc-sos: Backport master change for ECDH. (diff)
downloadgnupg-f3d07c634e7bc18f517b9059ed23a3cdd23ef7a4.tar.gz
gnupg-f3d07c634e7bc18f517b9059ed23a3cdd23ef7a4.zip
agent: SSH clean up.
* agent/command-ssh.c (ssh_receive_key): Use sexp_key_construct for EdDSA. Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/command-ssh.c39
1 files changed, 9 insertions, 30 deletions
diff --git a/agent/command-ssh.c b/agent/command-ssh.c
index 51f37e18b..eaf92aaf3 100644
--- a/agent/command-ssh.c
+++ b/agent/command-ssh.c
@@ -2123,6 +2123,9 @@ ssh_receive_key (estream_t stream, gcry_sexp_t *key_new, int secret,
* we only want the real 32 byte private key - Libgcrypt expects
* this.
*/
+ /* For now, it's only ed25519 */
+ curve_name = "Ed25519";
+
mpi_list = xtrycalloc (3, sizeof *mpi_list);
if (!mpi_list)
{
@@ -2229,39 +2232,15 @@ ssh_receive_key (estream_t stream, gcry_sexp_t *key_new, int secret,
goto out;
}
- if ((spec.flags & SPEC_FLAG_IS_EdDSA))
- {
- if (secret)
- {
- err = gcry_sexp_build (&key, NULL,
- "(private-key(ecc(curve \"Ed25519\")"
- "(flags eddsa)(q %m)(d %m))"
- "(comment%s))",
- mpi_list[0], mpi_list[1],
- comment? comment:"");
- }
- else
- {
- err = gcry_sexp_build (&key, NULL,
- "(public-key(ecc(curve \"Ed25519\")"
- "(flags eddsa)(q %m))"
- "(comment%s))",
- mpi_list[0],
- comment? comment:"");
- }
- }
- else
+ err = sexp_key_construct (&key, spec, secret, curve_name, mpi_list,
+ comment? comment:"");
+ if (!err)
{
- err = sexp_key_construct (&key, spec, secret, curve_name, mpi_list,
- comment? comment:"");
- if (err)
- goto out;
+ if (key_spec)
+ *key_spec = spec;
+ *key_new = key;
}
- if (key_spec)
- *key_spec = spec;
- *key_new = key;
-
out:
es_fclose (cert);
mpint_list_free (mpi_list);