Skip to content

Commit

Permalink
Improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ernestognw committed Jun 25, 2024
1 parent 9b24014 commit 3616771
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions contracts/utils/cryptography/P256.sol
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ library P256 {
/**
* @dev Point addition on the jacobian coordinates.
*
* Computation is assisted by Solidity's memory. It takes x1 and y1 arguments from the scratch space
* and returns x' and y' to the scratch space.
* Computation is assisted by Solidity's memory to avoid "Stack too deep" errors.
* It takes x1 and y1 arguments from the scratch space and returns x' and y' to the scratch space.
*
* Reference: https://www.hyperelliptic.org/EFD/g1p/auto-shortw-jacobian.html#addition-add-1998-cmo-2
*/
Expand Down Expand Up @@ -307,6 +307,7 @@ library P256 {
mstore(0x20, y)
}
}

function _fromScratchMemory() private pure returns (uint256 x, uint256 y) {
assembly ("memory-safe") {
x := mload(0x00)
Expand Down

0 comments on commit 3616771

Please sign in to comment.