]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
ed25519: Also check that retval in the ref10 implementation.
authorGeorge Kadianakis <desnacked@riseup.net>
Wed, 28 Jun 2017 11:12:20 +0000 (14:12 +0300)
committerGeorge Kadianakis <desnacked@riseup.net>
Wed, 28 Jun 2017 11:58:22 +0000 (14:58 +0300)
src/ext/ed25519/ref10/blinding.c

index 8503f90edd56b0b4d665a19a3b7aa58dcd070091..31332a2719e00e0014834e10e4c7ec9009c1d869 100644 (file)
@@ -49,6 +49,7 @@ int ed25519_ref10_blind_public_key(unsigned char *out,
   unsigned char pkcopy[32];
   ge_p3 A;
   ge_p2 Aprime;
+  int retval = -1;
 
   ed25519_ref10_gettweak(tweak, param);
 
@@ -62,17 +63,22 @@ int ed25519_ref10_blind_public_key(unsigned char *out,
    * "ge_frombytes", we'd use that, but there isn't. */
   memcpy(pkcopy, inp, 32);
   pkcopy[31] ^= (1<<7);
-  ge_frombytes_negate_vartime(&A, pkcopy);
+  if (ge_frombytes_negate_vartime(&A, pkcopy) != 0) {
+    goto done;
+  }
   /* There isn't a regular ge_scalarmult -- we have to do tweak*A + zero*B. */
   ge_double_scalarmult_vartime(&Aprime, tweak, &A, zero);
   ge_tobytes(out, &Aprime);
 
+  retval = 0;
+
+ done:
   memwipe(tweak, 0, sizeof(tweak));
   memwipe(&A, 0, sizeof(A));
   memwipe(&Aprime, 0, sizeof(Aprime));
   memwipe(pkcopy, 0, sizeof(pkcopy));
 
-  return 0;
+  return retval;
 }
 
 /* This is the group order encoded in a format that