]> git.ipfire.org Git - thirdparty/nettle.git/commitdiff
Rename nettle_curve25519 to _nettle_curve25519, and remove declaration from ecc-curve.h.
authorNiels Möller <nisse@lysator.liu.se>
Thu, 19 Mar 2015 19:36:46 +0000 (20:36 +0100)
committerNiels Möller <nisse@lysator.liu.se>
Thu, 19 Mar 2015 19:36:46 +0000 (20:36 +0100)
18 files changed:
ChangeLog
curve25519-eh-to-x.c
curve25519-mul-g.c
curve25519-mul.c
ecc-25519.c
ecc-curve.h
ecc-internal.h
ed25519-sha512-pubkey.c
ed25519-sha512-sign.c
ed25519-sha512-verify.c
examples/ecc-benchmark.c
testsuite/ecdh-test.c
testsuite/ecdsa-sign-test.c
testsuite/ecdsa-verify-test.c
testsuite/eddsa-compress-test.c
testsuite/eddsa-sign-test.c
testsuite/eddsa-verify-test.c
testsuite/testutils.c

index 4e25f2b6811431f916d094f8c6494053079a9069..f62ef3f66a5fc97b31aab14c4c53e4fa70721686 100644 (file)
--- 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,
index 8ba221f5fb76f8d2101b5210d020683322a16567..3a8787f022edcc67abc6e40cc596f4414ed724a2 100644 (file)
@@ -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
index f2d39f78b8d0fa5e5250f622ac790b33969498e4..000e0987094e9a744568f8f78adb6c549c6832be 100644 (file)
@@ -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;
index 3dbb3ddee58b1aa7bf6bee10afd78245a7cdea8b..adb20cbc62af6a2c1387ab1e1ffcaec4094c90a2 100644 (file)
@@ -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;
index 7206e3de95e8601aa86d74598e4d2bd8cd9fc707..92de49be941c5744d41a1d9ddf27f089b4728612 100644 (file)
@@ -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,
index eeec826fc255ab4b7614cb262da1e899ded000ef..574c9f2e00e13b5ecd3b6abb173c0f3e2202d9d8 100644 (file)
@@ -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
 }
index 5e0a94d9f898eee95f44a220a2aa78130acffd98..ce1e34fb2117bc861272ab5159dd101cc20d6c0f 100644 (file)
 #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,
index 8e4c52e82deed3a381b18ff2c07e5c272811d19b..677759c38d509cb60f6f2b26ed20141790ebeae5 100644 (file)
@@ -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);
index 6adda23579dc0be347bc7bcabcf5ae9b7181fe42..af9de2093d853cbe01bed6e51df8e7240050e4d4 100644 (file)
@@ -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);
 
index fc9cd01065e9869d5d8fe6e90b27fc9762d1e338..e9ba5ae4e714d4ce387397c909612e485891922a 100644 (file)
@@ -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,
index edf30fc21a91ceb0e0b558621c4b6e457aac4cea..15df4c7ffff73fb2aba83572a6b79e52b11ee760 100644 (file)
@@ -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,
index 48071e5a4be080e93227579cda14b579cdc8e759..5a2b39d52d2e3427b17d47476becc0a60a433826 100644 (file)
@@ -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",
index ac08b52c257c6ea0a9b33043cae4ccadc335090e..559de8e16807add87e73fe0bce4a70769203b7e3 100644 (file)
@@ -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"
index 54e489f22ec7c25fdb986577f5c78178dbb28ce2..76a182badd33fe0048e80c35c7bd7895988fc142 100644 (file)
@@ -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 */
index e264620cfff3e37a40eec11fd17276f53dc8c788..9ceb6fe98cf762fff1bd0e792d1d4f5cbf06034c 100644 (file)
@@ -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;
index b4d1ca98af75735e7252b41279ae832f39672f24..c496e6eb3030424e56f42567e2d0b4bccda0c679 100644 (file)
@@ -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"
index 7eb445a262c6c73d4036de4e5b940d433f702043..104111d3ad21c93b823af442ec74a7cf4fa30b3f 100644 (file)
@@ -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"
index 37ed7531da5076ca2f0c40d0696b29fb67858f8f..1ef04c988949261b82016530869e0a314811dd0d 100644 (file)
@@ -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
 };