Mamy Ratsimbazafy ec76ac5ea6
Fuzzing campaign fixes (#58)
* Add test case for #30 - Euler's criterion doesn't return 1 for a square

* Detect #42 in the test suite

* Detect #43 in the test suite

* comment in sqrt tests

* Add #67 to the anti-regression suite

* Add #61 to the anti-regression suite

* Add #62 to anti-regression suite

* Add #60 to the anti-regression suite

* Add #64 to the test suite

* Add #65 - case 1

* Add #65 case 2

* Add #65 case 3

* Add debug check to isSquare/Euler's Criterion/Legendre Symbol

* Make sure our primitives are correct

* For now deactivate montySquare CIOS fix #61 #62

* Narrow down #42 and #43 to powinv on 32-bit

* Detect #42 #43 at the fast squaring level

* More #42, #43 tests, Use multiplication instead of squaring as a temporary workaround, see https://github.com/mratsim/constantine/issues/68

* Prevent regression of #67 now that squaring is "fixed"
2020-06-23 01:27:40 +02:00
..
2020-06-23 01:27:40 +02:00

BigInt and Finite Field Arithmetic

This folder contains the implementation of

  • big integers
  • finite field arithmetic (i.e. modular arithmetic)

As a tradeoff between speed, code size and compiler-enforced dependent type checking, the library is structured the following way:

  • Finite Field: statically parametrized by an elliptic curve
  • Big Integers: statically parametrized by the bit width of the field modulus
  • Limbs: statically parametrized by the number of words to handle the bitwidth

This allows to reuse the same implementation at the limbs-level for curves that required the same number of words to save on code size, for example secp256k1 and BN254. It also enables compiler unrolling, inlining and register optimization, where code size is not an issue for example for multi-precision addition.

References