1
0
mirror of git://git.gnupg.org/gnupg.git synced 2025-04-17 15:44:34 +02:00

ecc-sos,gpg: Use sexp_extract_param_sos to get MPI.

* g10/export.c (sexp_extract_param_sos): Expose.
* g10/keygen.c (ecckey_from_sexp): Use it.

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2020-06-04 18:16:27 +09:00
parent f71dff40ea
commit fb9e39dcc9
4 changed files with 10 additions and 16 deletions

View File

@ -627,7 +627,7 @@ canon_pk_algo (enum gcry_pk_algos algo)
} }
static gpg_error_t gpg_error_t
sexp_extract_param_sos (gcry_sexp_t sexp, const char *param, gcry_mpi_t *r_sos) sexp_extract_param_sos (gcry_sexp_t sexp, const char *param, gcry_mpi_t *r_sos)
{ {
gpg_error_t err; gpg_error_t err;

View File

@ -1329,19 +1329,10 @@ ecckey_from_sexp (gcry_mpi_t *array, gcry_sexp_t sexp, int algo)
if (err) if (err)
goto leave; goto leave;
l2 = gcry_sexp_find_token (list, "q", 0); err = sexp_extract_param_sos (list, "q", &array[1])
if (!l2) if (err)
{
err = gpg_error (GPG_ERR_NO_OBJ);
goto leave; goto leave;
}
array[1] = gcry_sexp_nth_mpi (l2, 1, GCRYMPI_FMT_OPAQUE);
gcry_sexp_release (l2);
if (!array[1])
{
err = gpg_error (GPG_ERR_INV_OBJ);
goto leave;
}
gcry_sexp_release (list); gcry_sexp_release (list);
if (algo == PUBKEY_ALGO_ECDH) if (algo == PUBKEY_ALGO_ECDH)

View File

@ -415,6 +415,9 @@ void pop_export_filters (void);
int exact_subkey_match_p (KEYDB_SEARCH_DESC *desc, kbnode_t node); int exact_subkey_match_p (KEYDB_SEARCH_DESC *desc, kbnode_t node);
gpg_error_t sexp_extract_param_sos (gcry_sexp_t sexp, const char *param,
gcry_mpi_t *r_sos);
int export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options, int export_pubkeys (ctrl_t ctrl, strlist_t users, unsigned int options,
export_stats_t stats); export_stats_t stats);
int export_seckeys (ctrl_t ctrl, strlist_t users, unsigned int options, int export_seckeys (ctrl_t ctrl, strlist_t users, unsigned int options,