aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYawning Angel <yawning@schwanenlied.me>2024-03-17 10:39:10 +0900
committerYawning Angel <yawning@schwanenlied.me>2024-04-09 10:23:58 +0900
commitf9b9521bf07ffece22b24ac02ae4261e3d8b3c50 (patch)
tree6ac78d60b5ef7c571b2cb43f912540624d183f31
parentb155fdf8c96d6269fe0f56a3fda76a3df1e5a7c8 (diff)
core/crypto/_fiat/field_curve25519: Use multiply to calculate the mask
Largely for consistency with the generic code, either is valid with Odin semantics, but this is easier to comprehend.
-rw-r--r--core/crypto/_fiat/field_curve25519/field51.odin2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/crypto/_fiat/field_curve25519/field51.odin b/core/crypto/_fiat/field_curve25519/field51.odin
index 0be94eb51..1a731b31b 100644
--- a/core/crypto/_fiat/field_curve25519/field51.odin
+++ b/core/crypto/_fiat/field_curve25519/field51.odin
@@ -599,7 +599,7 @@ fe_set :: proc "contextless" (out1, arg1: ^Tight_Field_Element) {
@(optimization_mode="none")
fe_cond_swap :: #force_no_inline proc "contextless" (out1, out2: ^Tight_Field_Element, arg1: int) {
- mask := -u64(arg1)
+ mask := (u64(arg1) * 0xffffffffffffffff)
x := (out1[0] ~ out2[0]) & mask
x1, y1 := out1[0] ~ x, out2[0] ~ x
x = (out1[1] ~ out2[1]) & mask