mirror of
git://git.gnupg.org/gnupg.git
synced 2025-01-23 15:07:03 +01:00
ecc-sos: public key is MPI with the prefix 0x40.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
f27a581090
commit
ed4c1e213a
@ -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"))
|
else if (!strcmp (name, "ecc") || !strcmp (name, "ecdsa"))
|
||||||
{
|
{
|
||||||
algoname = "ecc";
|
algoname = "ecc";
|
||||||
format = "/qd?";
|
format = "q/d?";
|
||||||
npkey = 1;
|
npkey = 1;
|
||||||
nskey = 2;
|
nskey = 2;
|
||||||
curve = gcry_sexp_find_token (list, "curve", 0);
|
curve = gcry_sexp_find_token (list, "curve", 0);
|
||||||
|
@ -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_EDDSA && (i == 0))
|
||||||
|| (pk->pubkey_algo == PUBKEY_ALGO_ECDH && (i == 0 || i == 2)))
|
|| (pk->pubkey_algo == PUBKEY_ALGO_ECDH && (i == 0 || i == 2)))
|
||||||
err = gpg_mpi_write_nohdr (a, pk->pkey[i]);
|
err = gpg_mpi_write_nohdr (a, pk->pkey[i]);
|
||||||
else if (pk->pubkey_algo == PUBKEY_ALGO_EDDSA
|
else if (pk->pubkey_algo == PUBKEY_ALGO_ECDH)
|
||||||
|| pk->pubkey_algo == PUBKEY_ALGO_ECDH)
|
|
||||||
err = gpg_sos_write (a, pk->pkey[i], NULL);
|
err = gpg_sos_write (a, pk->pkey[i], NULL);
|
||||||
else
|
else
|
||||||
err = gpg_mpi_write (a, pk->pkey[i], NULL);
|
err = gpg_mpi_write (a, pk->pkey[i], NULL);
|
||||||
|
@ -751,7 +751,7 @@ cleartext_secret_key_to_openpgp (gcry_sexp_t s_key, PKT_public_key *pk)
|
|||||||
if (err)
|
if (err)
|
||||||
goto leave;
|
goto leave;
|
||||||
if (!err)
|
if (!err)
|
||||||
err = gcry_sexp_extract_param (key, NULL, "/q",
|
err = gcry_sexp_extract_param (key, NULL, "q",
|
||||||
&pub_params[0],
|
&pub_params[0],
|
||||||
NULL);
|
NULL);
|
||||||
if (!err && (gcry_mpi_cmp(pk->pkey[1], pub_params[0])))
|
if (!err && (gcry_mpi_cmp(pk->pkey[1], pub_params[0])))
|
||||||
|
@ -1335,8 +1335,7 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp, int algo)
|
|||||||
err = gpg_error (GPG_ERR_NO_OBJ);
|
err = gpg_error (GPG_ERR_NO_OBJ);
|
||||||
goto leave;
|
goto leave;
|
||||||
}
|
}
|
||||||
array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_OPAQUE);
|
array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_USG);
|
||||||
gcry_mpi_set_flag (array[1], GCRYMPI_FLAG_USER2);
|
|
||||||
gcry_sexp_release (l2);
|
gcry_sexp_release (l2);
|
||||||
if (!array[1])
|
if (!array[1])
|
||||||
{
|
{
|
||||||
|
@ -2591,11 +2591,7 @@ parse_key (IOBUF inp, int pkttype, unsigned long pktlen,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int n = pktlen;
|
unsigned int n = pktlen;
|
||||||
if ( (algorithm == PUBKEY_ALGO_EDDSA && (i == 1))
|
pk->pkey[i] = mpi_read (inp, &n, 0);
|
||||||
|| (algorithm == PUBKEY_ALGO_ECDH && (i == 1)))
|
|
||||||
pk->pkey[i] = sos_read (inp, &n, 0);
|
|
||||||
else
|
|
||||||
pk->pkey[i] = mpi_read (inp, &n, 0);
|
|
||||||
pktlen -= n;
|
pktlen -= n;
|
||||||
if (!pk->pkey[i])
|
if (!pk->pkey[i])
|
||||||
err = gpg_error (GPG_ERR_INV_PACKET);
|
err = gpg_error (GPG_ERR_INV_PACKET);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user