-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
engine-modexp
bug fixes and performance improvements (#809)
## Description This fixes the following issues with `engine-modexp`: - addition overflow in big_sq that would lead to incorrect output (and a crash in debug mode) - assert failure in sub_to_same_size that would lead to incorrect output - slow modular exponentiation with even modulus. The bottleneck was the routine were the inverse of A mod M was computed, where M is a power of two. This inversion function has been replaced with the algorithm found in [this paper](https://eprint.iacr.org/2017/411.pdf), which is much faster. ## Performance / NEAR gas cost considerations The performance of modular exponentiation with even modulus is improved. Performance remains the same for odd modulus. ## Testing Extensive fuzz testing, was was also the method used to detect the issues that this PR addresses. ## How should this be reviewed ## Additional information --------- Co-authored-by: Michael Birch <michael.birch@aurora.dev>
- Loading branch information
1 parent
056c4c5
commit 4ecee7d
Showing
2 changed files
with
145 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters