Skip to content

Commit

Permalink
Merge pull request #52 from nlordell/fix-inline-ec-dbl
Browse files Browse the repository at this point in the history
Fix Inline ec_Dbl in Shamir-Strauss
  • Loading branch information
rdubois-crypto authored Dec 15, 2023
2 parents 4eaa678 + a98187a commit 95fd03d
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions solidity/src/FCL_elliptic.sol
Original file line number Diff line number Diff line change
Expand Up @@ -442,12 +442,10 @@ function SqrtMod(uint256 self) internal view returns (uint256 result){
T3 := mulmod(X, T2, p) // S = X1*V

T1 := mulmod(T1, T2, p) // W=UV
y2 := addmod(X, zz, p) //X+ZZ
let TT1 := addmod(X, sub(p, zz), p) //X-ZZ
y2 := mulmod(y2, TT1, p) //(X-ZZ)(X+ZZ)
T4 := mulmod(3, y2, p) //M
y2 := mulmod(addmod(X, zz, p), addmod(X, sub(p, zz), p), p) //(X-ZZ)(X+ZZ)
T4 := mulmod(3, y2, p) //M=3*(X-ZZ)(X+ZZ)

zzz := mulmod(TT1, zzz, p) //zzz3=W*zzz1
zzz := mulmod(T1, zzz, p) //zzz3=W*zzz1
zz := mulmod(T2, zz, p) //zz3=V*ZZ1, V free

X := addmod(mulmod(T4, T4, p), mulmod(minus_2, T3, p), p) //X3=M^2-2S
Expand Down

0 comments on commit 95fd03d

Please sign in to comment.