From ab6ffa8a3c1e3fa802cacd970d3ed415ba25a85e Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 15 Aug 2020 21:00:22 +0200 Subject: Work around sqrtRatioM1() issue in release-safe mode --- lib/std/crypto/25519/ristretto255.zig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/std/crypto/25519/ristretto255.zig b/lib/std/crypto/25519/ristretto255.zig index 21b305f89d..bfdeb41f9d 100644 --- a/lib/std/crypto/25519/ristretto255.zig +++ b/lib/std/crypto/25519/ristretto255.zig @@ -24,11 +24,11 @@ pub const Ristretto255 = struct { const has_f_root = f_root_check.isZero(); const x_sqrtm1 = x.mul(Fe.sqrtm1); // x*sqrt(-1) x.cMov(x_sqrtm1, @boolToInt(has_p_root) | @boolToInt(has_f_root)); - x = x.abs(); + const xa = x.abs(); if ((@boolToInt(has_m_root) | @boolToInt(has_p_root)) == 0) { return error.NoRoot; } - return x; + return xa; } fn rejectNonCanonical(s: [32]u8) !void { -- cgit v1.2.3