mirror of
https://github.com/status-im/constantine.git
synced 2025-02-23 09:28:07 +00:00
* Lay out the refactoring objectives and tradeoffs * Refactor the 32 and 64-bit primitives [skip ci] * BigInts and Modular BigInts compile * Make the bigints test compile * Fix modular reduction * Fix reduction tests vs GMP * Implement montegomery mul, pow, inverse, WIP finite field compilation * Make FiniteField compile * Fix exponentiation compilation * Fix Montgomery magic constant computation for 2^64 words * Fix typo in non-optimized CIOS - passing finite fields IO tests * Add limbs comparisons [skip ci] * Fix on precomputation of the Montgomery magic constant * Passing all tests including 𝔽p2 * modular addition, the test for mersenne prime was wrong * update benches * Fix "nimble test" + typo on out-of-place field addition * bigint division, normalization is needed: https://travis-ci.com/github/mratsim/constantine/jobs/298359743 * missing conversion in subborrow non-x86 fallback - https://travis-ci.com/github/mratsim/constantine/jobs/298359744 * Fix little-endian serialization * Constantine32 flag to run 32-bit constantine on 64-bit machines * IO Field test, ensure that BaseType is used instead of uint64 when the prime can field in uint32 * Implement proper addcarry and subborrow fallback for the compile-time VM * Fix export issue when the logical wordbitwidth == physical wordbitwidth - passes all tests (32-bit and 64-bit) * Fix uint128 on ARM * Fix C++ conditional copy and ARM addcarry/subborrow * Add investigation for SIGFPE in Travis * Fix debug display for unsafeDiv2n1n * multiplexer typo * moveMem bug in glibc of Ubuntu 16.04? * Was probably missing an early clobbered register annotation on conditional mov * Note on Montgomery-friendly moduli * Strongly suspect a GCC before GCC 7 codegen bug (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87139) * hex conversion was (for debugging) not taking requested order into account + inlining comment * Use 32-bit limbs on ARM64, uint128 builtin __udivti4 bug? * Revert "Use 32-bit limbs on ARM64, uint128 builtin __udivti4 bug?" This reverts commit 087f9aa7fb40bbd058d05cbd8eec7fc082911f49. * Fix subborrow fallback for non-x86 (need to maks the borrow)
81 lines
2.8 KiB
Nim
81 lines
2.8 KiB
Nim
packageName = "constantine"
|
|
version = "0.0.1"
|
|
author = "Status Research & Development GmbH"
|
|
description = "This library provides constant time big int primitives."
|
|
license = "MIT or Apache License 2.0"
|
|
srcDir = "src"
|
|
|
|
### Dependencies
|
|
requires "nim >= 1.1.0"
|
|
|
|
### Helper functions
|
|
proc test(flags, path: string) =
|
|
if not dirExists "build":
|
|
mkDir "build"
|
|
# Compilation language is controlled by WEAVE_TEST_LANG
|
|
var lang = "c"
|
|
if existsEnv"TEST_LANG":
|
|
lang = getEnv"TEST_LANG"
|
|
|
|
var cc = ""
|
|
if existsEnv"CC":
|
|
cc = " --cc:" & getEnv"CC"
|
|
|
|
echo "\n========================================================================================"
|
|
echo "Running [flags: ", flags, "] ", path
|
|
echo "========================================================================================"
|
|
exec "nim " & lang & cc & " " & flags & " --verbosity:0 --outdir:build -r --hints:off --warnings:off " & path
|
|
|
|
### tasks
|
|
task test, "Run all tests":
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
|
test "", "tests/test_primitives.nim"
|
|
|
|
test "", "tests/test_io_bigints.nim"
|
|
test "", "tests/test_bigints.nim"
|
|
test "", "tests/test_bigints_multimod.nim"
|
|
|
|
test "", "tests/test_io_fields"
|
|
test "", "tests/test_finite_fields.nim"
|
|
test "", "tests/test_finite_fields_powinv.nim"
|
|
|
|
test "", "tests/test_bigints_vs_gmp.nim"
|
|
test "", "tests/test_finite_fields_vs_gmp.nim"
|
|
|
|
if sizeof(int) == 8: # 32-bit tests
|
|
test "-d:Constantine32", "tests/test_primitives.nim"
|
|
|
|
test "-d:Constantine32", "tests/test_io_bigints.nim"
|
|
test "-d:Constantine32", "tests/test_bigints.nim"
|
|
test "-d:Constantine32", "tests/test_bigints_multimod.nim"
|
|
|
|
test "-d:Constantine32", "tests/test_io_fields"
|
|
test "-d:Constantine32", "tests/test_finite_fields.nim"
|
|
test "-d:Constantine32", "tests/test_finite_fields_powinv.nim"
|
|
|
|
test "-d:Constantine32", "tests/test_bigints_vs_gmp.nim"
|
|
test "-d:Constantine32", "tests/test_finite_fields_vs_gmp.nim"
|
|
|
|
task test_no_gmp, "Run tests that don't require GMP":
|
|
# -d:testingCurves is configured in a *.nim.cfg for convenience
|
|
test "", "tests/test_primitives.nim"
|
|
|
|
test "", "tests/test_io_bigints.nim"
|
|
test "", "tests/test_bigints.nim"
|
|
test "", "tests/test_bigints_multimod.nim"
|
|
|
|
test "", "tests/test_io_fields"
|
|
test "", "tests/test_finite_fields.nim"
|
|
test "", "tests/test_finite_fields_powinv.nim"
|
|
|
|
if sizeof(int) == 8: # 32-bit tests
|
|
test "-d:Constantine32", "tests/test_primitives.nim"
|
|
|
|
test "-d:Constantine32", "tests/test_io_bigints.nim"
|
|
test "-d:Constantine32", "tests/test_bigints.nim"
|
|
test "-d:Constantine32", "tests/test_bigints_multimod.nim"
|
|
|
|
test "-d:Constantine32", "tests/test_io_fields"
|
|
test "-d:Constantine32", "tests/test_finite_fields.nim"
|
|
test "-d:Constantine32", "tests/test_finite_fields_powinv.nim"
|