| ... | @@ -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 | } |
| 33 | | 33 | |
| 34 | fn rejectNonCanonical(s: [32]u8) !void { | 34 | fn rejectNonCanonical(s: [32]u8) !void { |