]> git.codecow.com Git - nano25519.git/commitdiff
Remove commented code and use merged arithmetic in regular p file.
authorChris Duncan <chris@codecow.com>
Mon, 26 Oct 2026 00:05:47 +0000 (17:05 -0700)
committerChris Duncan <chris@codecow.com>
Mon, 26 Oct 2026 00:05:47 +0000 (17:05 -0700)
src/assembly/ed25519/p.ts
src/assembly/ed25519/p2.ts

index dcab67fc12198a523291c965a6b45e1eed36a24c..9086794bbe9adfbf3449e7a7c1f695851bd12add 100644 (file)
@@ -228,8 +228,7 @@ export function ge_sub_p3 (r: ge_p3, p: ge_p3, q: ge_p3, t_fe: FieldElement, t_g
  * before being reassigned at the only call site of this function.
  */
 export function ge_sub_cached (r: ge_p1p1, p: ge_p3, q: ge_cached): void {
-       fe_add(r.X, p.Y, p.X)
-       fe_sub(r.Y, p.Y, p.X)
+       fe_subadd(r.Y, r.X)
        fe_mul_dual(r.X, r.X, q.YminusX, r.Y, r.Y, q.YplusX)
        fe_mul2_dual(r.T, q.T2d, p.T, r.Z, p.Z, q.Z)
        fe_subadd(r.X, r.Y)
@@ -250,8 +249,7 @@ export function ge_sub_cached (r: ge_p1p1, p: ge_p3, q: ge_cached): void {
  * again before being reassigned at the only call site of this function.
  */
 export function ge_sub_precomp (r: ge_p1p1, p: ge_p3, q: ge_precomp): void {
-       fe_add(r.X, p.Y, p.X)
-       fe_sub(r.Y, p.Y, p.X)
+       fe_subadd(r.Y, r.X)
        fe_mul_dual(r.X, r.X, q.yminusx, r.Y, r.Y, q.yplusx)
        fe_dbl(r.Z, p.Z)
        fe_mul(r.T, q.xy2d, p.T)
index d0e76a15999ee2f0dbe814990e3ccdf3497d1340..3aeb14a1514c16175c16a19233dbe0c198c461bd 100644 (file)
@@ -309,11 +309,6 @@ export function gepair_sub_precomp (r: ge_p1p1, p: ge_p3, q: ge_precomp): void {
 
        fep_unpack(r.X, r.Y, gepair_sub_precomp_rA) // X' = (Y₁+X₁)(Y₂-X₂) - (Y₁-X₁)(Y₂+X₂), Y' = (Y₁-X₁)(Y₂+X₂) + (Y₁+X₁)(Y₂-X₂)
        fep_unpack(r.Z, r.T, gepair_sub_precomp_rB) // Z' = 2Z₁ - 2T₁X₂Y₂d, T' = 2T₁X₂Y₂d + 2Z₁
-
-       // fe_mul_dual(r.X, r.X, q.yminusx, r.Y, r.Y, q.yplusx)
-       // fe_mul(r.T, q.xy2d, p.T)
-       // fe_subadd(r.X, r.Y)
-       // fe_subadd(r.Z, r.T)
 }
 
 function ge_p3_tobytes (s: StaticArray<u8>, h: gepair_p3,