From: Chris Duncan Date: Mon, 26 Oct 2026 19:19:28 +0000 (-0700) Subject: Compute A slide within conditional blocks. X-Git-Url: https://git.codecow.com/?a=commitdiff_plain;h=59de13efa57409897d856fdb984b90d7b9ae75b0;p=nano25519.git Compute A slide within conditional blocks. --- diff --git a/src/assembly/ed25519/ge.ts b/src/assembly/ed25519/ge.ts index 85a2dc4..05649fd 100644 --- a/src/assembly/ed25519/ge.ts +++ b/src/assembly/ed25519/ge.ts @@ -487,13 +487,14 @@ export function ge_double_scalarmult_vartime_to_p3 (r: ge_p3, a: StaticArray while (i >= 0) { gepair_p2_dbl(tA, tB, pA, pB, t_fep) - const aslidei = aslide[i] - if (aslidei > 0) { + if (aslide[i] > 0) { + const aslidei = aslide[i] >> 1 gepair_p1p1_to_p3(uA, uB, tA, tB, t_fep) - gepair_add_cached(tA, tB, uA, uB, Ai[aslidei >> 1], t_fep) - } else if (aslidei < 0) { + gepair_add_cached(tA, tB, uA, uB, Ai[aslidei], t_fep) + } else if (aslide[i] < 0) { + const aslidei = (-aslide[i]) >> 1 gepair_p1p1_to_p3(uA, uB, tA, tB, t_fep) - gepair_sub_cached(tA, tB, uA, uB, Ai[(-aslidei) >> 1], t_fep) + gepair_sub_cached(tA, tB, uA, uB, Ai[aslidei], t_fep) } const bslidei = bslide[i]