2018-12-01 20:12:05 +01:00
|
|
|
|
packageName = "constantine"
|
2018-07-24 16:52:18 +02:00
|
|
|
|
version = "0.0.1"
|
2023-08-13 15:08:04 +02:00
|
|
|
|
author = "Mamy Ratsimbazafy"
|
2022-02-27 01:49:08 +01:00
|
|
|
|
description = "This library provides thoroughly tested and highly-optimized implementations of cryptography protocols."
|
2018-07-24 16:52:18 +02:00
|
|
|
|
license = "MIT or Apache License 2.0"
|
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Dependencies
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
requires "nim >= 1.6.12"
|
|
|
|
|
|
|
|
|
|
# Nimscript imports
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
import std/[strformat, strutils, os]
|
2023-06-04 17:41:54 +02:00
|
|
|
|
|
|
|
|
|
# Environment variables
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
#
|
|
|
|
|
# Compile-time environment variables
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
#
|
|
|
|
|
# - CTT_ASM=0
|
|
|
|
|
# Disable assembly backend. Otherwise use ASM for supported CPUs and fallback to generic code otherwise.
|
|
|
|
|
#
|
|
|
|
|
# Runtime environment variables
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
#
|
|
|
|
|
# - CTT_NUM_THREADS=N
|
|
|
|
|
# Set the threadpool to N threads. Currently this is only supported in some tests/benchmarks.
|
|
|
|
|
# Autodetect the number of threads (including siblings from hyperthreading)
|
|
|
|
|
#
|
|
|
|
|
# Developer, debug, profiling and metrics environment variables
|
|
|
|
|
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
|
|
|
#
|
|
|
|
|
# - CTT_32
|
|
|
|
|
# Compile Constantine with 32-bit backend. Otherwise autodetect.
|
|
|
|
|
#
|
|
|
|
|
# - CTT_DEBUG
|
|
|
|
|
# Add preconditions, invariants and post-conditions checks.
|
|
|
|
|
# This may leak the erroring data. Do not use with secrets.
|
|
|
|
|
#
|
|
|
|
|
# - CTT_GENERATE_HEADERS
|
|
|
|
|
# - CTT_TEST_CURVES
|
|
|
|
|
#
|
|
|
|
|
# - CTT_THREADPOOL_ASSERTS
|
|
|
|
|
# - CTT_THREADPOOL_METRICS
|
|
|
|
|
# - CTT_THREADPOOL_PROFILE
|
|
|
|
|
#
|
|
|
|
|
# - CTT_THREADPOOL_DEBUG
|
|
|
|
|
# - CTT_THREADPOOL_DEBUG_SPLIT
|
|
|
|
|
# - CTT_THREADPOOL_DEBUG_TERMINATION
|
|
|
|
|
|
|
|
|
|
proc getEnvVars(): tuple[useAsmIfAble, force32: bool] =
|
|
|
|
|
if existsEnv"CTT_ASM":
|
|
|
|
|
result.useAsmIfAble = parseBool(getEnv"CTT_ASM")
|
|
|
|
|
else:
|
|
|
|
|
result.useAsmIfAble = true
|
|
|
|
|
if existsEnv"CTT_32":
|
|
|
|
|
result.force32 = true
|
|
|
|
|
else:
|
|
|
|
|
result.force32 = false
|
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
# Library compilation
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
func compilerFlags(): string =
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# -d:danger --opt:size
|
|
|
|
|
# to avoid boundsCheck and overflowChecks that would trigger exceptions or allocations in a crypto library.
|
|
|
|
|
# Those are internally guaranteed at compile-time by fixed-sized array
|
|
|
|
|
# and checked at runtime with an appropriate error code if any for user-input.
|
|
|
|
|
#
|
2023-04-26 06:58:31 +02:00
|
|
|
|
# Furthermore we may optimize for size, the performance critical procedures
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# either use assembly or are unrolled manually with staticFor,
|
|
|
|
|
# Optimizations at -O3 deal with loops and branching
|
2023-04-26 06:58:31 +02:00
|
|
|
|
# which we mostly don't have.
|
|
|
|
|
# Hence optimizing for instructions cache may pay off.
|
2023-04-18 22:02:23 +02:00
|
|
|
|
#
|
|
|
|
|
# --panics:on -d:noSignalHandler
|
|
|
|
|
# Even with `raises: []`, Nim still has an exception path
|
|
|
|
|
# for defects, for example array out-of-bound accesses (though deactivated with -d:danger)
|
2023-10-24 10:56:28 +02:00
|
|
|
|
# This turns them into panics, removing exceptions from the library.
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# We also remove signal handlers as it's not our business.
|
|
|
|
|
#
|
|
|
|
|
# -mm:arc -d:useMalloc
|
|
|
|
|
# Constantine stack allocates everything (except for multithreading).
|
|
|
|
|
# Inputs are through unmanaged ptr+len. So we don't want any runtime.
|
|
|
|
|
# Combined with -d:useMalloc, sanitizers and valgrind work as in C,
|
|
|
|
|
# even for test cases that needs to allocate (json inputs).
|
|
|
|
|
#
|
|
|
|
|
# -fno-semantic-interposition
|
|
|
|
|
# https://fedoraproject.org/wiki/Changes/PythonNoSemanticInterpositionSpeedup
|
|
|
|
|
# Default in Clang, not default in GCC, prevents optimizations, not portable to non-Linux.
|
|
|
|
|
# Also disabling this prevents overriding symbols which might actually be wanted in a cryptographic library
|
|
|
|
|
#
|
|
|
|
|
# -falign-functions=64
|
|
|
|
|
# Reduce instructions cache misses.
|
|
|
|
|
# https://lkml.org/lkml/2015/5/21/443
|
|
|
|
|
# Our non-inlined functions are large so size cost is minimal.
|
2023-10-24 10:56:28 +02:00
|
|
|
|
#
|
|
|
|
|
# -fmerge-all-constants
|
|
|
|
|
# Merge identical constants and variables, in particular
|
|
|
|
|
# field and curve arithmetic constant arrays.
|
|
|
|
|
|
|
|
|
|
" -d:danger " &
|
|
|
|
|
# " --opt:size " &
|
|
|
|
|
" --panics:on -d:noSignalHandler " &
|
|
|
|
|
" --mm:arc -d:useMalloc " &
|
|
|
|
|
" --verbosity:0 --hints:off --warnings:off " &
|
|
|
|
|
" --passC:-fno-semantic-interposition " &
|
|
|
|
|
" --passC:-falign-functions=64 " &
|
|
|
|
|
" --passC:-fmerge-all-constants"
|
|
|
|
|
|
|
|
|
|
proc releaseBuildOptions(useLTO = true): string =
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
let compiler = if existsEnv"CC": " --cc:" & getEnv"CC"
|
|
|
|
|
else: ""
|
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
let (useAsmIfAble, force32) = getEnvVars()
|
|
|
|
|
let envASM = if not useAsmIfAble: " -d:CTT_ASM=false "
|
2023-10-24 10:56:28 +02:00
|
|
|
|
else: ""
|
2023-06-04 17:41:54 +02:00
|
|
|
|
let env32 = if force32: " -d:CTT_32 "
|
2023-04-26 06:58:31 +02:00
|
|
|
|
else: ""
|
|
|
|
|
|
|
|
|
|
let lto = if useLTO: " --passC:-flto=auto --passL:-flto=auto "
|
|
|
|
|
else: ""
|
|
|
|
|
|
|
|
|
|
compiler &
|
2023-06-04 17:41:54 +02:00
|
|
|
|
envASM & env32 &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
lto &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compilerFlags()
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
proc rustBuild(): string =
|
|
|
|
|
# Force Rust compilation, we force Clang compiler
|
|
|
|
|
# and use it's LTO-thin capabilities fro Nim<->Rust cross-language LTO
|
|
|
|
|
# - https://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html
|
|
|
|
|
# - https://github.com/rust-lang/rust/pull/58057
|
|
|
|
|
# - https://doc.rust-lang.org/rustc/linker-plugin-lto.html
|
|
|
|
|
|
|
|
|
|
let compiler = " --cc:clang "
|
|
|
|
|
let lto = " --passC:-flto=thin --passL:-flto=thin "
|
|
|
|
|
|
|
|
|
|
compiler &
|
|
|
|
|
lto &
|
|
|
|
|
compilerFlags()
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
proc genDynamicLib(outdir, nimcache: string) =
|
2023-04-18 22:02:23 +02:00
|
|
|
|
proc compile(libName: string, flags = "") =
|
2023-10-24 10:56:28 +02:00
|
|
|
|
echo &"Compiling dynamic library: {outdir}/" & libName
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
exec "nim c " &
|
|
|
|
|
flags &
|
2023-06-04 17:41:54 +02:00
|
|
|
|
releaseBuildOptions(useLTO = true) &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
" --noMain --app:lib " &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
&" --nimMainPrefix:ctt_init_ " & # Constantine is designed so that NimMain isn't needed, provided --mm:arc -d:useMalloc --panics:on -d:noSignalHandler
|
|
|
|
|
&" --out:{libName} --outdir:{outdir} " &
|
|
|
|
|
&" --nimcache:{nimcache}/libconstantine_dynamic" &
|
|
|
|
|
&" bindings/lib_constantine.nim"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
when defined(windows):
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "constantine.dll"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
elif defined(macosx):
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "libconstantine.dylib.arm", "--cpu:arm64 -l:'-target arm64-apple-macos11' -t:'-target arm64-apple-macos11'"
|
|
|
|
|
compile "libconstantine.dylib.x64", "--cpu:amd64 -l:'-target x86_64-apple-macos10.12' -t:'-target x86_64-apple-macos10.12'"
|
|
|
|
|
exec &"lipo {outdir}/libconstantine.dylib.arm " &
|
|
|
|
|
&" {outdir}/libconstantine.dylib.x64 " &
|
|
|
|
|
&" -output {outdir}/libconstantine.dylib -create"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
else:
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "libconstantine.so"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
proc genStaticLib(outdir, nimcache: string, rustLib = false) =
|
2023-04-18 22:02:23 +02:00
|
|
|
|
proc compile(libName: string, flags = "") =
|
2023-10-24 10:56:28 +02:00
|
|
|
|
echo &"Compiling static library: {outdir}/" & libName
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
exec "nim c " &
|
|
|
|
|
flags &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
(if rustLib: rustBuild() else: releaseBuildOptions(useLTO = false)) &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
" --noMain --app:staticLib " &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
&" --nimMainPrefix:ctt_init_ " & # Constantine is designed so that NimMain isn't needed, provided --mm:arc -d:useMalloc --panics:on -d:noSignalHandler
|
|
|
|
|
&" --out:{libName} --outdir:{outdir} " &
|
|
|
|
|
&" --nimcache:{nimcache}/libconstantine_static" & (if rustLib: "_rust" else: "") &
|
|
|
|
|
&" bindings/lib_constantine.nim"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
when defined(windows):
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "constantine.lib"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
elif defined(macosx):
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "libconstantine.a.arm", "--cpu:arm64 -l:'-target arm64-apple-macos11' -t:'-target arm64-apple-macos11'"
|
|
|
|
|
compile "libconstantine.a.x64", "--cpu:amd64 -l:'-target x86_64-apple-macos10.12' -t:'-target x86_64-apple-macos10.12'"
|
|
|
|
|
exec &"lipo {outdir}/libconstantine.a.arm " &
|
|
|
|
|
&" {outdir}/libconstantine.a.x64 " &
|
|
|
|
|
&" -output {outdir}/libconstantine.a -create"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
|
|
|
|
else:
|
2023-10-24 10:56:28 +02:00
|
|
|
|
compile "libconstantine.a"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
task make_headers, "Regenerate Constantine headers":
|
|
|
|
|
exec "nim c -r -d:CTT_MAKE_HEADERS " &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
" -d:release " &
|
2023-05-29 20:14:30 +02:00
|
|
|
|
" --verbosity:0 --hints:off --warnings:off " &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
" --outdir:build/make " &
|
|
|
|
|
" --nimcache:nimcache/libcurves_headers " &
|
|
|
|
|
" bindings/lib_headers.nim"
|
|
|
|
|
|
|
|
|
|
task make_lib, "Build Constantine library":
|
|
|
|
|
genStaticLib("lib", "nimcache")
|
|
|
|
|
genDynamicLib("lib", "nimcache")
|
|
|
|
|
|
|
|
|
|
task make_lib_rust, "Build Constantine library (use within a Rust build.rs script)":
|
|
|
|
|
doAssert existsEnv"OUT_DIR", "Cargo needs to set the \"OUT_DIR\" environment variable"
|
|
|
|
|
let rustOutDir = getEnv"OUT_DIR"
|
|
|
|
|
genStaticLib(rustOutDir, rustOutDir/"nimcache", rustLib = true)
|
|
|
|
|
|
|
|
|
|
proc testLib(path, testName: string, useGMP: bool) =
|
|
|
|
|
let dynlibName = if defined(windows): "constantine.dll"
|
|
|
|
|
elif defined(macosx): "libconstantine.dylib"
|
|
|
|
|
else: "libconstantine.so"
|
|
|
|
|
let staticlibName = if defined(windows): "constantine.lib"
|
|
|
|
|
else: "libconstantine.a"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
let cc = if existsEnv"CC": getEnv"CC"
|
|
|
|
|
else: "gcc"
|
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
echo &"\n[Test: {path}/{testName}.c] Testing dynamic library {dynlibName}"
|
|
|
|
|
exec &"{cc} -Iinclude -Llib -o build/test_lib/{testName}_dynlink.exe {path}/{testName}.c -lconstantine " & (if useGMP: "-lgmp" else: "")
|
2023-04-18 22:02:23 +02:00
|
|
|
|
when defined(windows):
|
|
|
|
|
# Put DLL near the exe as LD_LIBRARY_PATH doesn't work even in a POSIX compatible shell
|
2023-10-24 10:56:28 +02:00
|
|
|
|
exec &"./build/test_lib/{testName}_dynlink.exe"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
else:
|
2023-10-24 10:56:28 +02:00
|
|
|
|
exec &"LD_LIBRARY_PATH=lib ./build/test_lib/{testName}_dynlink.exe"
|
2023-04-26 06:58:31 +02:00
|
|
|
|
echo ""
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
echo &"\n[Test: {path}/{testName}.c] Testing static library: {staticlibName}"
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# Beware MacOS annoying linker with regards to static libraries
|
|
|
|
|
# The following standard way cannot be used on MacOS
|
2023-10-24 10:56:28 +02:00
|
|
|
|
# exec "gcc -Iinclude -Llib -o build/t_libctt_bls12_381_sl.exe examples_c/t_libctt_bls12_381.c -lgmp -Wl,-Bstatic -lconstantine -Wl,-Bdynamic"
|
|
|
|
|
exec &"{cc} -Iinclude -o build/test_lib/{testName}_staticlink.exe {path}/{testName}.c lib/{staticlibName} " & (if useGMP: "-lgmp" else: "")
|
|
|
|
|
exec &"./build/test_lib/{testName}_staticlink.exe"
|
2023-04-26 06:58:31 +02:00
|
|
|
|
echo ""
|
2023-04-18 22:02:23 +02:00
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
task test_lib, "Test C library":
|
|
|
|
|
exec "mkdir -p build/test_lib"
|
|
|
|
|
testLib("examples_c", "t_libctt_bls12_381", useGMP = true)
|
|
|
|
|
testLib("examples_c", "ethereum_bls_signatures", useGMP = false)
|
2018-07-24 16:52:18 +02:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Test config
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2023-10-24 10:56:28 +02:00
|
|
|
|
const buildParallel = "build/test_suite_parallel.txt"
|
2020-06-07 19:39:34 +02:00
|
|
|
|
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# Testing strategy: to reduce CI time we test leaf functionality
|
|
|
|
|
# and skip testing codepath that would be exercised by leaves.
|
|
|
|
|
# While debugging, relevant unit-test can be reactivated.
|
|
|
|
|
# New features should stay on.
|
|
|
|
|
# Code refactoring requires re-enabling the full suite.
|
|
|
|
|
# Basic primitives should stay on to catch compiler regressions.
|
2020-06-15 22:58:56 +02:00
|
|
|
|
const testDesc: seq[tuple[path: string, useGMP: bool]] = @[
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-08-27 20:50:09 +02:00
|
|
|
|
# CSPRNG
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_csprngs.nim", false),
|
|
|
|
|
|
2022-09-15 09:33:34 +02:00
|
|
|
|
# Hashing vs OpenSSL
|
|
|
|
|
# ----------------------------------------------------------
|
2023-08-27 20:50:09 +02:00
|
|
|
|
("tests/t_hash_sha256_vs_openssl.nim", false), # skip OpenSSL tests on Windows
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
|
|
|
|
# Ciphers
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_cipher_chacha20.nim", false),
|
|
|
|
|
|
|
|
|
|
# Message Authentication Code
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_mac_poly1305.nim", false),
|
|
|
|
|
("tests/t_mac_hmac_sha256.nim", false),
|
|
|
|
|
|
|
|
|
|
# KDF
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_kdf_hkdf.nim", false),
|
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Primitives
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/primitives/t_primitives.nim", false),
|
|
|
|
|
("tests/primitives/t_primitives_extended_precision.nim", false),
|
|
|
|
|
("tests/primitives/t_io_unsaturated.nim", false),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Big ints
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_bigints/t_io_bigints.nim", false),
|
|
|
|
|
# ("tests/math_bigints/t_bigints.nim", false),
|
|
|
|
|
# ("tests/math_bigints/t_bigints_multimod.nim", false),
|
2023-07-09 18:57:12 +02:00
|
|
|
|
("tests/math_bigints/t_bigints_mul_vs_gmp.nim", true),
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_bigints/t_bigints_mul_high_words_vs_gmp.nim", true),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2023-06-01 23:38:41 +02:00
|
|
|
|
# Big ints - arbitrary precision
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/math_arbitrary_precision/t_bigints_mod.nim", false),
|
|
|
|
|
("tests/math_arbitrary_precision/t_bigints_mod_vs_gmp.nim", true),
|
|
|
|
|
("tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim", true),
|
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Field
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_fields/t_io_fields", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields.nim", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields_conditional_arithmetic.nim", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields_mulsquare.nim", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields_sqrt.nim", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields_powinv.nim", false),
|
|
|
|
|
# ("tests/math_fields/t_finite_fields_vs_gmp.nim", true),
|
|
|
|
|
# ("tests/math_fields/t_fp_cubic_root.nim", false),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2021-02-09 22:57:45 +01:00
|
|
|
|
# Double-precision finite fields
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_fields/t_finite_fields_double_precision.nim", false),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Towers of extension fields
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_extension_fields/t_fp2.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp2_sqrt.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp4.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_bn254_nogami.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_bn254_nogami.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_exponentiation.nim", false),
|
|
|
|
|
("tests/math_extension_fields/t_fp12_anti_regression.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_extension_fields/t_fp4_frobenius.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp6_frobenius.nim", false),
|
|
|
|
|
# ("tests/math_extension_fields/t_fp12_frobenius.nim", false),
|
2022-02-10 14:05:07 +01:00
|
|
|
|
|
2023-01-24 02:32:28 +01:00
|
|
|
|
# Elliptic curve arithmetic
|
2022-02-10 14:05:07 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-06-04 17:41:54 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_conversion.nim", false),
|
2022-02-10 14:05:07 +01:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Elliptic curve arithmetic G1
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-06-04 17:41:54 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g1_add_double.nim", false),
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_sanity.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_distri.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g1_mul_vs_ref.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g1_mixed_add.nim", false),
|
2022-02-27 01:49:08 +01:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g1_add_double.nim", false),
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_sanity.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_distri.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g1_mul_vs_ref.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g1_mixed_add.nim", false),
|
2022-02-27 01:49:08 +01:00
|
|
|
|
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jacext_g1_add_double.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jacext_g1_mixed_add.nim", false),
|
2023-02-16 12:45:05 +01:00
|
|
|
|
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_twedwards_prj_add_double", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_twedwards_prj_mul_sanity", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_twedwards_prj_mul_distri", false),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2021-12-29 01:54:17 +01:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Elliptic curve arithmetic G2
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bn254_snarks.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bn254_snarks.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_381.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_381.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bls12_377.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bls12_377.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_add_double_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_sanity_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_distri_bw6_761.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mul_vs_ref_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_prj_g2_mixed_add_bw6_761.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bn254_snarks.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bn254_snarks.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_381.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_381.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_381.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bls12_377.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bls12_377.nim", false),
|
|
|
|
|
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_add_double_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_sanity_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_distri_bw6_761.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mul_vs_ref_bw6_761.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_shortw_jac_g2_mixed_add_bw6_761.nim", false),
|
2020-10-09 07:51:47 +02:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Elliptic curve arithmetic vs Sagemath
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_frobenius.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_bn254_nogami.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_bn254_snarks.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_bls12_377.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_bls12_381.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_pallas.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_sage_vesta.nim", false),
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2020-06-23 01:27:40 +02:00
|
|
|
|
# Edge cases highlighted by past bugs
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_edge_cases.nim", false),
|
2022-01-03 14:12:58 +01:00
|
|
|
|
|
2022-10-29 22:43:40 +02:00
|
|
|
|
# Elliptic curve arithmetic - batch computation
|
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g1_sum_reduce.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g1_sum_reduce.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jacext_g1_sum_reduce.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_prj_g1_msm.nim", false),
|
|
|
|
|
("tests/math_elliptic_curves/t_ec_shortw_jac_g1_msm.nim", false),
|
2022-10-29 22:43:40 +02:00
|
|
|
|
|
2022-01-03 14:12:58 +01:00
|
|
|
|
# Subgroups and cofactors
|
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_subgroups_bn254_nogami.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_subgroups_bn254_snarks.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_subgroups_bls12_377.nim", false),
|
|
|
|
|
# ("tests/math_elliptic_curves/t_ec_subgroups_bls12_381.nim", false),
|
2022-01-03 14:12:58 +01:00
|
|
|
|
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_pairings/t_pairing_bn254_nogami_gt_subgroup.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_bn254_snarks_gt_subgroup.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_bls12_377_gt_subgroup.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_bls12_381_gt_subgroup.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_bw6_761_gt_subgroup.nim", false),
|
2022-01-03 14:12:58 +01:00
|
|
|
|
|
2020-09-21 23:24:00 +02:00
|
|
|
|
# Pairing
|
2021-01-21 21:25:42 +01:00
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
# ("tests/math_pairings/t_pairing_bls12_377_line_functions.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_bls12_381_line_functions.nim", false),
|
|
|
|
|
# ("tests/math_pairings/t_pairing_mul_fp12_by_lines.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_cyclotomic_subgroup.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bn254_nogami_optate.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bn254_snarks_optate.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bls12_377_optate.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bls12_381_optate.nim", false),
|
2022-05-08 19:01:23 +02:00
|
|
|
|
|
|
|
|
|
# Multi-Pairing
|
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_pairings/t_pairing_bn254_nogami_multi.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bn254_snarks_multi.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bls12_377_multi.nim", false),
|
|
|
|
|
("tests/math_pairings/t_pairing_bls12_381_multi.nim", false),
|
2021-01-22 00:09:52 +01:00
|
|
|
|
|
|
|
|
|
# Prime order fields
|
|
|
|
|
# ----------------------------------------------------------
|
2023-05-29 20:14:30 +02:00
|
|
|
|
("tests/math_fields/t_fr.nim", false),
|
2022-02-21 01:04:53 +01:00
|
|
|
|
|
2022-04-26 21:24:07 +02:00
|
|
|
|
# Hashing to elliptic curves
|
|
|
|
|
# ----------------------------------------------------------
|
|
|
|
|
("tests/t_hash_to_field.nim", false),
|
2023-07-03 06:57:22 +02:00
|
|
|
|
("tests/t_hash_to_curve_random.nim", false),
|
2022-04-26 21:24:07 +02:00
|
|
|
|
("tests/t_hash_to_curve.nim", false),
|
|
|
|
|
|
2021-08-15 11:41:46 +02:00
|
|
|
|
# Protocols
|
|
|
|
|
# ----------------------------------------------------------
|
2023-07-02 17:14:50 +02:00
|
|
|
|
("tests/t_ethereum_evm_modexp.nim", false),
|
2022-02-21 01:04:53 +01:00
|
|
|
|
("tests/t_ethereum_evm_precompiles.nim", false),
|
2023-04-18 22:02:23 +02:00
|
|
|
|
("tests/t_ethereum_bls_signatures.nim", false),
|
2022-08-16 12:07:57 +02:00
|
|
|
|
("tests/t_ethereum_eip2333_bls12381_key_derivation.nim", false),
|
2023-09-15 08:21:04 +02:00
|
|
|
|
("tests/t_ethereum_eip4844_deneb_kzg.nim", false),
|
2023-10-06 07:58:20 +00:00
|
|
|
|
("tests/t_ethereum_eip4844_deneb_kzg_parallel.nim", false),
|
2023-10-06 18:25:14 +02:00
|
|
|
|
("tests/t_ethereum_verkle_primitives.nim", false),
|
2020-06-15 22:58:56 +02:00
|
|
|
|
]
|
|
|
|
|
|
2023-01-12 01:01:57 +01:00
|
|
|
|
const testDescNvidia: seq[string] = @[
|
|
|
|
|
"tests/gpu/t_nvidia_fp.nim",
|
|
|
|
|
]
|
|
|
|
|
|
2023-01-24 02:32:28 +01:00
|
|
|
|
const testDescThreadpool: seq[string] = @[
|
2023-05-29 20:14:30 +02:00
|
|
|
|
"constantine/threadpool/examples/e01_simple_tasks.nim",
|
|
|
|
|
"constantine/threadpool/examples/e02_parallel_pi.nim",
|
|
|
|
|
"constantine/threadpool/examples/e03_parallel_for.nim",
|
|
|
|
|
"constantine/threadpool/examples/e04_parallel_reduce.nim",
|
|
|
|
|
# "constantine/threadpool/benchmarks/bouncing_producer_consumer/threadpool_bpc.nim", # Need timing not implemented on Windows
|
|
|
|
|
"constantine/threadpool/benchmarks/dfs/threadpool_dfs.nim",
|
|
|
|
|
"constantine/threadpool/benchmarks/fibonacci/threadpool_fib.nim",
|
|
|
|
|
"constantine/threadpool/benchmarks/heat/threadpool_heat.nim",
|
|
|
|
|
# "constantine/threadpool/benchmarks/matmul_cache_oblivious/threadpool_matmul_co.nim",
|
|
|
|
|
"constantine/threadpool/benchmarks/nqueens/threadpool_nqueens.nim",
|
|
|
|
|
# "constantine/threadpool/benchmarks/single_task_producer/threadpool_spc.nim", # Need timing not implemented on Windows
|
|
|
|
|
# "constantine/threadpool/benchmarks/black_scholes/threadpool_black_scholes.nim", # Need input file
|
|
|
|
|
"constantine/threadpool/benchmarks/matrix_transposition/threadpool_transposes.nim",
|
|
|
|
|
"constantine/threadpool/benchmarks/histogram_2D/threadpool_histogram.nim",
|
|
|
|
|
"constantine/threadpool/benchmarks/logsumexp/threadpool_logsumexp.nim",
|
2023-01-24 02:32:28 +01:00
|
|
|
|
]
|
|
|
|
|
|
2023-01-29 01:06:37 +01:00
|
|
|
|
const testDescMultithreadedCrypto: seq[string] = @[
|
|
|
|
|
"tests/parallel/t_ec_shortw_jac_g1_batch_add_parallel.nim",
|
2023-04-10 23:30:14 +02:00
|
|
|
|
"tests/parallel/t_ec_shortw_prj_g1_batch_add_parallel.nim",
|
|
|
|
|
"tests/parallel/t_ec_shortw_jac_g1_msm_parallel.nim",
|
|
|
|
|
"tests/parallel/t_ec_shortw_prj_g1_msm_parallel.nim",
|
2023-01-29 01:06:37 +01:00
|
|
|
|
]
|
|
|
|
|
|
2022-09-15 09:33:34 +02:00
|
|
|
|
const benchDesc = [
|
|
|
|
|
"bench_fp",
|
|
|
|
|
"bench_fp_double_precision",
|
|
|
|
|
"bench_fp2",
|
2022-09-18 15:26:42 +02:00
|
|
|
|
"bench_fp4",
|
2022-09-15 09:33:34 +02:00
|
|
|
|
"bench_fp6",
|
|
|
|
|
"bench_fp12",
|
|
|
|
|
"bench_ec_g1",
|
2023-02-16 12:45:05 +01:00
|
|
|
|
"bench_ec_g1_scalar_mul",
|
2022-10-29 22:43:40 +02:00
|
|
|
|
"bench_ec_g1_batch",
|
2023-02-16 12:45:05 +01:00
|
|
|
|
"bench_ec_g1_msm_bn254_snarks",
|
|
|
|
|
"bench_ec_g1_msm_bls12_381",
|
2022-09-15 09:33:34 +02:00
|
|
|
|
"bench_ec_g2",
|
2023-02-16 12:45:05 +01:00
|
|
|
|
"bench_ec_g2_scalar_mul",
|
2022-09-15 09:33:34 +02:00
|
|
|
|
"bench_pairing_bls12_377",
|
|
|
|
|
"bench_pairing_bls12_381",
|
|
|
|
|
"bench_pairing_bn254_nogami",
|
|
|
|
|
"bench_pairing_bn254_snarks",
|
|
|
|
|
"bench_summary_bls12_377",
|
|
|
|
|
"bench_summary_bls12_381",
|
|
|
|
|
"bench_summary_bn254_nogami",
|
|
|
|
|
"bench_summary_bn254_snarks",
|
2022-09-18 15:26:42 +02:00
|
|
|
|
"bench_summary_pasta",
|
2022-09-19 00:41:37 +02:00
|
|
|
|
"bench_poly1305",
|
2022-09-15 09:33:34 +02:00
|
|
|
|
"bench_sha256",
|
2022-09-18 15:26:42 +02:00
|
|
|
|
"bench_hash_to_curve",
|
2023-07-11 09:06:46 +02:00
|
|
|
|
"bench_ethereum_bls_signatures",
|
2023-10-06 07:58:20 +00:00
|
|
|
|
"bench_ethereum_eip4844_kzg",
|
2023-07-11 09:06:46 +02:00
|
|
|
|
"bench_evm_modexp_dos",
|
2023-09-09 10:09:47 +02:00
|
|
|
|
"bench_gmp_modexp",
|
|
|
|
|
"bench_gmp_modmul"
|
2022-09-15 09:33:34 +02:00
|
|
|
|
]
|
|
|
|
|
|
2020-06-19 22:08:15 +02:00
|
|
|
|
# For temporary (hopefully) investigation that can only be reproduced in CI
|
|
|
|
|
const useDebug = [
|
2023-05-29 20:14:30 +02:00
|
|
|
|
"tests/math_bigints/t_bigints.nim",
|
|
|
|
|
"tests/t_hash_sha256_vs_openssl.nim",
|
2020-12-15 19:18:36 +01:00
|
|
|
|
]
|
|
|
|
|
|
2023-07-11 09:06:46 +02:00
|
|
|
|
# Skip stack hardening for specific tests
|
|
|
|
|
const skipStackHardening = [
|
2023-04-18 22:02:23 +02:00
|
|
|
|
"tests/t_"
|
2020-06-19 22:08:15 +02:00
|
|
|
|
]
|
2023-07-11 09:06:46 +02:00
|
|
|
|
# use sanitizers for specific tests
|
|
|
|
|
const useSanitizers = [
|
|
|
|
|
"tests/math_arbitrary_precision/t_bigints_powmod_vs_gmp.nim",
|
|
|
|
|
"tests/t_ethereum_evm_modexp.nim",
|
|
|
|
|
"tests/t_etherem_evm_precompiles.nim",
|
|
|
|
|
]
|
2020-06-19 22:08:15 +02:00
|
|
|
|
|
2021-01-21 21:25:42 +01:00
|
|
|
|
when defined(windows):
|
|
|
|
|
# UBSAN is not available on mingw
|
2023-04-26 06:58:31 +02:00
|
|
|
|
# https://github.com/libressl-portable/portable/issues/54
|
2021-01-21 21:25:42 +01:00
|
|
|
|
const sanitizers = ""
|
2023-07-11 09:06:46 +02:00
|
|
|
|
const stackHardening = ""
|
2021-01-21 21:25:42 +01:00
|
|
|
|
else:
|
2023-07-11 09:06:46 +02:00
|
|
|
|
const stackHardening =
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
|
|
|
|
" --passC:-fstack-protector-strong " &
|
|
|
|
|
|
2023-07-11 09:06:46 +02:00
|
|
|
|
# Fortify source wouldn't help us detect errors in Constantine
|
2023-04-26 06:58:31 +02:00
|
|
|
|
# because everything is stack allocated
|
|
|
|
|
# except with the threadpool:
|
|
|
|
|
# - https://developers.redhat.com/blog/2021/04/16/broadening-compiler-checks-for-buffer-overflows-in-_fortify_source#what_s_next_for__fortify_source
|
|
|
|
|
# - https://developers.redhat.com/articles/2023/02/06/how-improve-application-security-using-fortifysource3#how_to_improve_application_fortification
|
|
|
|
|
# We also don't use memcpy as it is not constant-time and our copy is compile-time sized.
|
|
|
|
|
|
2023-07-11 09:06:46 +02:00
|
|
|
|
" --passC:-D_FORTIFY_SOURCE=3 "
|
|
|
|
|
|
|
|
|
|
const sanitizers =
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# Sanitizers are incompatible with nim default GC
|
|
|
|
|
# The conservative stack scanning of Nim default GC triggers, alignment UB and stack-buffer-overflow check.
|
|
|
|
|
# Address sanitizer requires free registers and needs to be disabled for some inline assembly files.
|
|
|
|
|
# Ensure you use --mm:arc -d:useMalloc
|
|
|
|
|
#
|
|
|
|
|
# Sanitizers are deactivated by default as they slow down CI by at least 6x
|
|
|
|
|
|
2023-07-11 09:06:46 +02:00
|
|
|
|
" --mm:arc -d:useMalloc" &
|
|
|
|
|
" --passC:-fsanitize=undefined --passL:-fsanitize=undefined" &
|
|
|
|
|
" --passC:-fsanitize=address --passL:-fsanitize=address" &
|
|
|
|
|
" --passC:-fno-sanitize-recover" # Enforce crash on undefined behaviour
|
2020-06-19 22:08:15 +02:00
|
|
|
|
|
2023-04-18 22:02:23 +02:00
|
|
|
|
# Tests & Benchmarks helper functions
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2020-12-15 19:18:36 +01:00
|
|
|
|
proc clearParallelBuild() =
|
2022-09-15 09:33:34 +02:00
|
|
|
|
# Support clearing from non POSIX shell like CMD, Powershell or MSYS2
|
|
|
|
|
if fileExists(buildParallel):
|
|
|
|
|
rmFile(buildParallel)
|
2020-12-15 19:18:36 +01:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc setupTestCommand(flags, path: string): string =
|
2020-02-23 18:27:26 +01:00
|
|
|
|
var lang = "c"
|
|
|
|
|
if existsEnv"TEST_LANG":
|
|
|
|
|
lang = getEnv"TEST_LANG"
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
return "nim " & lang &
|
2023-04-18 22:02:23 +02:00
|
|
|
|
" -r " &
|
|
|
|
|
flags &
|
2023-06-04 17:41:54 +02:00
|
|
|
|
releaseBuildOptions() &
|
2023-10-24 10:56:28 +02:00
|
|
|
|
" --outdir:build/test_suite " &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
&" --nimcache:nimcache/{path} " &
|
2020-08-22 23:00:05 +02:00
|
|
|
|
path
|
2020-06-07 19:39:34 +02:00
|
|
|
|
|
2022-09-15 09:33:34 +02:00
|
|
|
|
proc test(cmd: string) =
|
|
|
|
|
echo "\n=============================================================================================="
|
|
|
|
|
echo "Running '", cmd, "'"
|
|
|
|
|
echo "=============================================================================================="
|
|
|
|
|
exec cmd
|
2018-07-24 16:52:18 +02:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc testBatch(commands: var string, flags, path: string) =
|
2023-04-26 06:58:31 +02:00
|
|
|
|
# With LTO, the linker produces lots of spurious warnings when copying into openArrays/strings
|
2020-04-15 19:46:25 +02:00
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
let flags = if defined(gcc): flags & " --passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow "
|
|
|
|
|
else: flags
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
commands = commands & setupTestCommand(flags, path) & '\n'
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc setupBench(benchName: string, run: bool): string =
|
2023-04-26 06:58:31 +02:00
|
|
|
|
var runFlags = " "
|
|
|
|
|
if run: # Beware of https://github.com/nim-lang/Nim/issues/21704
|
|
|
|
|
runFlags = runFlags & " -r "
|
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
let asmStatus = if getEnvVars().useAsmIfAble: "asmIfAvailable" else: "noAsm"
|
2023-04-26 06:58:31 +02:00
|
|
|
|
|
|
|
|
|
if defined(gcc):
|
|
|
|
|
# With LTO, the linker produces lots of spurious warnings when copying into openArrays/strings
|
|
|
|
|
runFlags = runFlags & " --passC:-Wno-stringop-overflow --passL:-Wno-stringop-overflow "
|
|
|
|
|
|
|
|
|
|
let cc = if existsEnv"CC": getEnv"CC"
|
|
|
|
|
else: "defaultcompiler"
|
2021-01-21 21:25:42 +01:00
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
return "nim c " &
|
|
|
|
|
runFlags &
|
2023-06-04 17:41:54 +02:00
|
|
|
|
releaseBuildOptions() &
|
2023-04-26 06:58:31 +02:00
|
|
|
|
&" -o:build/bench/{benchName}_{cc}_{asmStatus}" &
|
|
|
|
|
&" --nimcache:nimcache/benches/{benchName}_{cc}_{asmStatus}" &
|
|
|
|
|
&" benchmarks/{benchName}.nim"
|
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc runBench(benchName: string) =
|
2022-09-15 09:33:34 +02:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
2023-06-04 17:41:54 +02:00
|
|
|
|
let command = setupBench(benchName, run = true)
|
2022-09-15 09:33:34 +02:00
|
|
|
|
exec command
|
2020-04-15 19:46:25 +02:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc buildBenchBatch(commands: var string, benchName: string) =
|
|
|
|
|
let command = setupBench(benchName, run = false)
|
2023-04-26 06:58:31 +02:00
|
|
|
|
commands = commands & command & '\n'
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc addTestSet(cmdFile: var string, requireGMP: bool) =
|
2022-09-15 09:33:34 +02:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
echo "Found " & $testDesc.len & " tests to run."
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2020-12-15 19:18:36 +01:00
|
|
|
|
for td in testDesc:
|
|
|
|
|
if not(td.useGMP and not requireGMP):
|
2023-04-26 06:58:31 +02:00
|
|
|
|
var flags = "" # Beware of https://github.com/nim-lang/Nim/issues/21704
|
2020-12-15 19:18:36 +01:00
|
|
|
|
if td.path in useDebug:
|
2023-06-04 17:41:54 +02:00
|
|
|
|
flags = flags & " -d:CTT_DEBUG "
|
2023-07-11 09:06:46 +02:00
|
|
|
|
if td.path notin skipStackHardening:
|
|
|
|
|
flags = flags & stackHardening
|
|
|
|
|
if td.path in useSanitizers:
|
2023-04-26 06:58:31 +02:00
|
|
|
|
flags = flags & sanitizers
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.testBatch(flags, td.path)
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-01-12 01:01:57 +01:00
|
|
|
|
proc addTestSetNvidia(cmdFile: var string) =
|
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
echo "Found " & $testDescNvidia.len & " tests to run."
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
for path in testDescNvidia:
|
|
|
|
|
var flags = "" # Beware of https://github.com/nim-lang/Nim/issues/21704
|
2023-07-11 09:06:46 +02:00
|
|
|
|
if path notin skipStackHardening:
|
|
|
|
|
flags = flags & stackHardening
|
|
|
|
|
if path in useSanitizers:
|
2023-04-26 06:58:31 +02:00
|
|
|
|
flags = flags & sanitizers
|
2023-04-18 22:02:23 +02:00
|
|
|
|
cmdFile.testBatch(flags, path)
|
2023-01-12 01:01:57 +01:00
|
|
|
|
|
2023-01-24 02:32:28 +01:00
|
|
|
|
proc addTestSetThreadpool(cmdFile: var string) =
|
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
echo "Found " & $testDescThreadpool.len & " tests to run."
|
|
|
|
|
|
|
|
|
|
for path in testDescThreadpool:
|
2023-04-18 22:02:23 +02:00
|
|
|
|
var flags = " --threads:on --debugger:native "
|
2023-07-11 09:06:46 +02:00
|
|
|
|
if path notin skipStackHardening:
|
|
|
|
|
flags = flags & stackHardening
|
|
|
|
|
if path in useSanitizers:
|
2023-04-26 06:58:31 +02:00
|
|
|
|
flags = flags & sanitizers
|
2023-04-18 22:02:23 +02:00
|
|
|
|
cmdFile.testBatch(flags, path)
|
2023-01-29 01:06:37 +01:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc addTestSetMultithreadedCrypto(cmdFile: var string) =
|
2023-01-29 01:06:37 +01:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
echo "Found " & $testDescMultithreadedCrypto.len & " tests to run."
|
|
|
|
|
|
|
|
|
|
for td in testDescMultithreadedCrypto:
|
|
|
|
|
var flags = " --threads:on --debugger:native"
|
|
|
|
|
if td in useDebug:
|
2023-06-04 17:41:54 +02:00
|
|
|
|
flags = flags & " -d:CTT_DEBUG "
|
2023-07-11 09:06:46 +02:00
|
|
|
|
if td notin skipStackHardening:
|
|
|
|
|
flags = flags & stackHardening
|
|
|
|
|
if td in useSanitizers:
|
2023-04-26 06:58:31 +02:00
|
|
|
|
flags = flags & sanitizers
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.testBatch(flags, td)
|
2023-01-24 02:32:28 +01:00
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
proc addBenchSet(cmdFile: var string) =
|
2022-09-15 09:33:34 +02:00
|
|
|
|
if not dirExists "build":
|
|
|
|
|
mkDir "build"
|
|
|
|
|
echo "Found " & $benchDesc.len & " benches to compile. (compile-only to ensure they stay relevant)"
|
|
|
|
|
for bd in benchDesc:
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.buildBenchBatch(bd)
|
2021-01-22 00:09:52 +01:00
|
|
|
|
|
2022-09-15 09:33:34 +02:00
|
|
|
|
proc genParallelCmdRunner() =
|
2023-10-24 10:56:28 +02:00
|
|
|
|
exec "nim c --verbosity:0 --hints:off --warnings:off -d:release --out:build/test_suite/pararun --nimcache:nimcache/test_suite/pararun helpers/pararun.nim"
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2020-06-15 22:58:56 +02:00
|
|
|
|
# Tasks
|
|
|
|
|
# ----------------------------------------------------------------
|
|
|
|
|
|
2018-07-24 16:52:18 +02:00
|
|
|
|
task test, "Run all tests":
|
2023-06-04 17:41:54 +02:00
|
|
|
|
# -d:CTT_TEST_CURVES is configured in a *.nim.cfg for convenience
|
2022-09-15 09:33:34 +02:00
|
|
|
|
var cmdFile: string
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.addTestSet(requireGMP = true)
|
|
|
|
|
cmdFile.addBenchSet() # Build (but don't run) benches to ensure they stay relevant
|
2023-01-24 02:32:28 +01:00
|
|
|
|
cmdFile.addTestSetThreadpool()
|
2023-04-10 23:30:14 +02:00
|
|
|
|
cmdFile.addTestSetMultithreadedCrypto()
|
2022-09-15 09:33:34 +02:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
2023-01-24 02:32:28 +01:00
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
2020-04-15 19:46:25 +02:00
|
|
|
|
|
2020-02-23 18:27:26 +01:00
|
|
|
|
task test_no_gmp, "Run tests that don't require GMP":
|
2023-06-04 17:41:54 +02:00
|
|
|
|
# -d:CTT_TEST_CURVES is configured in a *.nim.cfg for convenience
|
2022-09-15 09:33:34 +02:00
|
|
|
|
var cmdFile: string
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.addTestSet(requireGMP = false)
|
|
|
|
|
cmdFile.addBenchSet() # Build (but don't run) benches to ensure they stay relevant
|
2023-01-24 02:32:28 +01:00
|
|
|
|
cmdFile.addTestSetThreadpool()
|
2023-04-10 23:30:14 +02:00
|
|
|
|
cmdFile.addTestSetMultithreadedCrypto()
|
2022-09-15 09:33:34 +02:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
2023-01-24 02:32:28 +01:00
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
2020-03-20 23:03:52 +01:00
|
|
|
|
|
2023-04-10 23:30:14 +02:00
|
|
|
|
task test_parallel, "Run all tests in parallel":
|
2023-06-04 17:41:54 +02:00
|
|
|
|
# -d:CTT_TEST_CURVES is configured in a *.nim.cfg for convenience
|
2020-12-15 19:18:36 +01:00
|
|
|
|
clearParallelBuild()
|
2022-09-15 09:33:34 +02:00
|
|
|
|
genParallelCmdRunner()
|
|
|
|
|
|
|
|
|
|
var cmdFile: string
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.addTestSet(requireGMP = true)
|
|
|
|
|
cmdFile.addBenchSet() # Build (but don't run) benches to ensure they stay relevant
|
2022-09-15 09:33:34 +02:00
|
|
|
|
writeFile(buildParallel, cmdFile)
|
2023-10-24 10:56:28 +02:00
|
|
|
|
exec "build/test_suite/pararun " & buildParallel
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-01-24 02:32:28 +01:00
|
|
|
|
# Threadpool tests done serially
|
|
|
|
|
cmdFile = ""
|
|
|
|
|
cmdFile.addTestSetThreadpool()
|
2023-04-10 23:30:14 +02:00
|
|
|
|
cmdFile.addTestSetMultithreadedCrypto()
|
2023-01-24 02:32:28 +01:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
task test_parallel_no_gmp, "Run in parallel tests that don't require GMP":
|
|
|
|
|
# -d:CTT_TEST_CURVES is configured in a *.nim.cfg for convenience
|
2020-12-15 19:18:36 +01:00
|
|
|
|
clearParallelBuild()
|
2022-09-15 09:33:34 +02:00
|
|
|
|
genParallelCmdRunner()
|
|
|
|
|
|
|
|
|
|
var cmdFile: string
|
2023-06-04 17:41:54 +02:00
|
|
|
|
cmdFile.addTestSet(requireGMP = false)
|
|
|
|
|
cmdFile.addBenchSet() # Build (but don't run) benches to ensure they stay relevant
|
2022-09-15 09:33:34 +02:00
|
|
|
|
writeFile(buildParallel, cmdFile)
|
2023-10-24 10:56:28 +02:00
|
|
|
|
exec "build/test_suite/pararun " & buildParallel
|
2022-09-15 09:33:34 +02:00
|
|
|
|
|
2023-01-24 02:32:28 +01:00
|
|
|
|
# Threadpool tests done serially
|
|
|
|
|
cmdFile = ""
|
|
|
|
|
cmdFile.addTestSetThreadpool()
|
2023-04-10 23:30:14 +02:00
|
|
|
|
cmdFile.addTestSetMultithreadedCrypto()
|
2023-01-24 02:32:28 +01:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
|
|
|
|
|
|
|
|
|
task test_threadpool, "Run all tests for the builtin threadpool":
|
|
|
|
|
var cmdFile: string
|
|
|
|
|
cmdFile.addTestSetThreadpool()
|
2023-01-29 01:06:37 +01:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
|
|
|
|
|
|
|
|
|
task test_multithreaded_crypto, "Run all tests for multithreaded cryptography":
|
|
|
|
|
var cmdFile: string
|
|
|
|
|
cmdFile.addTestSetMultithreadedCrypto()
|
2023-01-24 02:32:28 +01:00
|
|
|
|
for cmd in cmdFile.splitLines():
|
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
|
|
|
|
|
2023-01-12 01:01:57 +01:00
|
|
|
|
task test_nvidia, "Run all tests for Nvidia GPUs":
|
|
|
|
|
var cmdFile: string
|
|
|
|
|
cmdFile.addTestSetNvidia()
|
|
|
|
|
for cmd in cmdFile.splitLines():
|
2023-01-24 02:32:28 +01:00
|
|
|
|
if cmd != "": # Windows doesn't like empty commands
|
|
|
|
|
exec cmd
|
2023-01-12 01:01:57 +01:00
|
|
|
|
|
2023-06-01 23:38:41 +02:00
|
|
|
|
# BigInt benchmark
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
|
|
|
|
task bench_powmod, "Run modular exponentiation benchmark with your CC compiler":
|
|
|
|
|
runBench("bench_powmod")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Finite field 𝔽p
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fp, "Run benchmark 𝔽p with your CC compiler":
|
2020-03-21 02:31:31 +01:00
|
|
|
|
runBench("bench_fp")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Double-precision field 𝔽pDbl
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fpdbl, "Run benchmark 𝔽pDbl with your CC compiler":
|
2021-02-09 22:57:45 +01:00
|
|
|
|
runBench("bench_fp_double_precision")
|
2020-08-20 10:21:39 +02:00
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Extension field 𝔽p2
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fp2, "Run benchmark 𝔽p2 with your CC compiler":
|
2020-03-21 02:31:31 +01:00
|
|
|
|
runBench("bench_fp2")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Extension field 𝔽p4
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fp4, "Run benchmark 𝔽p4 with your CC compiler":
|
2020-10-02 00:01:09 +02:00
|
|
|
|
runBench("bench_fp4")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Extension field 𝔽p6
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fp6, "Run benchmark 𝔽p6 with your CC compiler":
|
2020-03-21 02:31:31 +01:00
|
|
|
|
runBench("bench_fp6")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Extension field 𝔽p12
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_fp12, "Run benchmark 𝔽p12 with your CC compiler":
|
2020-04-09 14:28:01 +02:00
|
|
|
|
runBench("bench_fp12")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Elliptic curve G1
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g1, "Run benchmark on Elliptic Curve group 𝔾1 - CC compiler":
|
2020-06-14 15:39:06 +02:00
|
|
|
|
runBench("bench_ec_g1")
|
2020-04-15 19:43:31 +02:00
|
|
|
|
|
2022-10-29 22:43:40 +02:00
|
|
|
|
# Elliptic curve G1 - batch operations
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g1_batch, "Run benchmark on Elliptic Curve group 𝔾1 (batch ops) - CC compiler":
|
2022-10-29 22:43:40 +02:00
|
|
|
|
runBench("bench_ec_g1_batch")
|
|
|
|
|
|
2023-02-16 12:45:05 +01:00
|
|
|
|
# Elliptic curve G1 - scalar multiplication
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g1_scalar_mul, "Run benchmark on Elliptic Curve group 𝔾1 (Scalar Multiplication) - CC compiler":
|
2023-02-16 12:45:05 +01:00
|
|
|
|
runBench("bench_ec_g1_scalar_mul")
|
|
|
|
|
|
|
|
|
|
# Elliptic curve G1 - Multi-scalar-mul
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-06-04 17:41:54 +02:00
|
|
|
|
task bench_ec_g1_msm_pasta, "Run benchmark on Elliptic Curve group 𝔾1 (Multi-Scalar-Mul) for Pasta curves - CC compiler":
|
|
|
|
|
runBench("bench_ec_g1_msm_pasta")
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g1_msm_bn254_snarks, "Run benchmark on Elliptic Curve group 𝔾1 (Multi-Scalar-Mul) for BN254-Snarks - CC compiler":
|
2023-02-16 12:45:05 +01:00
|
|
|
|
runBench("bench_ec_g1_msm_bn254_snarks")
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g1_msm_bls12_381, "Run benchmark on Elliptic Curve group 𝔾1 (Multi-Scalar-Mul) for BLS12-381 - CC compiler":
|
2023-02-16 12:45:05 +01:00
|
|
|
|
runBench("bench_ec_g1_msm_bls12_381")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Elliptic curve G2
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g2, "Run benchmark on Elliptic Curve group 𝔾2 - CC compiler":
|
2020-06-15 22:58:56 +02:00
|
|
|
|
runBench("bench_ec_g2")
|
|
|
|
|
|
2023-02-16 12:45:05 +01:00
|
|
|
|
# Elliptic curve G2 - scalar multiplication
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ec_g2_scalar_mul, "Run benchmark on Elliptic Curve group 𝔾2 (Multi-Scalar-Mul) - CC compiler":
|
2023-02-16 12:45:05 +01:00
|
|
|
|
runBench("bench_ec_g2_scalar_mul")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Pairings
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_pairing_bls12_377, "Run pairings benchmarks for BLS12-377 - CC compiler":
|
2020-09-27 09:15:14 +02:00
|
|
|
|
runBench("bench_pairing_bls12_377")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_pairing_bls12_381, "Run pairings benchmarks for BLS12-381 - CC compiler":
|
2020-09-24 17:18:23 +02:00
|
|
|
|
runBench("bench_pairing_bls12_381")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_pairing_bn254_nogami, "Run pairings benchmarks for BN254-Nogami - CC compiler":
|
2020-09-25 21:58:20 +02:00
|
|
|
|
runBench("bench_pairing_bn254_nogami")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_pairing_bn254_snarks, "Run pairings benchmarks for BN254-Snarks - CC compiler":
|
2020-09-25 21:58:20 +02:00
|
|
|
|
runBench("bench_pairing_bn254_snarks")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Curve summaries
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_summary_bls12_377, "Run summary benchmarks for BLS12-377 - CC compiler":
|
2021-02-14 14:24:48 +01:00
|
|
|
|
runBench("bench_summary_bls12_377")
|
|
|
|
|
|
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_summary_bls12_381, "Run summary benchmarks for BLS12-381 - CC compiler":
|
2021-02-14 14:24:48 +01:00
|
|
|
|
runBench("bench_summary_bls12_381")
|
|
|
|
|
|
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_summary_bn254_nogami, "Run summary benchmarks for BN254-Nogami - CC compiler":
|
2021-02-14 14:24:48 +01:00
|
|
|
|
runBench("bench_summary_bn254_nogami")
|
|
|
|
|
|
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_summary_bn254_snarks, "Run summary benchmarks for BN254-Snarks - CC compiler":
|
2021-02-14 14:24:48 +01:00
|
|
|
|
runBench("bench_summary_bn254_snarks")
|
|
|
|
|
|
2022-04-27 00:58:48 +02:00
|
|
|
|
# --
|
|
|
|
|
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_summary_pasta, "Run summary benchmarks for the Pasta curves - CC compiler":
|
2022-04-27 00:58:48 +02:00
|
|
|
|
runBench("bench_summary_pasta")
|
|
|
|
|
|
2021-02-14 14:24:48 +01:00
|
|
|
|
# Hashes
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
|
2020-12-15 19:18:36 +01:00
|
|
|
|
task bench_sha256, "Run SHA256 benchmarks":
|
|
|
|
|
runBench("bench_sha256")
|
2021-08-13 22:07:26 +02:00
|
|
|
|
|
|
|
|
|
# Hash-to-curve
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
task bench_hash_to_curve, "Run Hash-to-Curve benchmarks":
|
|
|
|
|
runBench("bench_hash_to_curve")
|
|
|
|
|
|
2022-02-26 21:22:34 +01:00
|
|
|
|
# BLS signatures
|
|
|
|
|
# ------------------------------------------
|
2023-04-26 06:58:31 +02:00
|
|
|
|
task bench_ethereum_bls_signatures, "Run Ethereum BLS signatures benchmarks - CC compiler":
|
2023-04-18 22:02:23 +02:00
|
|
|
|
runBench("bench_ethereum_bls_signatures")
|
2023-10-06 07:58:20 +00:00
|
|
|
|
|
|
|
|
|
# EIP 4844 - KZG Polynomial Commitments
|
|
|
|
|
# ------------------------------------------
|
|
|
|
|
task bench_ethereum_eip4844_kzg, "Run Ethereum EIP4844 KZG Polynomial commitment - CC compiler":
|
|
|
|
|
runBench("bench_ethereum_eip4844_kzg")
|