summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNIIBE Yutaka <gniibe@fsij.org>2014-07-04 12:26:30 +0900
committerNIIBE Yutaka <gniibe@fsij.org>2014-07-04 12:27:57 +0900
commita879203e07dc2b3e31a22be3e1649b231f49fc95 (patch)
tree8dc06725d41f3a93a6f27e173c236808923e7443
parent79caa02472081c9fb7f22659b84be5b21d215f1e (diff)
downloadlibgcrypt-gniibe-curve25519.tar.gz
Add FIXME marks.gniibe-curve25519
-rw-r--r--.gitignore2
-rw-r--r--cipher/ecc-curves.c1
-rw-r--r--cipher/ecc-misc.c1
-rw-r--r--cipher/ecc.c11
4 files changed, 13 insertions, 2 deletions
diff --git a/.gitignore b/.gitignore
index 3929e4d1..87934c7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,5 @@
+build-aux/test-driver
+test-driver
*.lo
*.o
.deps/
diff --git a/cipher/ecc-curves.c b/cipher/ecc-curves.c
index e7dbc17e..76dd1d80 100644
--- a/cipher/ecc-curves.c
+++ b/cipher/ecc-curves.c
@@ -1160,6 +1160,7 @@ _gcry_ecc_get_mpi (const char *name, mpi_ec_t ec, int copy)
&encpk, &encpklen))
return mpi_set_opaque (NULL, encpk, encpklen*8);
}
+ // FIXME Montgomery
}
return NULL;
diff --git a/cipher/ecc-misc.c b/cipher/ecc-misc.c
index 3f284fe2..12776f21 100644
--- a/cipher/ecc-misc.c
+++ b/cipher/ecc-misc.c
@@ -280,6 +280,7 @@ _gcry_ecc_compute_public (mpi_point_t Q, mpi_ec_t ec,
if (!Q)
Q = mpi_point_new (0);
if (Q)
+ // FIXME
_gcry_mpi_ec_mul_point (Q, d, G, ec);
}
diff --git a/cipher/ecc.c b/cipher/ecc.c
index 676cc797..99b08800 100644
--- a/cipher/ecc.c
+++ b/cipher/ecc.c
@@ -134,8 +134,7 @@ nist_generate_key (ECC_secret_key *sk, elliptic_curve_t *E, mpi_ec_t ctx,
* Currently, we distinguish the two curves by ECC_DIALECT_ED25519
* and MPI_EC_MONTGOMERY, which works, but is not that correct.
*/
- if (ctx->dialect == ECC_DIALECT_ED25519
- || E->model == MPI_EC_MONTGOMERY)
+ if (ctx->dialect == ECC_DIALECT_ED25519 || E->model == MPI_EC_MONTGOMERY)
{
char *rndbuf;
@@ -152,6 +151,7 @@ nist_generate_key (ECC_secret_key *sk, elliptic_curve_t *E, mpi_ec_t ctx,
/* Compute Q. */
+ // FIXME
_gcry_mpi_ec_mul_point (&Q, sk->d, &E->G, ctx);
/* Copy the stuff to the key structures. */
@@ -569,6 +569,8 @@ ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey)
log_fatal ("ecgen: Failed to get affine coordinates for %s\n", "Q");
public = _gcry_ecc_ec2os (x, y, sk.E.p);
}
+ // FIXME Montgomery
+
secret = sk.d; sk.d = NULL;
if (E.name)
{
@@ -1261,6 +1263,7 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
point_init (&R);
/* R = kQ <=> R = kdG */
+ // FIXME
_gcry_mpi_ec_mul_point (&R, data, &pk.Q, ec);
if (_gcry_mpi_ec_get_affine (x, y, &R, ec))
@@ -1268,6 +1271,7 @@ ecc_encrypt_raw (gcry_sexp_t *r_ciph, gcry_sexp_t s_data, gcry_sexp_t keyparms)
mpi_s = _gcry_ecc_ec2os (x, y, pk.E.p);
/* R = kG */
+ // FIXME
_gcry_mpi_ec_mul_point (&R, data, &pk.E.G, ec);
if (_gcry_mpi_ec_get_affine (x, y, &R, ec))
@@ -1419,6 +1423,7 @@ ecc_decrypt_raw (gcry_sexp_t *r_plain, gcry_sexp_t s_data, gcry_sexp_t keyparms)
sk.E.p, sk.E.a, sk.E.b);
/* R = dkG */
+ // FIXME
_gcry_mpi_ec_mul_point (&R, sk.d, &kG, ec);
/* The following is false: assert( mpi_cmp_ui( R.x, 1 )==0 );, so: */
@@ -1733,6 +1738,8 @@ _gcry_pk_ecc_get_sexp (gcry_sexp_t *r_sexp, int mode, mpi_ec_t ec)
{
mpi_Q = _gcry_mpi_ec_ec2os (ec->Q, ec);
}
+ // FIXME Montgomery
+
if (!mpi_Q)
{
rc = GPG_ERR_BROKEN_PUBKEY;