summaryrefslogtreecommitdiff
path: root/mpi
diff options
context:
space:
mode:
authorWerner Koch <wk@gnupg.org>2013-11-05 17:25:02 +0100
committerWerner Koch <wk@gnupg.org>2013-11-05 17:26:52 +0100
commitf09ffe8a4802af65a116e79eceeb1cb4ed4fa2f4 (patch)
tree294ee667a0c27bd20c333eab4fb69bb04b8c8de3 /mpi
parent630aca794ddf057fb7265b7dc346374743036af4 (diff)
downloadlibgcrypt-f09ffe8a4802af65a116e79eceeb1cb4ed4fa2f4.tar.gz
ecc: Fully implement Ed25519 compression in ECDSA mode.
* src/ec-context.h (mpi_ec_ctx_s): Add field FLAGS. * mpi/ec.c (ec_p_init): Add arg FLAGS. Change all callers to pass it. * cipher/ecc-curves.c (point_from_keyparam): Add arg EC, parse as opaque mpi and use eddsa decoding depending on the flag. (_gcry_mpi_ec_new): Rearrange to parse Q and D after knowing the curve. Signed-off-by: Werner Koch <wk@gnupg.org>
Diffstat (limited to 'mpi')
-rw-r--r--mpi/ec.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/mpi/ec.c b/mpi/ec.c
index 39ab5ebe..57396ce0 100644
--- a/mpi/ec.c
+++ b/mpi/ec.c
@@ -350,6 +350,7 @@ ec_get_two_inv_p (mpi_ec_t ec)
static void
ec_p_init (mpi_ec_t ctx, enum gcry_mpi_ec_models model,
enum ecc_dialects dialect,
+ int flags,
gcry_mpi_t p, gcry_mpi_t a, gcry_mpi_t b)
{
int i;
@@ -367,6 +368,7 @@ ec_p_init (mpi_ec_t ctx, enum gcry_mpi_ec_models model,
ctx->model = model;
ctx->dialect = dialect;
+ ctx->flags = flags;
if (dialect == ECC_DIALECT_ED25519)
ctx->nbits = 256;
else
@@ -454,12 +456,13 @@ ec_deinit (void *opaque)
mpi_ec_t
_gcry_mpi_ec_p_internal_new (enum gcry_mpi_ec_models model,
enum ecc_dialects dialect,
+ int flags,
gcry_mpi_t p, gcry_mpi_t a, gcry_mpi_t b)
{
mpi_ec_t ctx;
ctx = gcry_xcalloc (1, sizeof *ctx);
- ec_p_init (ctx, model, dialect, p, a, b);
+ ec_p_init (ctx, model, dialect, flags, p, a, b);
return ctx;
}
@@ -476,6 +479,7 @@ gpg_err_code_t
_gcry_mpi_ec_p_new (gcry_ctx_t *r_ctx,
enum gcry_mpi_ec_models model,
enum ecc_dialects dialect,
+ int flags,
gcry_mpi_t p, gcry_mpi_t a, gcry_mpi_t b)
{
gcry_ctx_t ctx;
@@ -489,7 +493,7 @@ _gcry_mpi_ec_p_new (gcry_ctx_t *r_ctx,
if (!ctx)
return gpg_err_code_from_syserror ();
ec = _gcry_ctx_get_pointer (ctx, CONTEXT_TYPE_EC);
- ec_p_init (ec, model, dialect, p, a, b);
+ ec_p_init (ec, model, dialect, flags, p, a, b);
*r_ctx = ctx;
return 0;