mirror of
https://github.com/logos-storage/constantine.git
synced 2026-01-08 08:03:09 +00:00
Don't dump all in "backend" (#184)
* backend -> math * towers -> extension fields * move ISA and compiler specific code out of math/ * fix export
This commit is contained in:
parent
5bc6d1d426
commit
ffacf61e8a
@ -66,7 +66,7 @@ After [installation](#installation), the available high-level protocols are:
|
|||||||
_The backend, unlike protocols, is not public. Here be dragons._
|
_The backend, unlike protocols, is not public. Here be dragons._
|
||||||
|
|
||||||
At the moment the following curves are implemented, adding a new curve only requires adding the prime modulus
|
At the moment the following curves are implemented, adding a new curve only requires adding the prime modulus
|
||||||
and its bitsize in [constantine/config/curves.nim](constantine/backend/config/curves_declaration.nim).
|
and its bitsize in [constantine/config/curves.nim](constantine/math/config/curves_declaration.nim).
|
||||||
|
|
||||||
The following curves are configured:
|
The following curves are configured:
|
||||||
|
|
||||||
@ -81,7 +81,7 @@ The following curves are configured:
|
|||||||
- Jubjub, a curve embedded in BLS12-381 scalar field to be used in zk-SNARKS circuits.
|
- Jubjub, a curve embedded in BLS12-381 scalar field to be used in zk-SNARKS circuits.
|
||||||
- Bandersnatch, a more efficient curve embedded in BLS12-381 scalar field to be used in zk-SNARKS circuits.
|
- Bandersnatch, a more efficient curve embedded in BLS12-381 scalar field to be used in zk-SNARKS circuits.
|
||||||
- Other curves
|
- Other curves
|
||||||
- Curve25519, used in ed25519 and X25519 from TLS 1.3 protocol and the Signal protocol.
|
- Edwards25519, used in ed25519 and X25519 from TLS 1.3 protocol and the Signal protocol.
|
||||||
With Ristretto, it can be used in bulletproofs.
|
With Ristretto, it can be used in bulletproofs.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internal
|
# Internal
|
||||||
../constantine/backend/config/common,
|
../constantine/platforms/abstractions,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/prng_unsafe,
|
../helpers/prng_unsafe,
|
||||||
./platforms,
|
./platforms,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/elliptic/[
|
../constantine/math/elliptic/[
|
||||||
ec_shortweierstrass_projective,
|
ec_shortweierstrass_projective,
|
||||||
ec_shortweierstrass_jacobian],
|
ec_shortweierstrass_jacobian],
|
||||||
# Helpers
|
# Helpers
|
||||||
@ -34,7 +34,7 @@ const AvailableCurves = [
|
|||||||
# P224,
|
# P224,
|
||||||
BN254_Nogami,
|
BN254_Nogami,
|
||||||
BN254_Snarks,
|
BN254_Snarks,
|
||||||
# Curve25519,
|
# Edwards25519,
|
||||||
# P256,
|
# P256,
|
||||||
# Secp256k1,
|
# Secp256k1,
|
||||||
BLS12_377,
|
BLS12_377,
|
||||||
|
|||||||
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
../constantine/backend/elliptic/[
|
../constantine/math/elliptic/[
|
||||||
ec_shortweierstrass_projective,
|
ec_shortweierstrass_projective,
|
||||||
ec_shortweierstrass_jacobian],
|
ec_shortweierstrass_jacobian],
|
||||||
# Helpers
|
# Helpers
|
||||||
@ -35,7 +35,7 @@ const AvailableCurves = [
|
|||||||
# P224,
|
# P224,
|
||||||
BN254_Nogami,
|
BN254_Nogami,
|
||||||
BN254_Snarks,
|
BN254_Snarks,
|
||||||
# Curve25519,
|
# Edwards25519,
|
||||||
# P256,
|
# P256,
|
||||||
# Secp256k1,
|
# Secp256k1,
|
||||||
BLS12_377,
|
BLS12_377,
|
||||||
|
|||||||
@ -14,10 +14,11 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[curves, common],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/io/io_bigints,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/elliptic/[
|
../constantine/math/io/io_bigints,
|
||||||
|
../constantine/math/elliptic/[
|
||||||
ec_shortweierstrass_affine,
|
ec_shortweierstrass_affine,
|
||||||
ec_shortweierstrass_projective,
|
ec_shortweierstrass_projective,
|
||||||
ec_shortweierstrass_jacobian,
|
ec_shortweierstrass_jacobian,
|
||||||
@ -27,7 +28,7 @@ import
|
|||||||
./platforms,
|
./platforms,
|
||||||
./bench_blueprint,
|
./bench_blueprint,
|
||||||
# Reference unsafe scalar multiplication
|
# Reference unsafe scalar multiplication
|
||||||
../tests/backend/support/ec_reference_scalar_mult
|
../tests/math/support/ec_reference_scalar_mult
|
||||||
|
|
||||||
export notes
|
export notes
|
||||||
proc separator*() = separator(177)
|
proc separator*() = separator(177)
|
||||||
|
|||||||
@ -14,10 +14,11 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[common, curves],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/curves/zoo_square_roots,
|
../constantine/math/extension_fields,
|
||||||
|
../constantine/math/curves/zoo_square_roots,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/prng_unsafe,
|
../helpers/prng_unsafe,
|
||||||
./bench_blueprint
|
./bench_blueprint
|
||||||
|
|||||||
@ -8,10 +8,10 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[curves, common],
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/io/io_bigints,
|
../constantine/math/io/io_bigints,
|
||||||
../constantine/backend/curves/zoo_square_roots,
|
../constantine/math/curves/zoo_square_roots,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_fields_template
|
./bench_fields_template
|
||||||
@ -29,7 +29,7 @@ const AvailableCurves = [
|
|||||||
# P224,
|
# P224,
|
||||||
BN254_Nogami,
|
BN254_Nogami,
|
||||||
BN254_Snarks,
|
BN254_Snarks,
|
||||||
Curve25519,
|
Edwards25519,
|
||||||
Bandersnatch,
|
Bandersnatch,
|
||||||
P256,
|
P256,
|
||||||
Secp256k1,
|
Secp256k1,
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_fields_template,
|
./bench_fields_template,
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_fields_template,
|
./bench_fields_template,
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_fields_template,
|
./bench_fields_template,
|
||||||
|
|||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_fields_template,
|
./bench_fields_template,
|
||||||
|
|||||||
@ -14,9 +14,10 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[curves, common],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/arithmetic,
|
||||||
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/[prng_unsafe, static_for],
|
../helpers/[prng_unsafe, static_for],
|
||||||
./platforms,
|
./platforms,
|
||||||
|
|||||||
@ -8,13 +8,15 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[common, curves, type_bigint, type_ff],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/[towers, hashes],
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/io/[io_bigints, io_ec],
|
../constantine/math/extension_fields,
|
||||||
../constantine/backend/elliptic/[
|
../constantine/math/io/[io_bigints, io_ec],
|
||||||
|
../constantine/math/elliptic/[
|
||||||
ec_shortweierstrass_affine,
|
ec_shortweierstrass_affine,
|
||||||
ec_shortweierstrass_projective],
|
ec_shortweierstrass_projective],
|
||||||
../constantine/backend/hash_to_curve/hash_to_curve,
|
../constantine/hash_to_curve/hash_to_curve,
|
||||||
|
../constantine/hashes,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/prng_unsafe,
|
../helpers/prng_unsafe,
|
||||||
./bench_blueprint
|
./bench_blueprint
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_pairing_template,
|
./bench_pairing_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_pairing_template,
|
./bench_pairing_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_pairing_template,
|
./bench_pairing_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_pairing_template,
|
./bench_pairing_template,
|
||||||
|
|||||||
@ -14,18 +14,19 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[curves, common],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/towers,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/ec_shortweierstrass,
|
../constantine/math/extension_fields,
|
||||||
../constantine/backend/curves/zoo_subgroups,
|
../constantine/math/ec_shortweierstrass,
|
||||||
../constantine/backend/pairing/[
|
../constantine/math/curves/zoo_subgroups,
|
||||||
|
../constantine/math/pairing/[
|
||||||
cyclotomic_subgroup,
|
cyclotomic_subgroup,
|
||||||
lines_eval,
|
lines_eval,
|
||||||
pairing_bls12,
|
pairing_bls12,
|
||||||
pairing_bn
|
pairing_bn
|
||||||
],
|
],
|
||||||
../constantine/backend/curves/zoo_pairings,
|
../constantine/math/curves/zoo_pairings,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/prng_unsafe,
|
../helpers/prng_unsafe,
|
||||||
./bench_blueprint
|
./bench_blueprint
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/hashes,
|
../constantine/hashes,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/prng_unsafe,
|
../helpers/prng_unsafe,
|
||||||
./bench_blueprint
|
./bench_blueprint
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_summary_template,
|
./bench_summary_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_summary_template,
|
./bench_summary_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_summary_template,
|
./bench_summary_template,
|
||||||
|
|||||||
@ -8,9 +8,9 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/curves,
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/arithmetic,
|
../constantine/math/arithmetic,
|
||||||
../constantine/backend/towers,
|
../constantine/math/extension_fields,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/static_for,
|
../helpers/static_for,
|
||||||
./bench_summary_template,
|
./bench_summary_template,
|
||||||
|
|||||||
@ -14,21 +14,23 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../constantine/backend/config/[curves, common],
|
../constantine/platforms/abstractions,
|
||||||
../constantine/backend/[arithmetic, hashes, towers],
|
../constantine/math/config/curves,
|
||||||
../constantine/backend/elliptic/[
|
../constantine/math/[arithmetic, extension_fields],
|
||||||
|
../constantine/math/elliptic/[
|
||||||
ec_shortweierstrass_affine,
|
ec_shortweierstrass_affine,
|
||||||
ec_shortweierstrass_projective,
|
ec_shortweierstrass_projective,
|
||||||
ec_shortweierstrass_jacobian,
|
ec_shortweierstrass_jacobian,
|
||||||
ec_scalar_mul, ec_endomorphism_accel],
|
ec_scalar_mul, ec_endomorphism_accel],
|
||||||
../constantine/backend/curves/zoo_subgroups,
|
../constantine/math/curves/zoo_subgroups,
|
||||||
../constantine/backend/hash_to_curve/hash_to_curve,
|
../constantine/math/pairing/[
|
||||||
../constantine/backend/pairing/[
|
|
||||||
cyclotomic_subgroup,
|
cyclotomic_subgroup,
|
||||||
pairing_bls12,
|
pairing_bls12,
|
||||||
pairing_bn
|
pairing_bn
|
||||||
],
|
],
|
||||||
../constantine/backend/curves/zoo_pairings,
|
../constantine/math/curves/zoo_pairings,
|
||||||
|
../constantine/hashes,
|
||||||
|
../constantine/hash_to_curve/hash_to_curve,
|
||||||
# Helpers
|
# Helpers
|
||||||
../helpers/[prng_unsafe, static_for],
|
../helpers/[prng_unsafe, static_for],
|
||||||
./bench_blueprint
|
./bench_blueprint
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
packageName = "constantine"
|
packageName = "constantine"
|
||||||
version = "0.0.1"
|
version = "0.0.1"
|
||||||
author = "Status Research & Development GmbH"
|
author = "Status Research & Development GmbH"
|
||||||
description = "This library provides constant time big int primitives."
|
description = "This library provides thoroughly tested and highly-optimized implementations of cryptography protocols."
|
||||||
license = "MIT or Apache License 2.0"
|
license = "MIT or Apache License 2.0"
|
||||||
|
|
||||||
# Dependencies
|
# Dependencies
|
||||||
@ -23,166 +23,166 @@ const buildParallel = "test_parallel.txt"
|
|||||||
const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
||||||
# Primitives
|
# Primitives
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_primitives.nim", false),
|
("tests/math/t_primitives.nim", false),
|
||||||
("tests/backend/t_primitives_extended_precision.nim", false),
|
("tests/math/t_primitives_extended_precision.nim", false),
|
||||||
# Big ints
|
# Big ints
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_io_bigints.nim", false),
|
("tests/math/t_io_bigints.nim", false),
|
||||||
("tests/backend/t_io_unsaturated.nim", false),
|
("tests/math/t_io_unsaturated.nim", false),
|
||||||
("tests/backend/t_bigints.nim", false),
|
("tests/math/t_bigints.nim", false),
|
||||||
("tests/backend/t_bigints_multimod.nim", false),
|
("tests/math/t_bigints_multimod.nim", false),
|
||||||
("tests/backend/t_bigints_mod_vs_gmp.nim", true),
|
("tests/math/t_bigints_mod_vs_gmp.nim", true),
|
||||||
("tests/backend/t_bigints_mul_vs_gmp.nim", true),
|
("tests/math/t_bigints_mul_vs_gmp.nim", true),
|
||||||
("tests/backend/t_bigints_mul_high_words_vs_gmp.nim", true),
|
("tests/math/t_bigints_mul_high_words_vs_gmp.nim", true),
|
||||||
# Field
|
# Field
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_io_fields", false),
|
("tests/math/t_io_fields", false),
|
||||||
("tests/backend/t_finite_fields.nim", false),
|
("tests/math/t_finite_fields.nim", false),
|
||||||
("tests/backend/t_finite_fields_conditional_arithmetic.nim", false),
|
("tests/math/t_finite_fields_conditional_arithmetic.nim", false),
|
||||||
("tests/backend/t_finite_fields_mulsquare.nim", false),
|
("tests/math/t_finite_fields_mulsquare.nim", false),
|
||||||
("tests/backend/t_finite_fields_sqrt.nim", false),
|
("tests/math/t_finite_fields_sqrt.nim", false),
|
||||||
("tests/backend/t_finite_fields_powinv.nim", false),
|
("tests/math/t_finite_fields_powinv.nim", false),
|
||||||
("tests/backend/t_finite_fields_vs_gmp.nim", true),
|
("tests/math/t_finite_fields_vs_gmp.nim", true),
|
||||||
("tests/backend/t_fp_cubic_root.nim", false),
|
("tests/math/t_fp_cubic_root.nim", false),
|
||||||
# Double-precision finite fields
|
# Double-precision finite fields
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_finite_fields_double_precision.nim", false),
|
("tests/math/t_finite_fields_double_precision.nim", false),
|
||||||
# Towers of extension fields
|
# Towers of extension fields
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_fp2.nim", false),
|
("tests/math/t_fp2.nim", false),
|
||||||
("tests/backend/t_fp2_sqrt.nim", false),
|
("tests/math/t_fp2_sqrt.nim", false),
|
||||||
("tests/backend/t_fp4.nim", false),
|
("tests/math/t_fp4.nim", false),
|
||||||
("tests/backend/t_fp6_bn254_snarks.nim", false),
|
("tests/math/t_fp6_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_fp6_bls12_377.nim", false),
|
("tests/math/t_fp6_bls12_377.nim", false),
|
||||||
("tests/backend/t_fp6_bls12_381.nim", false),
|
("tests/math/t_fp6_bls12_381.nim", false),
|
||||||
("tests/backend/t_fp6_bw6_761.nim", false),
|
("tests/math/t_fp6_bw6_761.nim", false),
|
||||||
("tests/backend/t_fp12_bn254_snarks.nim", false),
|
("tests/math/t_fp12_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_fp12_bls12_377.nim", false),
|
("tests/math/t_fp12_bls12_377.nim", false),
|
||||||
("tests/backend/t_fp12_bls12_381.nim", false),
|
("tests/math/t_fp12_bls12_381.nim", false),
|
||||||
("tests/backend/t_fp12_exponentiation.nim", false),
|
("tests/math/t_fp12_exponentiation.nim", false),
|
||||||
("tests/backend/t_fp12_anti_regression.nim", false),
|
("tests/math/t_fp12_anti_regression.nim", false),
|
||||||
|
|
||||||
("tests/backend/t_fp4_frobenius.nim", false),
|
("tests/math/t_fp4_frobenius.nim", false),
|
||||||
("tests/backend/t_fp6_frobenius.nim", false),
|
("tests/math/t_fp6_frobenius.nim", false),
|
||||||
("tests/backend/t_fp12_frobenius.nim", false),
|
("tests/math/t_fp12_frobenius.nim", false),
|
||||||
|
|
||||||
# Elliptic curve arithmetic
|
# Elliptic curve arithmetic
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_ec_conversion.nim", false),
|
("tests/math/t_ec_conversion.nim", false),
|
||||||
|
|
||||||
# Elliptic curve arithmetic G1
|
# Elliptic curve arithmetic G1
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# ("tests/backend/t_ec_shortw_prj_g1_add_double.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g1_add_double.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g1_mul_sanity.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g1_mul_sanity.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g1_mul_distri.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g1_mul_distri.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g1_mul_vs_ref.nim", false),
|
("tests/math/t_ec_shortw_prj_g1_mul_vs_ref.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g1_mixed_add.nim", false),
|
("tests/math/t_ec_shortw_prj_g1_mixed_add.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_jac_g1_add_double.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g1_add_double.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g1_mul_sanity.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g1_mul_sanity.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g1_mul_distri.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g1_mul_distri.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g1_mul_vs_ref.nim", false),
|
("tests/math/t_ec_shortw_jac_g1_mul_vs_ref.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g1_mixed_add.nim", false),
|
("tests/math/t_ec_shortw_jac_g1_mixed_add.nim", false),
|
||||||
|
|
||||||
("tests/backend/t_ec_twedwards_prj_add_double", false),
|
("tests/math/t_ec_twedwards_prj_add_double", false),
|
||||||
("tests/backend/t_ec_twedwards_prj_mul_sanity", false),
|
("tests/math/t_ec_twedwards_prj_mul_sanity", false),
|
||||||
("tests/backend/t_ec_twedwards_prj_mul_distri", false),
|
("tests/math/t_ec_twedwards_prj_mul_distri", false),
|
||||||
|
|
||||||
|
|
||||||
# Elliptic curve arithmetic G2
|
# Elliptic curve arithmetic G2
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false),
|
||||||
("tests/backend/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false),
|
("tests/math/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim", false),
|
||||||
|
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false),
|
||||||
# ("tests/backend/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false),
|
# ("tests/math/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false),
|
||||||
("tests/backend/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim", false),
|
("tests/math/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim", false),
|
||||||
|
|
||||||
# Elliptic curve arithmetic vs Sagemath
|
# Elliptic curve arithmetic vs Sagemath
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_ec_frobenius.nim", false),
|
("tests/math/t_ec_frobenius.nim", false),
|
||||||
("tests/backend/t_ec_sage_bn254_nogami.nim", false),
|
("tests/math/t_ec_sage_bn254_nogami.nim", false),
|
||||||
("tests/backend/t_ec_sage_bn254_snarks.nim", false),
|
("tests/math/t_ec_sage_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_sage_bls12_377.nim", false),
|
("tests/math/t_ec_sage_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_sage_bls12_381.nim", false),
|
("tests/math/t_ec_sage_bls12_381.nim", false),
|
||||||
# Edge cases highlighted by past bugs
|
# Edge cases highlighted by past bugs
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_ec_shortw_prj_edge_cases.nim", false),
|
("tests/math/t_ec_shortw_prj_edge_cases.nim", false),
|
||||||
|
|
||||||
# Subgroups and cofactors
|
# Subgroups and cofactors
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_ec_subgroups_bn254_nogami.nim", false),
|
("tests/math/t_ec_subgroups_bn254_nogami.nim", false),
|
||||||
("tests/backend/t_ec_subgroups_bn254_snarks.nim", false),
|
("tests/math/t_ec_subgroups_bn254_snarks.nim", false),
|
||||||
("tests/backend/t_ec_subgroups_bls12_377.nim", false),
|
("tests/math/t_ec_subgroups_bls12_377.nim", false),
|
||||||
("tests/backend/t_ec_subgroups_bls12_381.nim", false),
|
("tests/math/t_ec_subgroups_bls12_381.nim", false),
|
||||||
|
|
||||||
("tests/backend/t_pairing_bn254_nogami_gt_subgroup.nim", false),
|
("tests/math/t_pairing_bn254_nogami_gt_subgroup.nim", false),
|
||||||
("tests/backend/t_pairing_bn254_snarks_gt_subgroup.nim", false),
|
("tests/math/t_pairing_bn254_snarks_gt_subgroup.nim", false),
|
||||||
("tests/backend/t_pairing_bls12_377_gt_subgroup.nim", false),
|
("tests/math/t_pairing_bls12_377_gt_subgroup.nim", false),
|
||||||
("tests/backend/t_pairing_bls12_381_gt_subgroup.nim", false),
|
("tests/math/t_pairing_bls12_381_gt_subgroup.nim", false),
|
||||||
("tests/backend/t_pairing_bw6_761_gt_subgroup.nim", false),
|
("tests/math/t_pairing_bw6_761_gt_subgroup.nim", false),
|
||||||
|
|
||||||
# Pairing
|
# Pairing
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
# ("tests/backend/t_pairing_bls12_377_line_functions.nim", false),
|
# ("tests/math/t_pairing_bls12_377_line_functions.nim", false),
|
||||||
# ("tests/backend/t_pairing_bls12_381_line_functions.nim", false),
|
# ("tests/math/t_pairing_bls12_381_line_functions.nim", false),
|
||||||
("tests/backend/t_pairing_mul_fp12_by_lines.nim", false),
|
("tests/math/t_pairing_mul_fp12_by_lines.nim", false),
|
||||||
("tests/backend/t_pairing_cyclotomic_subgroup.nim", false),
|
("tests/math/t_pairing_cyclotomic_subgroup.nim", false),
|
||||||
("tests/backend/t_pairing_bn254_nogami_optate.nim", false),
|
("tests/math/t_pairing_bn254_nogami_optate.nim", false),
|
||||||
("tests/backend/t_pairing_bn254_snarks_optate.nim", false),
|
("tests/math/t_pairing_bn254_snarks_optate.nim", false),
|
||||||
("tests/backend/t_pairing_bls12_377_optate.nim", false),
|
("tests/math/t_pairing_bls12_377_optate.nim", false),
|
||||||
("tests/backend/t_pairing_bls12_381_optate.nim", false),
|
("tests/math/t_pairing_bls12_381_optate.nim", false),
|
||||||
("tests/backend/t_pairing_bls12_381_multi.nim", false),
|
("tests/math/t_pairing_bls12_381_multi.nim", false),
|
||||||
|
|
||||||
# Hashing to elliptic curves
|
# Hashing to elliptic curves
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_hash_to_field.nim", false),
|
("tests/math/t_hash_to_field.nim", false),
|
||||||
("tests/backend/t_hash_to_curve.nim", false),
|
("tests/math/t_hash_to_curve.nim", false),
|
||||||
|
|
||||||
# Prime order fields
|
# Prime order fields
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
("tests/backend/t_fr.nim", false),
|
("tests/math/t_fr.nim", false),
|
||||||
|
|
||||||
# Hashing vs OpenSSL
|
# Hashing vs OpenSSL
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
@ -196,20 +196,20 @@ const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
|||||||
|
|
||||||
# For temporary (hopefully) investigation that can only be reproduced in CI
|
# For temporary (hopefully) investigation that can only be reproduced in CI
|
||||||
const useDebug = [
|
const useDebug = [
|
||||||
"tests/backend/t_bigints.nim",
|
"tests/math/t_bigints.nim",
|
||||||
"tests/backend/t_hash_sha256_vs_openssl.nim",
|
"tests/math/t_hash_sha256_vs_openssl.nim",
|
||||||
]
|
]
|
||||||
|
|
||||||
# Tests that uses sequences require Nim GC, stack scanning and nil pointer passed to openarray
|
# Tests that uses sequences require Nim GC, stack scanning and nil pointer passed to openarray
|
||||||
# In particular the tests that uses the json test vectors, don't sanitize them.
|
# In particular the tests that uses the json test vectors, don't sanitize them.
|
||||||
# we do use gc:none to help
|
# we do use gc:none to help
|
||||||
const skipSanitizers = [
|
const skipSanitizers = [
|
||||||
"tests/backend/t_ec_sage_bn254_nogami.nim",
|
"tests/math/t_ec_sage_bn254_nogami.nim",
|
||||||
"tests/backend/t_ec_sage_bn254_snarks.nim",
|
"tests/math/t_ec_sage_bn254_snarks.nim",
|
||||||
"tests/backend/t_ec_sage_bls12_377.nim",
|
"tests/math/t_ec_sage_bls12_377.nim",
|
||||||
"tests/backend/t_ec_sage_bls12_381.nim",
|
"tests/math/t_ec_sage_bls12_381.nim",
|
||||||
"tests/backend/t_hash_to_field.nim",
|
"tests/math/t_hash_to_field.nim",
|
||||||
"tests/backend/t_hash_to_curve.nim"
|
"tests/math/t_hash_to_curve.nim"
|
||||||
]
|
]
|
||||||
|
|
||||||
when defined(windows):
|
when defined(windows):
|
||||||
|
|||||||
@ -1,36 +0,0 @@
|
|||||||
# Constantine
|
|
||||||
# Copyright (c) 2018-2019 Status Research & Development GmbH
|
|
||||||
# Copyright (c) 2020-Present Mamy André-Ratsimbazafy
|
|
||||||
# Licensed and distributed under either of
|
|
||||||
# * MIT license (license terms in the root directory or at http://opensource.org/licenses/MIT).
|
|
||||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
|
||||||
|
|
||||||
import std/macros
|
|
||||||
|
|
||||||
proc replaceNodes(ast: NimNode, what: NimNode, by: NimNode): NimNode =
|
|
||||||
# Replace "what" ident node by "by"
|
|
||||||
proc inspect(node: NimNode): NimNode =
|
|
||||||
case node.kind:
|
|
||||||
of {nnkIdent, nnkSym}:
|
|
||||||
if node.eqIdent(what):
|
|
||||||
return by
|
|
||||||
return node
|
|
||||||
of nnkEmpty:
|
|
||||||
return node
|
|
||||||
of nnkLiterals:
|
|
||||||
return node
|
|
||||||
else:
|
|
||||||
var rTree = node.kind.newTree()
|
|
||||||
for child in node:
|
|
||||||
rTree.add inspect(child)
|
|
||||||
return rTree
|
|
||||||
result = inspect(ast)
|
|
||||||
|
|
||||||
macro staticFor*(idx: untyped{nkIdent}, start, stopEx: static int, body: untyped): untyped =
|
|
||||||
result = newStmtList()
|
|
||||||
for i in start ..< stopEx:
|
|
||||||
result.add nnkBlockStmt.newTree(
|
|
||||||
ident("unrolledIter_" & $idx & $i),
|
|
||||||
body.replaceNodes(idx, newLit i)
|
|
||||||
)
|
|
||||||
@ -7,24 +7,21 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
./backend/config/[
|
./platforms/abstractions,
|
||||||
common, curves, type_bigint, type_ff
|
./math/config/curves,
|
||||||
],
|
./math/[
|
||||||
./backend/[
|
|
||||||
ec_shortweierstrass,
|
ec_shortweierstrass,
|
||||||
hash_to_curve/hash_to_curve,
|
extension_fields,
|
||||||
hashes,
|
|
||||||
towers,
|
|
||||||
arithmetic,
|
arithmetic,
|
||||||
signatures/bls_signatures,
|
curves/zoo_subgroups
|
||||||
curves/zoo_subgroups,
|
|
||||||
primitives
|
|
||||||
],
|
],
|
||||||
./backend/io/[io_bigints, io_fields]
|
./math/io/[io_bigints, io_fields],
|
||||||
|
hashes,
|
||||||
|
signatures/bls_signatures
|
||||||
|
|
||||||
export
|
export
|
||||||
curves, # generic sandwich on matchingBigInt
|
curves, # generic sandwich on matchingBigInt
|
||||||
towers, # generic sandwich on extension field access
|
extension_fields, # generic sandwich on extension field access
|
||||||
hashes, # generic sandwich on sha256
|
hashes, # generic sandwich on sha256
|
||||||
ec_shortweierstrass # generic sandwich on affine
|
ec_shortweierstrass # generic sandwich on affine
|
||||||
|
|
||||||
|
|||||||
@ -7,13 +7,14 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
./backend/config/[common, curves],
|
./platforms/abstractions,
|
||||||
./backend/[arithmetic, towers],
|
./math/config/curves,
|
||||||
./backend/arithmetic/limbs_montgomery,
|
./math/[arithmetic, extension_fields],
|
||||||
./backend/ec_shortweierstrass,
|
./math/arithmetic/limbs_montgomery,
|
||||||
./backend/pairing/[pairing_bn, miller_loops, cyclotomic_subgroup],
|
./math/ec_shortweierstrass,
|
||||||
./backend/curves/zoo_subgroups,
|
./math/pairing/[pairing_bn, miller_loops, cyclotomic_subgroup],
|
||||||
./backend/io/[io_bigints, io_fields]
|
./math/curves/zoo_subgroups,
|
||||||
|
./math/io/[io_bigints, io_fields]
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
|
|||||||
@ -8,11 +8,12 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
|
../platforms/[abstractions, endians],
|
||||||
../hashes,
|
../hashes,
|
||||||
../io/[endians, io_bigints, io_fields],
|
../math/io/[io_bigints, io_fields],
|
||||||
../config/[common, curves, type_bigint, type_ff],
|
../math/config/curves,
|
||||||
../arithmetic/limbs_montgomery,
|
../math/arithmetic/limbs_montgomery,
|
||||||
../tower_field_extensions/extension_fields
|
../math/extension_fields/towers
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -8,9 +8,10 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../primitives, ../arithmetic, ../towers,
|
../platforms/abstractions,
|
||||||
../curves/zoo_hash_to_curve,
|
../math/[arithmetic, extension_fields],
|
||||||
../elliptic/[
|
../math/curves/zoo_hash_to_curve,
|
||||||
|
../math/elliptic/[
|
||||||
ec_shortweierstrass_projective,
|
ec_shortweierstrass_projective,
|
||||||
ec_shortweierstrass_jacobian,
|
ec_shortweierstrass_jacobian,
|
||||||
]
|
]
|
||||||
@ -194,7 +195,7 @@ func h2c_isogeny_map*[F; G: static Subgroup](
|
|||||||
r.x.prod(rxn, ryd) # X = xn * yd
|
r.x.prod(rxn, ryd) # X = xn * yd
|
||||||
r.x *= r.z # X = xn * xd * yd²
|
r.x *= r.z # X = xn * xd * yd²
|
||||||
r.y.square(r.z) # Y = xd² * yd²
|
r.y.square(r.z) # Y = xd² * yd²
|
||||||
r.y *= rdx # Y = yd² * xd³
|
r.y *= rxd # Y = yd² * xd³
|
||||||
r.y *= ryn # Y = yn * yd² * xd³
|
r.y *= ryn # Y = yn * yd² * xd³
|
||||||
|
|
||||||
func h2c_isogeny_map*[F; G: static Subgroup](
|
func h2c_isogeny_map*[F; G: static Subgroup](
|
||||||
@ -8,9 +8,10 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../platforms/abstractions,
|
||||||
../primitives, ../arithmetic, ../towers,
|
../math/config/curves,
|
||||||
../curves/zoo_hash_to_curve
|
../math/[arithmetic, extension_fields],
|
||||||
|
../math/curves/zoo_hash_to_curve
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -8,13 +8,14 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../platforms/abstractions,
|
||||||
../primitives, ../arithmetic, ../towers,
|
../math/config/curves,
|
||||||
../curves/[zoo_hash_to_curve, zoo_subgroups],
|
../math/[arithmetic, extension_fields],
|
||||||
../ec_shortweierstrass,
|
../math/curves/[zoo_hash_to_curve, zoo_subgroups],
|
||||||
|
../math/ec_shortweierstrass,
|
||||||
./h2c_hash_to_field,
|
./h2c_hash_to_field,
|
||||||
./h2c_map_to_isocurve_swu,
|
./h2c_map_to_isocurve_swu,
|
||||||
../isogeny/h2c_isogeny_maps,
|
./h2c_isogeny_maps,
|
||||||
../hashes
|
../hashes
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
@ -8,9 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
std/macros,
|
std/macros,
|
||||||
../config/common,
|
../platforms/[abstractions, endians]
|
||||||
../io/endians,
|
|
||||||
../primitives/static_for
|
|
||||||
|
|
||||||
# SHA256, a hash function from the SHA2 family
|
# SHA256, a hash function from the SHA2 family
|
||||||
# --------------------------------------------------------------------------------
|
# --------------------------------------------------------------------------------
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions
|
||||||
../../primitives
|
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
# #
|
# #
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions
|
||||||
../../primitives
|
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions,
|
||||||
../../primitives,
|
|
||||||
./limbs_asm_modular_x86,
|
./limbs_asm_modular_x86,
|
||||||
./limbs_asm_redc_mont_x86,
|
./limbs_asm_redc_mont_x86,
|
||||||
./limbs_asm_mul_x86
|
./limbs_asm_mul_x86
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/[macros, algorithm],
|
std/[macros, algorithm],
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions,
|
||||||
../../primitives,
|
|
||||||
./limbs_asm_modular_x86,
|
./limbs_asm_modular_x86,
|
||||||
./limbs_asm_redc_mont_x86_adx_bmi2,
|
./limbs_asm_redc_mont_x86_adx_bmi2,
|
||||||
./limbs_asm_mul_x86_adx_bmi2
|
./limbs_asm_mul_x86_adx_bmi2
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions
|
||||||
../../primitives
|
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions
|
||||||
../../primitives
|
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -620,7 +619,8 @@ func square_asm_adx*[rLen, aLen: static int](r: var Limbs[rLen], a: Limbs[aLen])
|
|||||||
|
|
||||||
when isMainModule:
|
when isMainModule:
|
||||||
import
|
import
|
||||||
../../config/[type_bigint, common],
|
../../../platforms/abstractions,
|
||||||
|
../../config/type_bigint,
|
||||||
../../arithmetic/limbs
|
../../arithmetic/limbs
|
||||||
|
|
||||||
type SW = SecretWord
|
type SW = SecretWord
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions,
|
||||||
../../primitives,
|
|
||||||
./limbs_asm_modular_x86
|
./limbs_asm_modular_x86
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions,
|
||||||
../../primitives,
|
|
||||||
./limbs_asm_modular_x86
|
./limbs_asm_modular_x86
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../../config/common,
|
../../../platforms/abstractions
|
||||||
../../primitives
|
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
#
|
#
|
||||||
@ -7,8 +7,8 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, type_bigint],
|
../../platforms/abstractions,
|
||||||
../primitives,
|
../config/type_bigint,
|
||||||
./limbs,
|
./limbs,
|
||||||
./limbs_extmul,
|
./limbs_extmul,
|
||||||
./limbs_invmod,
|
./limbs_invmod,
|
||||||
@ -7,8 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, type_bigint],
|
../../platforms/abstractions,
|
||||||
../primitives,
|
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
./limbs,
|
./limbs,
|
||||||
./limbs_montgomery,
|
./limbs_montgomery,
|
||||||
@ -27,8 +27,8 @@
|
|||||||
# which requires a prime
|
# which requires a prime
|
||||||
|
|
||||||
import
|
import
|
||||||
../primitives,
|
../../platforms/abstractions,
|
||||||
../config/[common, type_ff, curves_prop_field_core, curves_prop_field_derived],
|
../config/[type_ff, curves_prop_field_core, curves_prop_field_derived],
|
||||||
./bigints, ./bigints_montgomery
|
./bigints, ./bigints_montgomery
|
||||||
|
|
||||||
when UseASM_X86_64:
|
when UseASM_X86_64:
|
||||||
@ -100,7 +100,7 @@ func cswap*(a, b: var FF, ctl: CTBool) {.meter.} =
|
|||||||
# Routines for special field modulus form:
|
# Routines for special field modulus form:
|
||||||
# - Mersenne Prime (2ᵏ - 1),
|
# - Mersenne Prime (2ᵏ - 1),
|
||||||
# - Generalized Mersenne Prime (NIST Prime P256: 2^256 - 2^224 + 2^192 + 2^96 - 1)
|
# - Generalized Mersenne Prime (NIST Prime P256: 2^256 - 2^224 + 2^192 + 2^96 - 1)
|
||||||
# - Pseudo-Mersenne Prime (2^m - k for example Curve25519: 2^255 - 19)
|
# - Pseudo-Mersenne Prime (2^m - k for example Edwards25519: 2^255 - 19)
|
||||||
# - Golden Primes (φ^2 - φ - 1 with φ = 2ᵏ for example Ed448-Goldilocks: 2^448 - 2^224 - 1)
|
# - Golden Primes (φ^2 - φ - 1 with φ = 2ᵏ for example Ed448-Goldilocks: 2^448 - 2^224 - 1)
|
||||||
# exist and can be implemented with compile-time specialization.
|
# exist and can be implemented with compile-time specialization.
|
||||||
|
|
||||||
@ -7,8 +7,8 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, curves, type_ff],
|
../../platforms/abstractions,
|
||||||
../primitives,
|
../config/curves,
|
||||||
./bigints,
|
./bigints,
|
||||||
./finite_fields,
|
./finite_fields,
|
||||||
./limbs,
|
./limbs,
|
||||||
@ -7,8 +7,8 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../primitives,
|
../../platforms/abstractions,
|
||||||
../config/[common, type_ff, curves],
|
../config/curves,
|
||||||
../curves/zoo_square_roots,
|
../curves/zoo_square_roots,
|
||||||
./bigints, ./finite_fields
|
./bigints, ./finite_fields
|
||||||
|
|
||||||
@ -6,9 +6,7 @@
|
|||||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import ../../platforms/abstractions
|
||||||
../config/common,
|
|
||||||
../primitives
|
|
||||||
|
|
||||||
when UseASM_X86_32:
|
when UseASM_X86_32:
|
||||||
import ./assembly/limbs_asm_x86
|
import ./assembly/limbs_asm_x86
|
||||||
@ -6,9 +6,7 @@
|
|||||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import ../../platforms/abstractions
|
||||||
../config/common,
|
|
||||||
../primitives
|
|
||||||
|
|
||||||
# No exceptions allowed
|
# No exceptions allowed
|
||||||
{.push raises: [].}
|
{.push raises: [].}
|
||||||
@ -7,8 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/common,
|
../../platforms/abstractions,
|
||||||
../primitives,
|
|
||||||
./limbs
|
./limbs
|
||||||
|
|
||||||
when UseASM_X86_64:
|
when UseASM_X86_64:
|
||||||
@ -7,8 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/common,
|
../../platforms/abstractions,
|
||||||
../primitives,
|
|
||||||
./limbs, ./limbs_unsaturated
|
./limbs, ./limbs_unsaturated
|
||||||
|
|
||||||
# No exceptions allowed
|
# No exceptions allowed
|
||||||
@ -10,8 +10,7 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
../config/common,
|
../../platforms/abstractions,
|
||||||
../primitives,
|
|
||||||
./limbs, ./limbs_extmul
|
./limbs, ./limbs_extmul
|
||||||
|
|
||||||
when UseASM_X86_32:
|
when UseASM_X86_32:
|
||||||
@ -6,9 +6,7 @@
|
|||||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import ../../platforms/abstractions
|
||||||
../config/common,
|
|
||||||
../primitives
|
|
||||||
|
|
||||||
type
|
type
|
||||||
SignedSecretWord* = distinct SecretWord
|
SignedSecretWord* = distinct SecretWord
|
||||||
@ -152,7 +152,7 @@ declareCurves:
|
|||||||
coef_a: -5
|
coef_a: -5
|
||||||
coef_d: "6389c12633c267cbc66e3bf86be3b6d8cb66677177e54f92b369f2f5188d58e7"
|
coef_d: "6389c12633c267cbc66e3bf86be3b6d8cb66677177e54f92b369f2f5188d58e7"
|
||||||
|
|
||||||
curve Curve25519: # Bernstein curve
|
curve Edwards25519: # Bernstein curve
|
||||||
bitwidth: 255
|
bitwidth: 255
|
||||||
modulus: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"
|
modulus: "0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"
|
||||||
|
|
||||||
@ -9,7 +9,8 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
./type_bigint, ./common,
|
../../platforms/abstractions,
|
||||||
|
./type_bigint,
|
||||||
./curves_declaration
|
./curves_declaration
|
||||||
|
|
||||||
export Curve
|
export Curve
|
||||||
@ -10,7 +10,8 @@ import
|
|||||||
# Standard library
|
# Standard library
|
||||||
std/macros,
|
std/macros,
|
||||||
# Internal
|
# Internal
|
||||||
./type_bigint, ./type_ff, ./common,
|
../../platforms/abstractions,
|
||||||
|
./type_bigint, ./type_ff,
|
||||||
./curves_declaration, ./curves_prop_field_core, ./curves_derived
|
./curves_declaration, ./curves_prop_field_core, ./curves_derived
|
||||||
|
|
||||||
# ############################################################
|
# ############################################################
|
||||||
@ -7,8 +7,8 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
./type_bigint, ./common,
|
../../platforms/abstractions,
|
||||||
../primitives,
|
./type_bigint,
|
||||||
../io/io_bigints
|
../io/io_bigints
|
||||||
|
|
||||||
# Precomputed constants
|
# Precomputed constants
|
||||||
@ -6,7 +6,7 @@
|
|||||||
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at http://www.apache.org/licenses/LICENSE-2.0).
|
||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import ./common
|
import ../../platforms/abstractions
|
||||||
|
|
||||||
func wordsRequired*(bits: int): int {.compileTime.} =
|
func wordsRequired*(bits: int): int {.compileTime.} =
|
||||||
## Compute the number of limbs required
|
## Compute the number of limbs required
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
./common,
|
../../platforms/abstractions,
|
||||||
./curves_declaration,
|
./curves_declaration,
|
||||||
./curves_prop_field_core
|
./curves_prop_field_core
|
||||||
|
|
||||||
@ -5,7 +5,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields],
|
../io/[io_bigints, io_fields],
|
||||||
../arithmetic/finite_fields
|
../arithmetic/finite_fields
|
||||||
|
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Curve precomputed parameters
|
# Curve precomputed parameters
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields]
|
../io/[io_bigints, io_fields]
|
||||||
|
|
||||||
# BLS12_377 G1
|
# BLS12_377 G1
|
||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Frobenius map - on extension fields
|
# Frobenius map - on extension fields
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,12 +7,13 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, curves, type_bigint, type_ff],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
||||||
../pairing/[cyclotomic_subgroup, miller_loops],
|
../pairing/[cyclotomic_subgroup, miller_loops],
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
# Slow generic implementation
|
# Slow generic implementation
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields],
|
../io/[io_bigints, io_fields],
|
||||||
../arithmetic/finite_fields
|
../arithmetic/finite_fields
|
||||||
|
|
||||||
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../arithmetic,
|
../arithmetic,
|
||||||
../primitives,
|
../extension_fields,
|
||||||
../towers,
|
|
||||||
../ec_shortweierstrass,
|
../ec_shortweierstrass,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../isogeny/frobenius,
|
../isogenies/frobenius,
|
||||||
../curves/zoo_endomorphisms
|
../curves/zoo_endomorphisms
|
||||||
|
|
||||||
func pow_bls12_377_abs_x[ECP: ECP_ShortW[Fp[BLS12_377], G1] or
|
func pow_bls12_377_abs_x[ECP: ECP_ShortW[Fp[BLS12_377], G1] or
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Curve precomputed parameters
|
# Curve precomputed parameters
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields]
|
../io/[io_bigints, io_fields]
|
||||||
|
|
||||||
# BLS12_381 G1
|
# BLS12_381 G1
|
||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Frobenius map - on extension fields
|
# Frobenius map - on extension fields
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/[io_fields, io_towers]
|
../io/[io_fields, io_extfields]
|
||||||
|
|
||||||
# Hash-to-Curve map to isogenous BLS12-381 E'2 constants
|
# Hash-to-Curve map to isogenous BLS12-381 E'2 constants
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,9 +7,9 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_ff],
|
../config/curves,
|
||||||
../elliptic/ec_shortweierstrass_affine,
|
../elliptic/ec_shortweierstrass_affine,
|
||||||
../io/[io_fields, io_towers]
|
../io/[io_fields, io_extfields]
|
||||||
|
|
||||||
# Generators
|
# Generators
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,12 +7,13 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, curves, type_bigint, type_ff],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
||||||
../pairing/[cyclotomic_subgroup, miller_loops],
|
../pairing/[cyclotomic_subgroup, miller_loops],
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
# Slow generic implementation
|
# Slow generic implementation
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Square Root Fp2 constants
|
# Square Root Fp2 constants
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../arithmetic,
|
../arithmetic,
|
||||||
../primitives,
|
../extension_fields,
|
||||||
../towers,
|
|
||||||
../ec_shortweierstrass,
|
../ec_shortweierstrass,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../isogeny/frobenius,
|
../isogenies/frobenius,
|
||||||
../curves/zoo_endomorphisms
|
../curves/zoo_endomorphisms
|
||||||
|
|
||||||
func pow_bls12_381_abs_x[ECP: ECP_ShortW[Fp[BLS12_381], G1] or
|
func pow_bls12_381_abs_x[ECP: ECP_ShortW[Fp[BLS12_381], G1] or
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Curve precomputed parameters
|
# Curve precomputed parameters
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields]
|
../io/[io_bigints, io_fields]
|
||||||
|
|
||||||
# BN254_Nogami G1
|
# BN254_Nogami G1
|
||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Frobenius map - on extension fields
|
# Frobenius map - on extension fields
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,12 +7,13 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, curves, type_bigint, type_ff],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
||||||
../pairing/[cyclotomic_subgroup, miller_loops],
|
../pairing/[cyclotomic_subgroup, miller_loops],
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
# Slow generic implementation
|
# Slow generic implementation
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Square Root Fp2 constants
|
# Square Root Fp2 constants
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../arithmetic,
|
../arithmetic,
|
||||||
../primitives,
|
../extension_fields,
|
||||||
../towers,
|
|
||||||
../ec_shortweierstrass,
|
../ec_shortweierstrass,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
func pow_BN254_Nogami_abs_u*[ECP: ECP_ShortW[Fp[BN254_Nogami], G1] or
|
func pow_BN254_Nogami_abs_u*[ECP: ECP_ShortW[Fp[BN254_Nogami], G1] or
|
||||||
ECP_ShortW[Fp2[BN254_Nogami], G2]](
|
ECP_ShortW[Fp2[BN254_Nogami], G2]](
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Curve precomputed parameters
|
# Curve precomputed parameters
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,7 +7,7 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[curves, type_bigint, type_ff],
|
../config/curves,
|
||||||
../io/[io_bigints, io_fields]
|
../io/[io_bigints, io_fields]
|
||||||
|
|
||||||
# BN254_Snarks G1
|
# BN254_Snarks G1
|
||||||
@ -8,8 +8,8 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Frobenius map - on extension fields
|
# Frobenius map - on extension fields
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -7,12 +7,13 @@
|
|||||||
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
# at your option. This file may not be copied, modified, or distributed except according to those terms.
|
||||||
|
|
||||||
import
|
import
|
||||||
../config/[common, curves, type_bigint, type_ff],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../towers,
|
../extension_fields,
|
||||||
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
../elliptic/[ec_shortweierstrass_affine, ec_shortweierstrass_projective],
|
||||||
../pairing/[cyclotomic_subgroup, miller_loops],
|
../pairing/[cyclotomic_subgroup, miller_loops],
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
# Slow generic implementation
|
# Slow generic implementation
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
../config/curves,
|
../config/curves,
|
||||||
../io/io_towers
|
../io/io_extfields
|
||||||
|
|
||||||
# Square Root Fp2 constants
|
# Square Root Fp2 constants
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
@ -8,13 +8,13 @@
|
|||||||
|
|
||||||
import
|
import
|
||||||
# Internals
|
# Internals
|
||||||
../config/[common, curves],
|
../../platforms/abstractions,
|
||||||
|
../config/curves,
|
||||||
../arithmetic,
|
../arithmetic,
|
||||||
../primitives,
|
../extension_fields,
|
||||||
../towers,
|
|
||||||
../ec_shortweierstrass,
|
../ec_shortweierstrass,
|
||||||
../io/io_bigints,
|
../io/io_bigints,
|
||||||
../isogeny/frobenius
|
../isogenies/frobenius
|
||||||
|
|
||||||
func pow_bn254_snarks_abs_u*[ECP: ECP_ShortW[Fp[BN254_Snarks], G1] or
|
func pow_bn254_snarks_abs_u*[ECP: ECP_ShortW[Fp[BN254_Snarks], G1] or
|
||||||
ECP_ShortW[Fp2[BN254_Snarks], G2]](
|
ECP_ShortW[Fp2[BN254_Snarks], G2]](
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user