summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNiels Möller <nisse@lysator.liu.se>2015-03-19 20:36:46 +0100
committerNiels Möller <nisse@lysator.liu.se>2015-03-19 20:36:46 +0100
commitb17739403c4a7bd5db0a9515380d69e4dd02344b (patch)
tree2f31cd1bf6e378b90891e7d5abca7aae3aecad14
parent5d4859c0b9f9a917d5d01c936654f611bde1d1e0 (diff)
downloadnettle-b17739403c4a7bd5db0a9515380d69e4dd02344b.tar.gz
Rename nettle_curve25519 to _nettle_curve25519, and remove declaration from ecc-curve.h.
-rw-r--r--ChangeLog4
-rw-r--r--curve25519-eh-to-x.c2
-rw-r--r--curve25519-mul-g.c2
-rw-r--r--curve25519-mul.c2
-rw-r--r--ecc-25519.c2
-rw-r--r--ecc-curve.h1
-rw-r--r--ecc-internal.h6
-rw-r--r--ed25519-sha512-pubkey.c2
-rw-r--r--ed25519-sha512-sign.c6
-rw-r--r--ed25519-sha512-verify.c6
-rw-r--r--examples/ecc-benchmark.c2
-rw-r--r--testsuite/ecdh-test.c2
-rw-r--r--testsuite/ecdsa-sign-test.c2
-rw-r--r--testsuite/ecdsa-verify-test.c2
-rw-r--r--testsuite/eddsa-compress-test.c2
-rw-r--r--testsuite/eddsa-sign-test.c6
-rw-r--r--testsuite/eddsa-verify-test.c6
-rw-r--r--testsuite/testutils.c2
18 files changed, 33 insertions, 24 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e25f2b6..f62ef3f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2015-03-19 Niels Möller <nisse@diamant.hack.org>
+ * ecc-curve.h (nettle_curve25519): Removed public declaration.
+ * ecc-internal.h (_nettle_curve25519): New location, new name.
+ Updated all users.
+
* nettle.texinfo: Updated EdDSA documentation.
* Makefile.in (DISTFILES): Added version.h.in, libnettle.map.in,
diff --git a/curve25519-eh-to-x.c b/curve25519-eh-to-x.c
index 8ba221f5..3a8787f0 100644
--- a/curve25519-eh-to-x.c
+++ b/curve25519-eh-to-x.c
@@ -52,7 +52,7 @@ curve25519_eh_to_x (mp_limb_t *xp, const mp_limb_t *p,
#define t1 (scratch + ecc->p.size)
#define t2 (scratch + 2*ecc->p.size)
- const struct ecc_curve *ecc = &nettle_curve25519;
+ const struct ecc_curve *ecc = &_nettle_curve25519;
mp_limb_t cy;
/* If u = U/W and v = V/W are the coordiantes of the point on the
diff --git a/curve25519-mul-g.c b/curve25519-mul-g.c
index f2d39f78..000e0987 100644
--- a/curve25519-mul-g.c
+++ b/curve25519-mul-g.c
@@ -44,7 +44,7 @@
void
curve25519_mul_g (uint8_t *r, const uint8_t *n)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
+ const struct ecc_curve *ecc = &_nettle_curve25519;
uint8_t t[CURVE25519_SIZE];
mp_limb_t *scratch;
mp_size_t itch;
diff --git a/curve25519-mul.c b/curve25519-mul.c
index 3dbb3dde..adb20cbc 100644
--- a/curve25519-mul.c
+++ b/curve25519-mul.c
@@ -44,7 +44,7 @@
void
curve25519_mul (uint8_t *q, const uint8_t *n, const uint8_t *p)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
+ const struct ecc_curve *ecc = &_nettle_curve25519;
mp_size_t itch;
mp_limb_t *scratch;
int i;
diff --git a/ecc-25519.c b/ecc-25519.c
index 7206e3de..92de49be 100644
--- a/ecc-25519.c
+++ b/ecc-25519.c
@@ -290,7 +290,7 @@ ecc_25519_sqrt(const struct ecc_modulo *p, mp_limb_t *rp,
#undef t0
}
-const struct ecc_curve nettle_curve25519 =
+const struct ecc_curve _nettle_curve25519 =
{
{
255,
diff --git a/ecc-curve.h b/ecc-curve.h
index eeec826f..574c9f2e 100644
--- a/ecc-curve.h
+++ b/ecc-curve.h
@@ -46,7 +46,6 @@ extern const struct ecc_curve nettle_secp_224r1;
extern const struct ecc_curve nettle_secp_256r1;
extern const struct ecc_curve nettle_secp_384r1;
extern const struct ecc_curve nettle_secp_521r1;
-extern const struct ecc_curve nettle_curve25519;
#ifdef __cplusplus
}
diff --git a/ecc-internal.h b/ecc-internal.h
index 5e0a94d9..ce1e34fb 100644
--- a/ecc-internal.h
+++ b/ecc-internal.h
@@ -73,6 +73,12 @@
#define sec_modinv _nettle_sec_modinv
#define curve25519_eh_to_x _nettle_curve25519_eh_to_x
+/* Keep this structure internal for now. It's misnamed (since it's
+ really implementing the equivalent twisted Edwards curve, with
+ different coordinates). And we're not quite ready to provide
+ general ecc operations over an arbitrary type of curve. */
+extern const struct ecc_curve _nettle_curve25519;
+
#define ECC_MAX_SIZE ((521 + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS)
/* Window size for ecc_mul_a. Using 4 bits seems like a good choice,
diff --git a/ed25519-sha512-pubkey.c b/ed25519-sha512-pubkey.c
index 8e4c52e8..677759c3 100644
--- a/ed25519-sha512-pubkey.c
+++ b/ed25519-sha512-pubkey.c
@@ -41,7 +41,7 @@
void
ed25519_sha512_public_key (uint8_t *pub, const uint8_t *priv)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
+ const struct ecc_curve *ecc = &_nettle_curve25519;
struct sha512_ctx ctx;
uint8_t digest[ED25519_KEY_SIZE];
mp_size_t itch = ecc->q.size + _eddsa_public_key_itch (ecc);
diff --git a/ed25519-sha512-sign.c b/ed25519-sha512-sign.c
index 6adda235..af9de209 100644
--- a/ed25519-sha512-sign.c
+++ b/ed25519-sha512-sign.c
@@ -44,8 +44,8 @@ ed25519_sha512_sign (const uint8_t *pub,
size_t length, const uint8_t *msg,
uint8_t *signature)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
- mp_size_t itch = ecc->q.size + _eddsa_sign_itch (&nettle_curve25519);
+ const struct ecc_curve *ecc = &_nettle_curve25519;
+ mp_size_t itch = ecc->q.size + _eddsa_sign_itch (ecc);
mp_limb_t *scratch = gmp_alloc_limbs (itch);
#define k2 scratch
#define scratch_out (scratch + ecc->q.size)
@@ -56,7 +56,7 @@ ed25519_sha512_sign (const uint8_t *pub,
_eddsa_expand_key (ecc, &nettle_sha512, &ctx, priv, digest, k2);
sha512_update (&ctx, ED25519_KEY_SIZE, k1);
- _eddsa_sign (&nettle_curve25519, &nettle_sha512, pub,
+ _eddsa_sign (ecc, &nettle_sha512, pub,
&ctx,
k2, length, msg, signature, scratch_out);
diff --git a/ed25519-sha512-verify.c b/ed25519-sha512-verify.c
index fc9cd010..e9ba5ae4 100644
--- a/ed25519-sha512-verify.c
+++ b/ed25519-sha512-verify.c
@@ -45,14 +45,14 @@ ed25519_sha512_verify (const uint8_t *pub,
size_t length, const uint8_t *msg,
const uint8_t *signature)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
- mp_size_t itch = 3*ecc->p.size + _eddsa_verify_itch (&nettle_curve25519);
+ const struct ecc_curve *ecc = &_nettle_curve25519;
+ mp_size_t itch = 3*ecc->p.size + _eddsa_verify_itch (ecc);
mp_limb_t *scratch = gmp_alloc_limbs (itch);
struct sha512_ctx ctx;
int res;
#define A scratch
#define scratch_out (scratch + 3*ecc->p.size)
- res = (_eddsa_decompress (&nettle_curve25519,
+ res = (_eddsa_decompress (ecc,
A, pub, scratch_out)
&& _eddsa_verify (ecc, &nettle_sha512,
pub, A, &ctx,
diff --git a/examples/ecc-benchmark.c b/examples/ecc-benchmark.c
index edf30fc2..15df4c7f 100644
--- a/examples/ecc-benchmark.c
+++ b/examples/ecc-benchmark.c
@@ -343,7 +343,7 @@ bench_curve (const struct ecc_curve *ecc)
const struct ecc_curve * const curves[] = {
&nettle_secp_192r1,
&nettle_secp_224r1,
- &nettle_curve25519,
+ &_nettle_curve25519,
&nettle_secp_256r1,
&nettle_secp_384r1,
&nettle_secp_521r1,
diff --git a/testsuite/ecdh-test.c b/testsuite/ecdh-test.c
index 48071e5a..5a2b39d5 100644
--- a/testsuite/ecdh-test.c
+++ b/testsuite/ecdh-test.c
@@ -191,7 +191,7 @@ test_main(void)
/* NOTE: This isn't the standard way to do curve25519
diffie-hellman, but it tests that the ecc_point interface works
also with curve25519. */
- test_dh ("curve25519", &nettle_curve25519,
+ test_dh ("curve25519", &_nettle_curve25519,
"238301186166219052901200372289459967515481170332211409964804596991365959539",
"14283836751943535877833976277675258994717521964638468784408792140505262281235",
"43912344711849354965202408139054167824861850336739416536288592824181793690574",
diff --git a/testsuite/ecdsa-sign-test.c b/testsuite/ecdsa-sign-test.c
index ac08b52c..559de8e1 100644
--- a/testsuite/ecdsa-sign-test.c
+++ b/testsuite/ecdsa-sign-test.c
@@ -159,7 +159,7 @@ test_main (void)
/* Non-standard ecdsa using curve25519. Not interop-tested with
anything else. */
- test_ecdsa (&nettle_curve25519,
+ test_ecdsa (&_nettle_curve25519,
"1db511101b8fd16f e0212c5679ef53f3"
"323bde77f9efa442 617314d576d1dbcb", /* z */
"aa2fa8facfdc3a99 ec466d41a2c9211c"
diff --git a/testsuite/ecdsa-verify-test.c b/testsuite/ecdsa-verify-test.c
index 54e489f2..76a182ba 100644
--- a/testsuite/ecdsa-verify-test.c
+++ b/testsuite/ecdsa-verify-test.c
@@ -146,7 +146,7 @@ test_main (void)
"FA509E70 AAC851AE 01AAC68D 62F86647"
"2660"); /* s */
- test_ecdsa (&nettle_curve25519,
+ test_ecdsa (&_nettle_curve25519,
/* Public key corresponding to the key in ecdsa-sign-test */
"59f8f317fd5f4e82 c02f8d4dec665fe1"
"230f83b8572638e1 b2ac34a30028e24d", /* x */
diff --git a/testsuite/eddsa-compress-test.c b/testsuite/eddsa-compress-test.c
index e264620c..9ceb6fe9 100644
--- a/testsuite/eddsa-compress-test.c
+++ b/testsuite/eddsa-compress-test.c
@@ -37,7 +37,7 @@
void test_main (void)
{
- const struct ecc_curve *ecc = &nettle_curve25519;
+ const struct ecc_curve *ecc = &_nettle_curve25519;
gmp_randstate_t rands;
mp_size_t size, itch;
mpz_t zp, t;
diff --git a/testsuite/eddsa-sign-test.c b/testsuite/eddsa-sign-test.c
index b4d1ca98..c496e6eb 100644
--- a/testsuite/eddsa-sign-test.c
+++ b/testsuite/eddsa-sign-test.c
@@ -104,7 +104,7 @@ void test_main (void)
{
/* Based on a few of the test vectors at
http://ed25519.cr.yp.to/python/sign.input */
- test_eddsa_sign (&nettle_curve25519, &nettle_sha512,
+ test_eddsa_sign (&_nettle_curve25519, &nettle_sha512,
SHEX("d75a980182b10ab7 d54bfed3c964073a"
"0ee172f3daa62325 af021a68f707511a"),
SHEX("9d61b19deffd5a60 ba844af492ec2cc4"
@@ -114,7 +114,7 @@ void test_main (void)
"84877f1eb8e5d974 d873e06522490155"
"5fb8821590a33bac c61e39701cf9b46b"
"d25bf5f0595bbe24 655141438e7a100b"));
- test_eddsa_sign (&nettle_curve25519, &nettle_sha512,
+ test_eddsa_sign (&_nettle_curve25519, &nettle_sha512,
SHEX("3d4017c3e843895a 92b70aa74d1b7ebc"
"9c982ccf2ec4968c c0cd55f12af4660c"),
SHEX("4ccd089b28ff96da 9db6c346ec114e0f"
@@ -124,7 +124,7 @@ void test_main (void)
"a2b27b5416503f8f b3762223ebdb69da"
"085ac1e43e15996e 458f3613d0f11d8c"
"387b2eaeb4302aee b00d291612bb0c00"));
- test_eddsa_sign (&nettle_curve25519, &nettle_sha512,
+ test_eddsa_sign (&_nettle_curve25519, &nettle_sha512,
SHEX("1ed506485b09a645 0be7c9337d9fe87e"
"f99c96f8bd11cd63 1ca160d0fd73067e"),
SHEX("f215d34fe2d757cf f9cf5c05430994de"
diff --git a/testsuite/eddsa-verify-test.c b/testsuite/eddsa-verify-test.c
index 7eb445a2..104111d3 100644
--- a/testsuite/eddsa-verify-test.c
+++ b/testsuite/eddsa-verify-test.c
@@ -127,7 +127,7 @@ test_eddsa (const struct ecc_curve *ecc,
void
test_main (void)
{
- test_eddsa (&nettle_curve25519, &nettle_sha512,
+ test_eddsa (&_nettle_curve25519, &nettle_sha512,
H("d75a980182b10ab7 d54bfed3c964073a"
"0ee172f3daa62325 af021a68f707511a"),
SHEX(""),
@@ -135,7 +135,7 @@ test_main (void)
"84877f1eb8e5d974 d873e06522490155"
"5fb8821590a33bac c61e39701cf9b46b"
"d25bf5f0595bbe24 655141438e7a100b"));
- test_eddsa (&nettle_curve25519, &nettle_sha512,
+ test_eddsa (&_nettle_curve25519, &nettle_sha512,
H("3d4017c3e843895a 92b70aa74d1b7ebc"
"9c982ccf2ec4968c c0cd55f12af4660c"),
SHEX("72"),
@@ -143,7 +143,7 @@ test_main (void)
"a2b27b5416503f8f b3762223ebdb69da"
"085ac1e43e15996e 458f3613d0f11d8c"
"387b2eaeb4302aee b00d291612bb0c00"));
- test_eddsa (&nettle_curve25519, &nettle_sha512,
+ test_eddsa (&_nettle_curve25519, &nettle_sha512,
H("1ed506485b09a645 0be7c9337d9fe87e"
"f99c96f8bd11cd63 1ca160d0fd73067e"),
SHEX("fbed2a7df418ec0e 8036312ec239fcee"
diff --git a/testsuite/testutils.c b/testsuite/testutils.c
index 37ed7531..1ef04c98 100644
--- a/testsuite/testutils.c
+++ b/testsuite/testutils.c
@@ -1229,7 +1229,7 @@ const struct ecc_curve * const ecc_curves[] = {
&nettle_secp_256r1,
&nettle_secp_384r1,
&nettle_secp_521r1,
- &nettle_curve25519,
+ &_nettle_curve25519,
NULL
};