Skip to content

Commit

Permalink
Store zero before returning in ecmul trivial cases (matter-labs#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
IAvecilla authored Sep 22, 2023
1 parent cc25b14 commit 3044527
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions precompiles/EcMul.yul
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,8 @@ object "EcMul" {

if affinePointIsInfinity(x, y) {
// Infinity * scalar = Infinity
mstore(0x00, 0x00)
mstore(0x20, 0x00)
return(0x00, 0x40)
}

Expand All @@ -386,6 +388,8 @@ object "EcMul" {

if eq(scalar, 0) {
// P * 0 = Infinity
mstore(0x00, 0x00)
mstore(0x20, 0x00)
return(0x00, 0x40)
}
if eq(scalar, 1) {
Expand Down

0 comments on commit 3044527

Please sign in to comment.