authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2020-08-15 21:00:22+02:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-08-16 22:35:28-07:00
logab6ffa8a3c1e3fa802cacd970d3ed415ba25a85e
tree92eebda9b76a69d124a9980ee700b8ac4a52c25a
parent08dfbee961b7705d6f9d03fc982ec808f370f64a

Work around sqrtRatioM1() issue in release-safe mode


1 files changed, 2 insertions(+), 2 deletions(-)

lib/std/crypto/25519/ristretto255.zig+2-2
...@@ -24,11 +24,11 @@ pub const Ristretto255 = struct {...@@ -24,11 +24,11 @@ pub const Ristretto255 = struct {
24 const has_f_root = f_root_check.isZero();24 const has_f_root = f_root_check.isZero();
25 const x_sqrtm1 = x.mul(Fe.sqrtm1); // x*sqrt(-1)25 const x_sqrtm1 = x.mul(Fe.sqrtm1); // x*sqrt(-1)
26 x.cMov(x_sqrtm1, @boolToInt(has_p_root) | @boolToInt(has_f_root));26 x.cMov(x_sqrtm1, @boolToInt(has_p_root) | @boolToInt(has_f_root));
27 x = x.abs();27 const xa = x.abs();
28 if ((@boolToInt(has_m_root) | @boolToInt(has_p_root)) == 0) {28 if ((@boolToInt(has_m_root) | @boolToInt(has_p_root)) == 0) {
29 return error.NoRoot;29 return error.NoRoot;
30 }30 }
31 return x;31 return xa;
32 }32 }
3333
34 fn rejectNonCanonical(s: [32]u8) !void {34 fn rejectNonCanonical(s: [32]u8) !void {