summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-10-22 14:26:53 +0200
committerWerner Koch <wk@gnupg.org>2013-12-06 19:30:57 +0100
commit4cf2c65fe15173c8d68a141a01b34fc1fb9080b7 (patch)
treec6b0f7841316cd6b5906a7a49fd5d311f6fa1e42
parent5917ce34e3b3eac4c15f62577e4723974024f818 (diff)
downloadlibgcrypt-4cf2c65fe15173c8d68a141a01b34fc1fb9080b7.tar.gz
ecc: Remove unused internal function.
* src/cipher-proto.h (gcry_pk_spec): Remove get_param. * cipher/ecc-curves.c (_gcry_ecc_get_param_sexp): Merge in code from _gcry_ecc_get_param. (_gcry_ecc_get_param): Remove. * cipher/ecc.c (_gcry_pubkey_spec_ecc): Remove _gcry_ecc_get_param. Signed-off-by: Werner Koch <wk@gnupg.org>
-rw-r--r--cipher/ecc-common.h3
-rw-r--r--cipher/ecc-curves.c30
-rw-r--r--cipher/ecc.c1
-rw-r--r--src/cipher-proto.h5
4 files changed, 9 insertions, 30 deletions
diff --git a/cipher/ecc-common.h b/cipher/ecc-common.h
index 1ee1d39d..dc4a9d03 100644
--- a/cipher/ecc-common.h
+++ b/cipher/ecc-common.h
@@ -80,8 +80,7 @@ gpg_err_code_t _gcry_ecc_update_curve_param (const char *name,
const char *_gcry_ecc_get_curve (gcry_sexp_t keyparms,
int iterator,
unsigned int *r_nbits);
-gcry_err_code_t _gcry_ecc_get_param (const char *name, gcry_mpi_t *pkey);
-gcry_sexp_t _gcry_ecc_get_param_sexp (const char *name);
+gcry_sexp_t _gcry_ecc_get_param_sexp (const char *name);
/*-- ecc-misc.c --*/
void _gcry_ecc_curve_free (elliptic_curve_t *E);
diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c
index 8125f244..85ebdd3f 100644
--- a/cipher/ecc-curves.c
+++ b/cipher/ecc-curves.c
@@ -926,20 +926,21 @@ _gcry_mpi_ec_new (gcry_ctx_t *r_ctx,
}
-/* Return the parameters of the curve NAME in an MPI array. */
-gcry_err_code_t
-_gcry_ecc_get_param (const char *name, gcry_mpi_t *pkey)
+/* Return the parameters of the curve NAME as an S-expression. */
+gcry_sexp_t
+_gcry_ecc_get_param_sexp (const char *name)
{
- gpg_err_code_t err;
unsigned int nbits;
elliptic_curve_t E;
mpi_ec_t ctx;
gcry_mpi_t g_x, g_y;
+ gcry_mpi_t pkey[6];
+ gcry_sexp_t result;
+ int i;
memset (&E, 0, sizeof E);
- err = _gcry_ecc_fill_in_curve (0, name, &E, &nbits);
- if (err)
- return err;
+ if (_gcry_ecc_fill_in_curve (0, name, &E, &nbits))
+ return NULL;
g_x = mpi_new (0);
g_y = mpi_new (0);
@@ -962,21 +963,6 @@ _gcry_ecc_get_param (const char *name, gcry_mpi_t *pkey)
mpi_free (g_x);
mpi_free (g_y);
- return 0;
-}
-
-
-/* Return the parameters of the curve NAME as an S-expression. */
-gcry_sexp_t
-_gcry_ecc_get_param_sexp (const char *name)
-{
- gcry_mpi_t pkey[6];
- gcry_sexp_t result;
- int i;
-
- if (_gcry_ecc_get_param (name, pkey))
- return NULL;
-
if (sexp_build (&result, NULL,
"(public-key(ecc(p%m)(a%m)(b%m)(g%m)(n%m)))",
pkey[0], pkey[1], pkey[2], pkey[3], pkey[4]))
diff --git a/cipher/ecc.c b/cipher/ecc.c
index a7de2543..e3c49cee 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -1755,7 +1755,6 @@ gcry_pk_spec_t _gcry_pubkey_spec_ecc =
ecc_get_nbits,
run_selftests,
compute_keygrip,
- _gcry_ecc_get_param,
_gcry_ecc_get_curve,
_gcry_ecc_get_param_sexp
};
diff --git a/src/cipher-proto.h b/src/cipher-proto.h
index 11c28624..0955ef59 100644
--- a/src/cipher-proto.h
+++ b/src/cipher-proto.h
@@ -84,10 +84,6 @@ typedef unsigned (*gcry_pk_get_nbits_t) (gcry_sexp_t keyparms);
typedef gpg_err_code_t (*pk_comp_keygrip_t) (gcry_md_hd_t md,
gcry_sexp_t keyparm);
-/* The type used to query ECC curve parameters. */
-typedef gcry_err_code_t (*pk_get_param_t) (const char *name,
- gcry_mpi_t *pkey);
-
/* The type used to query an ECC curve name. */
typedef const char *(*pk_get_curve_t)(gcry_sexp_t keyparms, int iterator,
unsigned int *r_nbits);
@@ -121,7 +117,6 @@ typedef struct gcry_pk_spec
gcry_pk_get_nbits_t get_nbits;
selftest_func_t selftest;
pk_comp_keygrip_t comp_keygrip;
- pk_get_param_t get_param;
pk_get_curve_t get_curve;
pk_get_curve_param_t get_curve_param;
} gcry_pk_spec_t;