Commit Graph

  • 472823b749
    more comprehensive benchmark of Fp Mamy André-Ratsimbazafy 2020-03-06 17:44:30 +01:00
  • adc630f3af
    Fix overflow on win32 Mamy André-Ratsimbazafy 2020-03-01 17:05:14 +01:00
  • 4b7c6b552e
    Fix inline assembly and inline __int128 in C++ mode Mamy André-Ratsimbazafy 2020-03-01 16:23:41 +01:00
  • c8e482f6d2
    Properly handle 32 bits Mamy André-Ratsimbazafy 2020-03-01 16:18:45 +01:00
  • 3fdd457b52
    Add MSVC compiler support for 128-bit div/mul (untested) Mamy André-Ratsimbazafy 2020-03-01 16:02:14 +01:00
  • dfb007e6bc
    Add ARM64 fallback for Div128by64 Mamy André-Ratsimbazafy 2020-03-01 15:10:23 +01:00
  • 3ce237234d
    Support 32-bit platforms Mamy André-Ratsimbazafy 2020-03-01 14:38:18 +01:00
  • 1fdb1df80a
    Add benchmark clock timers Mamy André-Ratsimbazafy 2020-02-29 19:36:35 +01:00
  • ca817fcb69
    Use Assembly cmov on x86 Mamy André-Ratsimbazafy 2020-02-29 18:27:20 +01:00
  • 309a15ce8b
    inline func are OK for extended precision Mamy André-Ratsimbazafy 2020-02-29 17:25:40 +01:00
  • 0fab0c8a42
    Improve initialization for montymul. (64-bit speed is 2.3x 32-bit) Mamy André-Ratsimbazafy 2020-02-29 14:59:20 +01:00
  • feacf2b2ea
    Fix 64-bit limbs, passing all tests Mamy André-Ratsimbazafy 2020-02-29 14:49:38 +01:00
  • 88d4a58a10
    First steps in using uint64 words Mamy André-Ratsimbazafy 2020-02-29 02:10:55 +01:00
  • 05bce529b4
    1st experiment at accelerating montgomery multiplication (665 lines of specialized duplicated ASM code for some reason, monomorphization is probably better than that) Mamy André-Ratsimbazafy 2020-02-28 22:46:20 +01:00
  • 155aa21767
    Add inverse on 𝔽p2 = 𝔽p[𝑖] Mamy André-Ratsimbazafy 2020-02-27 01:20:51 +01:00
  • feb6557402
    Add placeholders for alternative Fp2 implementations Mamy André-Ratsimbazafy 2020-02-26 20:04:06 +01:00
  • 1f0ef23da7
    Add Fp2_complex tests Mamy André-Ratsimbazafy 2020-02-26 19:28:43 +01:00
  • df886aa3ca
    Significantly reduce compile-time and size of field tests vs GMP (4.4MB of C previously vs 160kB after commit). Mamy André-Ratsimbazafy 2020-02-26 18:54:44 +01:00
  • eecf19ff1d
    more research on extension fields Mamy André-Ratsimbazafy 2020-02-26 17:37:32 +01:00
  • 6de97b5d1e
    Random init was producing invalid montgomery form for field elements Mamy André-Ratsimbazafy 2020-02-26 10:28:54 +01:00
  • 945d36c2f2
    More Fp2 sanity checks Mamy André-Ratsimbazafy 2020-02-26 01:46:11 +01:00
  • ff98558c4b
    Fix carry bug in sum/diff Mamy André-Ratsimbazafy 2020-02-26 01:31:05 +01:00
  • c621355d8d
    Add new tests to track issue in the new sum/diff Mamy André-Ratsimbazafy 2020-02-26 01:23:18 +01:00
  • 5fab0b6c49
    Add secp256k1 and add sanity checks on Fp2 Mamy André-Ratsimbazafy 2020-02-26 00:55:30 +01:00
  • e2096297cf
    Expose the equality proc beyond the debugConstantine flag Mamy André-Ratsimbazafy 2020-02-26 00:08:57 +01:00
  • 9f7c8515a4
    Prepare RNG with 2^512 bit of state for random testing on Fp2 Mamy André-Ratsimbazafy 2020-02-25 23:52:56 +01:00
  • c956c82165
    cleanup test imports Mamy André-Ratsimbazafy 2020-02-25 20:55:23 +01:00
  • 2df0f311ff
    Cleanup TODOs + squaring in the Montgomery domain doesn't present the same symmetries as schoolbook multiplication so remove comment. Otherwise this may apply https://www.intel.com/content/dam/www/public/us/en/documents/white-papers/large-integer-squaring-ia-paper.pdf Mamy André-Ratsimbazafy 2020-02-25 20:12:38 +01:00
  • 69d477a715
    Fp2 multiplication Mamy André-Ratsimbazafy 2020-02-25 16:35:55 +01:00
  • 320ecbff1a
    Change square signature and reorg finite fields to avoid/highlight proc that allocate a temporary Mamy André-Ratsimbazafy 2020-02-25 15:18:39 +01:00
  • abaafa816e
    Fix warnings Mamy André-Ratsimbazafy 2020-02-25 14:32:54 +01:00
  • e6c7b3e52a
    add Abelian Group concept Mamy André-Ratsimbazafy 2020-02-25 14:10:59 +01:00
  • 2aa33ea226
    Fused initialization and arithmetic finite field primitive to have Fp2 less verbose and more efficient Mamy André-Ratsimbazafy 2020-02-25 11:00:27 +01:00
  • 2aec16d8d8
    introduce unconditional add/sub and fused initialization+operation sum/diff Mamy André-Ratsimbazafy 2020-02-25 03:11:32 +01:00
  • ddce056bb4
    make bench compile Mamy André-Ratsimbazafy 2020-02-25 03:07:42 +01:00
  • bb8dc579ea
    conditional arithmetic prefixed with c: cadd, csub. Also use ccopy instead of cmov to avoid potential confusion like in https://github.com/cfrg/draft-irtf-cfrg-hash-to-curve/issues/210 Mamy André-Ratsimbazafy 2020-02-25 01:26:21 +01:00
  • 5b53ad9cf3
    Add references for finite fields and tower of finite fields arithmetic Mamy André-Ratsimbazafy 2020-02-25 01:16:10 +01:00
  • 78dee73648
    Fp: setZero, setOne, double, in-place mul, Fp2: square Mamy André-Ratsimbazafy 2020-02-24 20:39:36 +01:00
  • 6b05c69652
    Rename Fq -> Fp Mamy André-Ratsimbazafy 2020-02-24 17:10:09 +01:00
  • 3bd70991d4
    reorg the codebase + add/update READMEs in folders with research (#12) Mamy Ratsimbazafy 2020-02-24 10:50:19 +01:00
  • d83101153a
    Cosmetic changes: remove debug import strutils, BigInt.dec "returns" is now a doc comment, remove redundant setting the internal bitlength for modular multiplication Mamy André-Ratsimbazafy 2020-02-23 21:49:51 +01:00
  • 80f822c227
    Set up CI with Azure Pipelines (#13) Mamy Ratsimbazafy 2020-02-23 18:27:26 +01:00
  • acbb0f57f7
    Travis CI (#14) Mamy Ratsimbazafy 2020-02-23 17:56:43 +01:00
  • 5f91751328
    remove leftover debugEcho Mamy André-Ratsimbazafy 2020-02-23 17:12:41 +01:00
  • 05009f9407
    Fix mux comment and link Mamy André-Ratsimbazafy 2020-02-23 02:23:19 +01:00
  • dc46e86490
    Create a specialized montgomery modular square function Mamy André-Ratsimbazafy 2020-02-23 01:43:42 +01:00
  • c807707ee4
    Add research on pairing curve implementations Mamy André-Ratsimbazafy 2020-02-23 01:17:39 +01:00
  • 68727e5c8d
    Add modular inversion + test vs GMP Mamy André-Ratsimbazafy 2020-02-22 19:50:24 +01:00
  • 8cbbd40a0c
    Add benchmark of constant-time vs unsafe powmod Mamy André-Ratsimbazafy 2020-02-22 18:39:29 +01:00
  • acfc99c4f0
    Add an unsafe modular exponentiation that may leak exponent bits to timing attacks/oscilloscopes/memory cache attacks Mamy André-Ratsimbazafy 2020-02-22 18:18:17 +01:00
  • e0f4e49cb5
    Test modular exponentiation with BN254 and BLS12-381 moduli Mamy André-Ratsimbazafy 2020-02-22 16:56:04 +01:00
  • 24f2e1088e
    Fix modular exp tests Mamy André-Ratsimbazafy 2020-02-22 16:39:57 +01:00
  • 4b65d0d723
    Skeleton of modular exponentiation Mamy André-Ratsimbazafy 2020-02-22 16:37:31 +01:00
  • 236047767f
    move mask to common Mamy André-Ratsimbazafy 2020-02-18 13:01:14 +01:00
  • ef5dd8345b
    Allow compile-time bigint serialization + terminology: serialize -> export Mamy André-Ratsimbazafy 2020-02-18 12:36:42 +01:00
  • 9395febada
    add octet string encode/decode (bigEndian raw int) Mamy André-Ratsimbazafy 2020-02-18 11:54:36 +01:00
  • d7d20c50b6
    Add primitive for window-based modular exponentiation Mamy André-Ratsimbazafy 2020-02-17 00:13:42 +01:00
  • 285b6aad1a
    Add cmov according to Milagro / hash_to_curve spec Mamy André-Ratsimbazafy 2020-02-16 22:18:22 +01:00
  • 6694023f16
    Revert "Use cmov name instead of mux to be in line with IETF spec on Hash to curve and Verifiable Random Functions" Mamy André-Ratsimbazafy 2020-02-16 22:13:54 +01:00
  • 56177c0cfe
    Use cmov name instead of mux to be in line with IETF spec on Hash to curve and Verifiable Random Functions Mamy André-Ratsimbazafy 2020-02-16 21:34:21 +01:00
  • a1801e26a0
    Now passing finite field test vs GMP Mamy André-Ratsimbazafy 2020-02-16 19:08:19 +01:00
  • c3d458e31b
    Fix bug in redc: use montgomery mul for now. Add NIST P256 curve Mamy André-Ratsimbazafy 2020-02-16 18:59:10 +01:00
  • 7740bfbae4
    print montgomery magics at compile-time Mamy André-Ratsimbazafy 2020-02-16 12:32:34 +01:00
  • f1430915fe
    Add Mersenn 61 and 127 + debugging print Mamy André-Ratsimbazafy 2020-02-16 12:03:01 +01:00
  • 5620bbfaee
    rename io tests ti io bigints Mamy André-Ratsimbazafy 2020-02-16 11:29:27 +01:00
  • 23ecb9a221
    Add a (failing) test vs GMP for modular multiplication on BN254 curve Field Mamy André-Ratsimbazafy 2020-02-16 02:20:08 +01:00
  • 10346d83a4
    Benchmark: BigInt -> Montgomery conversion: - shlAddMod (with assembly division) is already 4x slower than Montgomery Multiplication based. - constant-time division will be even slower - use montgomery-multiplication based conversion Mamy André-Ratsimbazafy 2020-02-16 01:43:17 +01:00
  • bd1430157f
    Add BLS12-381 curve: - don't create "Mod" in curve parser: compile-time type incompatibility - don't use "Mod" in const sections: compile-time type incompat --> create a macro to get montgomery magics instead of a const array Mamy André-Ratsimbazafy 2020-02-16 00:44:01 +01:00
  • 05a2c6a34b
    Properly precompute the montomery cosntants at compile-time and store them in ROM Mamy André-Ratsimbazafy 2020-02-15 20:43:38 +01:00
  • 4970572393
    Introduce alternate conversion to Montgomery Residue based on Montgomery Multiplication Mamy André-Ratsimbazafy 2020-02-15 19:22:40 +01:00
  • e2333dce3c
    Terminology nres -> mres, montgomeryResidue, montyResidue Mamy André-Ratsimbazafy 2020-02-15 16:11:17 +01:00
  • d3ad4acb3a
    Do less in curve generator macro: - no more monty magic "negInvModWord" - no public "matchingBigInt" Mamy André-Ratsimbazafy 2020-02-15 13:56:13 +01:00
  • 398b871c4f
    Reorg the repo to introduce prepare for introducing the R² (mod p) magic constant Mamy André-Ratsimbazafy 2020-02-15 13:13:01 +01:00
  • eb94c3d1bc
    Add Montgomery Modular Multiplication Mamy André-Ratsimbazafy 2020-02-15 02:59:08 +01:00
  • 301cf20195
    Use Montgomery representation by default for Finite Field - Fix montyMagic, modular inversion mode 2^2k was missing an iteration - Fix test for buffer size in BigInt serialization - Add UINT/Hex serialization for finite fields - Montgomery conversion and redc Mamy André-Ratsimbazafy 2020-02-15 00:26:40 +01:00
  • f418e08746
    For finite fields, we will use the Montgomery n-residue form by default Mamy André-Ratsimbazafy 2020-02-14 13:36:34 +01:00
  • f6b229b19c
    Modular addition and substraction tests Mamy André-Ratsimbazafy 2020-02-13 00:11:45 +01:00
  • 4cac44358f
    Update security level of BN254 to ~100bits Mamy André-Ratsimbazafy 2020-02-13 00:11:04 +01:00
  • 3eb22f8fc7
    Fix curve parser, implement smoke test for finite field Mamy André-Ratsimbazafy 2020-02-12 23:57:51 +01:00
  • 6226d86726
    Update IO: dumpHex -> toHex dumpRawUint -> serializeRawUint Mamy André-Ratsimbazafy 2020-02-12 21:57:39 +01:00
  • 343399ba1c
    Remove TODO comment about bound checking, UncheckedArray in the raw API are not bound checked Mamy André-Ratsimbazafy 2020-02-12 00:33:12 +01:00
  • 89fce3b1c4
    Wrap tests in main. Fixes C codegen bug due to templates invocation on global variable in test_primitives Mamy André-Ratsimbazafy 2020-02-12 00:25:48 +01:00
  • fe59efb8d8
    reorganize the repo Mamy André-Ratsimbazafy 2020-02-12 00:20:31 +01:00
  • 28c9c472b3
    Fix generated code duplication due to templates Mamy André-Ratsimbazafy 2020-02-11 14:28:21 +01:00
  • 2a438653a8
    Don't emit useless inline C functions Mamy André-Ratsimbazafy 2020-02-11 12:42:24 +01:00
  • 24b0477ad7
    Typo when testing for "negative" bigint, now passing testing vs GMP Mamy André-Ratsimbazafy 2020-02-10 23:56:57 +01:00
  • b53f203e30
    Fix raw uint serialization and start testing against GMP for 2000+bits bigints Mamy André-Ratsimbazafy 2020-02-10 23:09:32 +01:00
  • 8d160189d1
    Fix extended prec multiplication carry. Passing modulo tests against medium BigInt (192~256 bits) Mamy André-Ratsimbazafy 2020-02-10 22:19:47 +01:00
  • 73b71a184c
    Fix off-by-one copy, pass small bigints modulo tests Mamy André-Ratsimbazafy 2020-02-10 19:57:35 +01:00
  • b689223cf5
    Refactoring, optimize code-size: use type-erased views to avoid monomorphization of compute kernels Mamy André-Ratsimbazafy 2020-02-10 18:16:34 +01:00
  • ade919b003
    Fix carry and modulus offset in bigint Mamy André-Ratsimbazafy 2020-02-10 02:58:37 +01:00
  • 3033ae30f8
    Fix uint32 extended precision multiplication Mamy André-Ratsimbazafy 2020-02-10 02:12:44 +01:00
  • 30f8756dfc
    Temp switch to uint32 words for testing modulo. Remove tests that depend on word size Mamy André-Ratsimbazafy 2020-02-10 00:16:46 +01:00
  • 166a1075b1
    add bigint display in GMP test Mamy André-Ratsimbazafy 2020-02-09 23:26:39 +01:00
  • 08ed81af34
    Don't forget to exit when dumpingraw integer Mamy André-Ratsimbazafy 2020-02-09 23:05:23 +01:00
  • a389e5c38c
    in-place add/sub fix + Add note that native x86 division is flawed: SIGFPE on quotient that don't fit in a word size Mamy André-Ratsimbazafy 2020-02-09 23:00:21 +01:00
  • 216ed9bdc1
    Property-based testing framework vs GMP Mamy André-Ratsimbazafy 2020-02-09 22:01:01 +01:00
  • f2c79ece26
    Remove the limitation that the number of bits in constructed has to be greater than the source integer bitsize Mamy André-Ratsimbazafy 2020-02-09 21:35:23 +01:00
  • 66c0b5805e
    Add modular reduce / bigint mod from 2 arbitrarily size bigint Mamy André-Ratsimbazafy 2020-02-09 18:17:32 +01:00
  • 514715dff0
    Allow muxing / cmov on bools Mamy André-Ratsimbazafy 2020-02-09 17:49:38 +01:00