diff --git a/crypto/curve25519/curve25519.c b/crypto/curve25519/curve25519.c index 3e805b88..14c94c83 100644 --- a/crypto/curve25519/curve25519.c +++ b/crypto/curve25519/curve25519.c @@ -231,7 +231,7 @@ static void fe_1(fe h) { * * Preconditions: b in {0,1}. */ static void fe_cswap(fe f, fe g, unsigned int b) { - b = -b; + b = 0-b; unsigned i; for (i = 0; i < 10; i++) { int32_t x = f[i] ^ g[i]; @@ -807,7 +807,7 @@ static void fe_neg(fe h, const fe f) { * * Preconditions: b in {0,1}. */ static void fe_cmov(fe f, const fe g, unsigned b) { - b = -b; + b = 0-b; unsigned i; for (i = 0; i < 10; i++) { int32_t x = f[i] ^ g[i]; diff --git a/tool/speed.cc b/tool/speed.cc index e9584a13..54f3c75e 100644 --- a/tool/speed.cc +++ b/tool/speed.cc @@ -456,6 +456,8 @@ static bool Speed25519(const std::string &selected) { uint8_t out[32], in1[32], in2[32]; memset(in1, 0, sizeof(in1)); memset(in2, 0, sizeof(in2)); + in1[0] = 1; + in2[0] = 9; return X25519(out, in1, in2) == 1; })) { fprintf(stderr, "Curve25519 arbitrary point multiplication failed.\n");