Browse Source

Small tweaks to make curve25519-donna32 compile with our warnings

Nick Mathewson 9 years ago
parent
commit
391861311c
1 changed files with 5 additions and 1 deletions
  1. 5 1
      src/ext/curve25519_donna/curve25519-donna.c

+ 5 - 1
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];