[tor-commits] [tor/master] Small tweaks to make curve25519-donna32 compile with our warnings

nickm at torproject.org nickm at torproject.org
Thu Jul 24 01:29:03 UTC 2014


commit 391861311c87a2968f21a3a93f146cc8e0de3181
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Jul 15 15:43:40 2014 +0200

    Small tweaks to make curve25519-donna32 compile with our warnings
---
 src/ext/curve25519_donna/curve25519-donna.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/ext/curve25519_donna/curve25519-donna.c b/src/ext/curve25519_donna/curve25519-donna.c
index 75c9f91..5a0c340 100644
--- a/src/ext/curve25519_donna/curve25519-donna.c
+++ b/src/ext/curve25519_donna/curve25519-donna.c
@@ -271,6 +271,7 @@ div_by_2_25(const limb v)
   return (v + roundoff) >> 25;
 }
 
+#if 0
 /* return v / (2^25), using only shifts and adds.
  *
  * On entry: v can take any value. */
@@ -280,6 +281,7 @@ div_s32_by_2_25(const s32 v)
    const s32 roundoff = ((uint32_t)(v >> 31)) >> 7;
    return (v + roundoff) >> 25;
 }
+#endif
 
 /* Reduce all coefficients of the short form input so that |x| < 2^26.
  *
@@ -485,7 +487,7 @@ fcontract(u8 *output, limb *input_limbs) {
 
   /* |input_limbs[i]| < 2^26, so it's valid to convert to an s32. */
   for (i = 0; i < 10; i++) {
-    input[i] = input_limbs[i];
+    input[i] = (s32) input_limbs[i];
   }
 
   for (j = 0; j < 2; ++j) {
@@ -848,6 +850,8 @@ crecip(limb *out, const limb *z) {
   /* 2^255 - 21 */ fmul(out,t1,z11);
 }
 
+int curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint);
+
 int
 curve25519_donna(u8 *mypublic, const u8 *secret, const u8 *basepoint) {
   limb bp[10], x[10], z[11], zmone[10];





More information about the tor-commits mailing list