summaryrefslogtreecommitdiff
path: root/cipher/ecc-common.h
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2014-08-08 09:35:31 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2014-08-08 09:35:31 +0900
commit9933b9e5e1a3f5b1019c75f93bd265d4a1ecc270 (patch)
tree4de3a379b8591f3850f12316610b0c601c2ba42a /cipher/ecc-common.h
parent4ce77b0a810d3c889c07dfb385127d90fa1ae36a (diff)
downloadlibgcrypt-9933b9e5e1a3f5b1019c75f93bd265d4a1ecc270.tar.gz
ecc: Add cofactor to domain parameters.
* src/ec-context.h (mpi_ec_ctx_s): Add cofactor 'h'. * cipher/ecc-common.h (elliptic_curve_t): Add cofactor 'h'. (_gcry_ecc_update_curve_param): New API adding cofactor. * cipher/ecc-curves.c (ecc_domain_parms_t): Add cofactor 'h'. (ecc_domain_parms_t domain_parms): Add cofactors. (_gcry_ecc_fill_in_curve, _gcry_ecc_update_curve_param) (_gcry_ecc_get_curve, _gcry_mpi_ec_new, _gcry_ecc_get_param_sexp) (_gcry_ecc_get_mpi): Handle cofactor. * cipher/ecc-eddsa.c (_gcry_ecc_eddsa_genkey): Likewise. * cipher/ecc-misc.c (_gcry_ecc_curve_free) (_gcry_ecc_curve_copy): Likewise. * cipher/ecc.c (nist_generate_key, ecc_generate) (ecc_check_secret_key, ecc_sign, ecc_verify, ecc_encrypt_raw) (ecc_decrypt_raw, _gcry_pk_ecc_get_sexp, _gcry_pubkey_spec_ecc): Likewise. (compute_keygrip): Handle cofactor, but skip it for its computation. * mpi/ec.c (ec_deinit): Likewise. * tests/t-mpi-point.c (context_param): Likewise. (test_curve): Add cofactors. * tests/curves.c (sample_key_1, sample_key_2): Add cofactors. * tests/keygrip.c (key_grips): Add cofactors. -- We keep compatibility of compute_keygrip in cipher/ecc.c.
Diffstat (limited to 'cipher/ecc-common.h')
-rw-r--r--cipher/ecc-common.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/cipher/ecc-common.h b/cipher/ecc-common.h
index f066b4b7..83bf20d3 100644
--- a/cipher/ecc-common.h
+++ b/cipher/ecc-common.h
@@ -32,6 +32,7 @@ typedef struct
or d as used by Twisted Edwards curves. */
mpi_point_struct G; /* Base point (generator). */
gcry_mpi_t n; /* Order of G. */
+ gcry_mpi_t h; /* Cofactor. */
const char *name; /* Name of the curve or NULL. */
} elliptic_curve_t;
@@ -75,7 +76,7 @@ gpg_err_code_t _gcry_ecc_update_curve_param (const char *name,
enum ecc_dialects *dialect,
gcry_mpi_t *p, gcry_mpi_t *a,
gcry_mpi_t *b, gcry_mpi_t *g,
- gcry_mpi_t *n);
+ gcry_mpi_t *n, gcry_mpi_t *h);
const char *_gcry_ecc_get_curve (gcry_sexp_t keyparms,
int iterator,