aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNIIBE Yutaka <[email protected]>2019-12-03 00:42:43 +0000
committerNIIBE Yutaka <[email protected]>2020-05-04 01:57:08 +0000
commited4c1e213ad050df159ccc94bd88bf8323c2de0a (patch)
treedce04bb5df38d9a8df5849fe564003c25f82f277
parentsos: don't change NBITS. (diff)
downloadgnupg-ed4c1e213ad050df159ccc94bd88bf8323c2de0a.tar.gz
gnupg-ed4c1e213ad050df159ccc94bd88bf8323c2de0a.zip
ecc-sos: public key is MPI with the prefix 0x40.
Signed-off-by: NIIBE Yutaka <[email protected]>
-rw-r--r--agent/cvt-openpgp.c2
-rw-r--r--g10/build-packet.c3
-rw-r--r--g10/export.c2
-rw-r--r--g10/keygen.c3
-rw-r--r--g10/parse-packet.c6
5 files changed, 5 insertions, 11 deletions
diff --git a/agent/cvt-openpgp.c b/agent/cvt-openpgp.c
index 4f23153ff..6d8d3ffc4 100644
--- a/agent/cvt-openpgp.c
+++ b/agent/cvt-openpgp.c
@@ -1274,7 +1274,7 @@ extract_private_key (gcry_sexp_t s_key, int req_private_key_data,
else if (!strcmp (name, "ecc") || !strcmp (name, "ecdsa"))
{
algoname = "ecc";
- format = "/qd?";
+ format = "q/d?";
npkey = 1;
nskey = 2;
curve = gcry_sexp_find_token (list, "curve", 0);
diff --git a/g10/build-packet.c b/g10/build-packet.c
index 9a00c1284..99ff69722 100644
--- a/g10/build-packet.c
+++ b/g10/build-packet.c
@@ -615,8 +615,7 @@ do_key (iobuf_t out, int ctb, PKT_public_key *pk)
|| (pk->pubkey_algo == PUBKEY_ALGO_EDDSA && (i == 0))
|| (pk->pubkey_algo == PUBKEY_ALGO_ECDH && (i == 0 || i == 2)))
err = gpg_mpi_write_nohdr (a, pk->pkey[i]);
- else if (pk->pubkey_algo == PUBKEY_ALGO_EDDSA
- || pk->pubkey_algo == PUBKEY_ALGO_ECDH)
+ else if (pk->pubkey_algo == PUBKEY_ALGO_ECDH)
err = gpg_sos_write (a, pk->pkey[i], NULL);
else
err = gpg_mpi_write (a, pk->pkey[i], NULL);
diff --git a/g10/export.c b/g10/export.c
index 458b3a02c..12e658fd2 100644
--- a/g10/export.c
+++ b/g10/export.c
@@ -751,7 +751,7 @@ cleartext_secret_key_to_openpgp (gcry_sexp_t s_key, PKT_public_key *pk)
if (err)
goto leave;
if (!err)
- err = gcry_sexp_extract_param (key, NULL, "/q",
+ err = gcry_sexp_extract_param (key, NULL, "q",
&pub_params[0],
NULL);
if (!err && (gcry_mpi_cmp(pk->pkey[1], pub_params[0])))
diff --git a/g10/keygen.c b/g10/keygen.c
index 56bb388b7..4917a36a9 100644
--- a/g10/keygen.c
+++ b/g10/keygen.c
@@ -1335,8 +1335,7 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp, int algo)
err = gpg_error (GPG_ERR_NO_OBJ);
goto leave;
}
- array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_OPAQUE);
- gcry_mpi_set_flag (array[1], GCRYMPI_FLAG_USER2);
+ array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_USG);
gcry_sexp_release (l2);
if (!array[1])
{
diff --git a/g10/parse-packet.c b/g10/parse-packet.c
index 54ce04abb..041db2cae 100644
--- a/g10/parse-packet.c
+++ b/g10/parse-packet.c
@@ -2591,11 +2591,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
else
{
unsigned int n = pktlen;
- if ( (algorithm == PUBKEY_ALGO_EDDSA && (i == 1))
- || (algorithm == PUBKEY_ALGO_ECDH && (i == 1)))
- pk->pkey[i] = sos_read (inp, &n, 0);
- else
- pk->pkey[i] = mpi_read (inp, &n, 0);
+ pk->pkey[i] = mpi_read (inp, &n, 0);
pktlen -= n;
if (!pk->pkey[i])
err = gpg_error (GPG_ERR_INV_PACKET);