Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

depends: commit relic-toolkit/relic@4140f28e to source tree #93

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ else()
set(FP_QNRES "on" CACHE STRING "")
endif()

set(FP_METHD "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE" CACHE STRING "")
set(FP_METHD "INTEG;INTEG;INTEG;MONTY;MONTY;JMPDS;SLIDE" CACHE STRING "")

if(MSVC)
set(COMP_FLAGS "" CACHE STRING "")
Expand Down
16 changes: 13 additions & 3 deletions Makefile.relic.include
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ BN_SOURCES = \
depends/relic/src/bn/relic_bn_factor.c \
depends/relic/src/bn/relic_bn_gcd.c \
depends/relic/src/bn/relic_bn_inv.c \
depends/relic/src/bn/relic_bn_lag.c \
depends/relic/src/bn/relic_bn_lcm.c \
depends/relic/src/bn/relic_bn_mem.c \
depends/relic/src/bn/relic_bn_mod.c \
Expand All @@ -83,6 +84,7 @@ FP_SOURCES = \
depends/relic/src/fp/relic_fp_mul.c \
depends/relic/src/fp/relic_fp_param.c \
depends/relic/src/fp/relic_fp_prime.c \
depends/relic/src/fp/relic_fp_smb.c \
depends/relic/src/fp/relic_fp_rdc.c \
depends/relic/src/fp/relic_fp_shift.c \
depends/relic/src/fp/relic_fp_sqr.c \
Expand Down Expand Up @@ -271,6 +273,7 @@ MD_SOURCES = \

EXTRA_DIST += \
depends/relic/src/arch/relic_arch_arm.c \
depends/relic/src/arch/relic_arch_a64.c \
depends/relic/src/arch/relic_arch_none.c \
depends/relic/src/arch/relic_arch_x64.c \
depends/relic/src/arch/relic_arch_x86.c
Expand All @@ -296,7 +299,8 @@ RELIC_SOURCES += $(BN_SOURCES) \
depends/relic/src/low/easy/relic_bn_mod_low.c \
depends/relic/src/low/easy/relic_bn_mul_low.c \
depends/relic/src/low/easy/relic_bn_shift_low.c \
depends/relic/src/low/easy/relic_bn_sqr_low.c
depends/relic/src/low/easy/relic_bn_sqr_low.c \
depends/relic/src/low/easy/relic_fp_smb_low.c
endif

if WITH_FP
Expand Down Expand Up @@ -427,12 +431,17 @@ RELIC_SOURCES += \
depends/relic/src/cp/relic_cp_ibe.c \
depends/relic/src/cp/relic_cp_mklhs.c \
depends/relic/src/cp/relic_cp_mpss.c \
depends/relic/src/cp/relic_cp_pbpsi.c \
depends/relic/src/cp/relic_cp_pcdel.c \
depends/relic/src/cp/relic_cp_phpe.c \
depends/relic/src/cp/relic_cp_pok.c \
depends/relic/src/cp/relic_cp_pss.c \
depends/relic/src/cp/relic_cp_rabin.c \
depends/relic/src/cp/relic_cp_rsa.c \
depends/relic/src/cp/relic_cp_rsapsi.c \
depends/relic/src/cp/relic_cp_shipsi.c \
depends/relic/src/cp/relic_cp_shpe.c \
depends/relic/src/cp/relic_cp_smlers.c \
depends/relic/src/cp/relic_cp_sok.c \
depends/relic/src/cp/relic_cp_sokaka.c \
depends/relic/src/cp/relic_cp_vbnn.c \
Expand All @@ -454,8 +463,9 @@ endif

if WITH_MPC
RELIC_SOURCES += \
depends/relic/src/mpc/relic_mt_mpc.c \
depends/relic/src/mpc/relic_pc_mpc.c
depends/relic/src/mpc/relic_mpc_sss.c \
depends/relic/src/mpc/relic_mpc_mt.c \
depends/relic/src/mpc/relic_mpc_pc.c
endif

librelic_la_SOURCES = \
Expand Down
175 changes: 123 additions & 52 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,13 @@ fi
dnl Define enum mappings for relic config
AC_DEFINE([RLC_VERSION], ["0.5.0"], [Relic Version])

dnl dashbls: Library processor architecture
dnl Relic: Library processor architecture
AC_DEFINE([AVR], [1], [Atmel AVR ATMega128 8-bit architecture.])
AC_DEFINE([MSP], [2], [MSP430 16-bit architecture.])
AC_DEFINE([ARM], [3], [ARM 32-bit architecture.])
AC_DEFINE([X86], [4], [Intel x86-compatible 32-bit architecture.])
AC_DEFINE([X64], [5], [AMD64-compatible 64-bit architecture.])
AC_DEFINE([A64], [4], [ARM 64-bit architecture.])
AC_DEFINE([X86], [5], [Intel x86-compatible 32-bit architecture.])
AC_DEFINE([X64], [6], [AMD64-compatible 64-bit architecture.])

dnl Relic: Generic options
AC_DEFINE([RELIC_NONE], [0], [Unknown or unrecognized parameter.])
Expand Down Expand Up @@ -247,11 +248,11 @@ AC_DEFINE([PTHREAD], [2], [POSIX multithreading support.])
dnl Relic: Supported operating systems
AC_DEFINE([LINUX], [1], [GNU/Linux operating system.])
AC_DEFINE([FREEBSD], [2], [FreeBSD operating system.])
AC_DEFINE([MACOSX], [3], [MacOS operating system.])
AC_DEFINE([WINDOWS], [4], [Windows operating system.])
AC_DEFINE([DROID], [5], [Android operating system.])
AC_DEFINE([DUINO], [6], [Arduino platform.])
dnl AC_DEFINE([OPENBSD], [7], [OpenBSD operating system.])
AC_DEFINE([NETBSD], [3], [NetBSD operating system.])
AC_DEFINE([MACOSX], [4], [MacOS operating system.])
AC_DEFINE([WINDOWS], [5], [Windows operating system.])
AC_DEFINE([DROID], [6], [Android operating system.])
AC_DEFINE([DUINO], [7], [Arduino platform.])

dnl Relic: Supported timers
AC_DEFINE([HREAL], [1], [Per-process high-resolution timer.])
Expand All @@ -266,10 +267,116 @@ dnl Relic: Memory-allocation policies
AC_DEFINE([AUTO], [1], [Automatic memory allocation.])
AC_DEFINE([DYNAMIC], [2], [Dynamic memory allocation.])

dnl Relic (BN): Options for the multiple precision
AC_DEFINE([SINGLE], [1], [A multiple precision integer can store w words.])
AC_DEFINE([CARRY], [2], [A multiple precision integer can store the result of an addition.])
AC_DEFINE([DOUBLE], [3], [A multiple precision integer can store the result of a multiplication.])

dnl Relic (BN): Greatest Common Divisor
dnl AC_DEFINE([BASIC], [1], [Euclid's standard GCD algorithm.])
dnl AC_DEFINE([BINAR], [2], [Binary GCD algorithm.])
AC_DEFINE([LEHME], [3], [Lehmer's fast GCD Algorithm.])

dnl Relic (BN): Integer multiplication
dnl AC_DEFINE([BASIC], [1], [Schoolbook multiplication.])
dnl AC_DEFINE([COMBA], [3], [Comba multiplication.])

dnl Relic (BN): Integer squaring
dnl AC_DEFINE([BASIC], [1], [Schoolbook squaring.])
dnl AC_DEFINE([COMBA], [3], [Comba squaring.])
dnl AC_DEFINE([MULTP], [4], [Reuse multiplication for squaring.])

dnl Relic (BN): Modular exponentiation
dnl AC_DEFINE([BASIC], [1], [Binary modular exponentiation.])
AC_DEFINE([SLIDE], [2], [Sliding window modular exponentiation.])
dnl AC_DEFINE([MONTY], [9], [Sliding window modular exponentiation.])

dnl Relic (BN): Prime generation
dnl AC_DEFINE([BASIC], [1], [Basic prime generation.])
AC_DEFINE([SAFEP], [2], [Safe prime generation.])
AC_DEFINE([STRON], [3], [Strong prime generation.])

dnl Relic (CP): Support for faster CRT-based exponentiation in factoring-based cryptosystems
AC_DEFINE([PKCS1], [2], [RSA PKCS#1 v1.5 padding.])
AC_DEFINE([PKCS2], [3], [RSA PKCS#1 v2.1 padding.])

dnl Relic (EB): Fixed-base scalar multiplication
dnl AC_DEFINE([BASIC], [1], [Binary method for fixed point multiplication.])
AC_DEFINE([COMBS], [2], [Single-table Comb method for fixed point multiplication.])
AC_DEFINE([COMBD], [3], [Double-table Comb method for fixed point multiplication.])
AC_DEFINE([LWNAF], [4], [Left-to-right window (T)NAF method.])

dnl Relic (EB): Point representation
dnl AC_DEFINE([BASIC], [1], [Affine coordinates.])
AC_DEFINE([PROJC], [2], [Projective coordinates.])

dnl Relic (EB): Variable-base scalar multiplication
dnl AC_DEFINE([BASIC], [1], [Binary double-and-add method.])
AC_DEFINE([LODAH], [2], [Lopez-Dahab constant-time point multiplication.])
dnl AC_DEFINE([LWNAF], [4], [Left-to-right window (T)NAF method.])
AC_DEFINE([RWNAF], [3], [Right-to-left window (T)NAF method.])
AC_DEFINE([HALVE], [5], [Halving method.])

dnl Relic (EB): Variable-base simultaneous scalar multiplication
dnl AC_DEFINE([BASIC], [1], [Multiplication-and-addition simultaneous multiplication.])
AC_DEFINE([TRICK], [2], [Shamir's trick.])
AC_DEFINE([INTER], [3], [Interleaving of w-(T)NAFs.])
AC_DEFINE([JOINT], [4], [Joint sparse form.])

dnl Relic (EC): Available elliptic curve methods
AC_DEFINE([PRIME], [1], [Prime curves.])
AC_DEFINE([CHAR2], [2], [Binary curves.])
AC_DEFINE([EDDIE], [3], [Prime Edwards curves.])

dnl Relic (EC): Prime elliptic Edwards curve methods
dnl AC_DEFINE([BASIC], [1], [Affine coordinates.])
dnl AC_DEFINE([PROJC], [2], [Simple projective twisted Edwards coordinates.])
AC_DEFINE([EXTND], [3], [Extended projective twisted Edwards coordinates.])

dnl Relic (ED): Variable-base multiplication method
dnl AC_DEFINE([BASIC], [1], [Binary method.])
dnl AC_DEFINE([SLIDE], [2], [Sliding window method.])
dnl AC_DEFINE([MONTY], [9], [Montgomery ladder method.])
dnl AC_DEFINE([LWNAF], [4], [Left-to-right window NAF method.])
AC_DEFINE([LWREG], [5], [Left-to-right regular recoding method.])

dnl Relic (EP): Point representation
dnl AC_DEFINE([BASIC], [1], [Affine coordinates.])
dnl AC_DEFINE([PROJC], [2], [Homogeneous projective coordinates (complete formula).])
AC_DEFINE([JACOB], [3], [Jacobian coordinates.])

dnl Relic (FB): Field inversion
dnl AC_DEFINE([BASIC], [1], [Inversion by Fermat's Little Theorem.])
AC_DEFINE([BINAR], [2], [Binary Inversion algorithm.])
AC_DEFINE([ALMOS], [3], [Inversion by the Amost inverse algorithm.])
AC_DEFINE([EXGCD], [4], [Inversion by the Extended Euclidean algorithm.])
AC_DEFINE([ITOHT], [5], [Inversion by Itoh-Tsuji.])
AC_DEFINE([CTAIA], [6], [Constant-time almost inversion algorithm.])
AC_DEFINE([BRUCH], [7], [Hardware-friendly inversion by Brunner-Curiger-Hofstetter.])
AC_DEFINE([LOWER], [8], [Pass inversion to the lower level.])

dnl Relic (FP): Field inversion
dnl AC_DEFINE([BASIC], [1], [Inversion by Fermat's Little Theorem.])
dnl AC_DEFINE([BINAR], [2], [Binary Inversion algorithm.])
AC_DEFINE([MONTY], [9], [Montgomery inversion.])
dnl AC_DEFINE([EXGCD], [4], [Inversion by the Extended Euclidean algorithm.])
dnl AC_DEFINE([LOWER], [8], [Pass inversion to the lower level.])
AC_DEFINE([DIVST], [10], [Constant-time inversion by division steps.])

dnl Relic (FP): Field squaring
AC_DEFINE([BASIC], [1], [Schoolbook multiplication.])
AC_DEFINE([INTEG], [2], [Integrated modular squaring.])
AC_DEFINE([COMBA], [3], [Comba squaring.])
AC_DEFINE([MULTP], [4], [Reuse multiplication for squaring.])

dnl Relic (FP): Modular reduction
dnl AC_DEFINE([BASIC], [1], [Division-based reduction.])
AC_DEFINE([QUICK], [2], [Fast reduction modulo special form prime.])
dnl AC_DEFINE([MONTY], [9], [Montgomery modular reduction.])

dnl Relic (FP): Preferences
AC_DEFINE([PMERS], [4], [Pseudo-Mersenne method.])

dnl Relic (MD): Available hash functions
AC_DEFINE([SH224], [2], [SHA-224 hash function.])
AC_DEFINE([SH256], [3], [SHA-256 hash function.])
Expand All @@ -290,50 +397,14 @@ dnl AC_DEFINE([RDRND], [2], [Intel RdRand instruction.])
dnl AC_DEFINE([UDEV], [3], [Operating system underlying generator.])
AC_DEFINE([WCGR], [4], [Use Windows' CryptGenRandom.])

dnl Relic (BN): Options for the multiple precision
AC_DEFINE([SINGLE], [1], [A multiple precision integer can store w words.])
AC_DEFINE([CARRY], [2], [A multiple precision integer can store the result of an addition.])
AC_DEFINE([DOUBLE], [3], [A multiple precision integer can store the result of a multiplication.])
dnl Relic (PP): Extension field arithmetic
dnl AC_DEFINE([BASIC], [1], [Basic extension field arithmetic.])
AC_DEFINE([LAZYR], [2], [Lazy-reduced extension field arithmetic.])

AC_DEFINE([BASIC], [1], [Basic method.])
AC_DEFINE([PRIME], [1], [Prime curves.])
dnl Relic (PP): Pairing computation
AC_DEFINE([TATEP], [1], [Tate pairing.])
AC_DEFINE([COMBA], [2], [Comba method.])
AC_DEFINE([LEHME], [2], [Lehmer's fast GCD Algorithm.])
AC_DEFINE([SAFEP], [2], [Safe prime generation.])
AC_DEFINE([QUICK], [2], [Fast reduction modulo special form prime.])
AC_DEFINE([BINAR], [2], [Binary inversion.])
AC_DEFINE([LAZYR], [2], [Lazy-reduced extension field arithmetic.])
AC_DEFINE([LODAH], [2], [Lopez-Dahab multiplication.])
AC_DEFINE([SLIDE], [2], [Sliding window modular exponentiation.])
AC_DEFINE([PROJC], [2], [Projective coordinates.])
AC_DEFINE([COMBS], [2], [Single-table comb method.])
AC_DEFINE([TRICK], [2], [Shamir's trick.])
AC_DEFINE([CHAR2], [2], [Binary curves.])
AC_DEFINE([WEILP], [2], [Weil pairing.])
AC_DEFINE([MONTY], [3], [Montgomery method.])
AC_DEFINE([STEIN], [3], [Stein's binary GCD Algorithm.])
AC_DEFINE([STRON], [3], [Strong prime generation.])
AC_DEFINE([INTEG], [3], [Integrated modular addtion.])
AC_DEFINE([INTER], [3], [Interleaving of w-(T)NAFs.])
AC_DEFINE([ALMOS], [3], [Almost inverse algorithm.])
AC_DEFINE([JACOB], [3], [Jacobian coordinates.])
AC_DEFINE([COMBD], [3], [Double-table comb method.])
AC_DEFINE([HALVE], [3], [Halving.])
AC_DEFINE([EDDIE], [3], [Edwards curves.])
AC_DEFINE([EXTND], [3], [Extended projective twisted Edwards coordinates.])
AC_DEFINE([OATEP], [3], [Optimal ate pairing.])
AC_DEFINE([PMERS], [4], [Pseudo-Mersenne method.])
AC_DEFINE([MULTP], [4], [Reuse multiplication for squaring.])
AC_DEFINE([EXGCD], [4], [Extended Euclidean algorithm.])
AC_DEFINE([LWNAF], [4], [Left-to-right Width-w NAF.])
AC_DEFINE([JOINT], [4], [Joint sparse form.])
AC_DEFINE([DIVST], [5], [Constant-time inversion by Bernstein-Yang division steps.])
AC_DEFINE([ITOHT], [5], [Itoh-Tsuji inversion.])
AC_DEFINE([LWREG], [5], [Left-to-right Width-w NAF.])
AC_DEFINE([BRUCH], [6], [Hardware-friendly inversion by Brunner-Curiger-Hofstetter.])
AC_DEFINE([CTAIA], [7], [Constant-time version of almost inverse.])
AC_DEFINE([LOWER], [8], [Use implementation provided by the lower layer.])

if test x"$use_debug" = x"yes"; then
AC_DEFINE([DEBUG], [1], [Define this symbol if debugging support is enabled])
Expand Down Expand Up @@ -419,9 +490,8 @@ if [[[ "$host_cpu" == x86_64 && "$use_optimizations" == "yes" ]]]; then
AC_DEFINE([WSIZE], [64], [Size of word in this architecture.])
elif [[[ "$host_cpu" == aarch* && "$use_optimizations" == "yes" ]]]; then
dnl Support for 64-bit ARM processors
dnl Relic doesn't support aarch64 yet, set CPU_ARCH to none and ARCH to RELIC_NONE.
CPU_ARCH="none"
AC_DEFINE([ARCH], [RELIC_NONE], [Architecture.])
CPU_ARCH="a64"
AC_DEFINE([ARCH], [A64], [Architecture.])
AC_DEFINE([WSIZE], [64], [Size of word in this architecture.])
elif [[[ "$host_cpu" == i?86 && "$use_optimizations" == "yes" ]]]; then
dnl Support for Intel x86 processors
Expand Down Expand Up @@ -584,14 +654,15 @@ AC_DEFINE(BN_GCD, BASIC, Chosen multiple precision greatest common divisor metho
AC_DEFINE(BN_GEN, BASIC, Chosen prime generation algorithm.)

AC_DEFINE(FP_PRIME, 381, Prime field size in bits.)
AC_DEFINE(FP_METHD, "INTEG;INTEG;INTEG;MONTY;LOWER;SLIDE", Prime field arithmetic method.)
AC_DEFINE(FP_METHD, "INTEG;INTEG;INTEG;MONTY;MONTY;JMPDS;SLIDE", Prime field arithmetic method.)
AC_DEFINE(FP_KARAT, 0, Number of Karatsuba steps.)
AC_DEFINE(FP_WIDTH, 4, Width of window processing for exponentiation methods.)
AC_DEFINE(FP_ADD, INTEG, Chosen prime field multiplication method.)
AC_DEFINE(FP_MUL, INTEG, Chosen prime field multiplication method.)
AC_DEFINE(FP_SQR, INTEG, Chosen prime field multiplication method.)
AC_DEFINE(FP_RDC, MONTY, Chosen prime field reduction method.)
AC_DEFINE(FP_INV, LOWER, Chosen prime field inversion method.)
AC_DEFINE(FP_SMB, JMPDS, Chosen prime field Legendre symbol.)
AC_DEFINE(FP_EXP, SLIDE, Chosen multiple precision modular exponentiation method.)

AC_DEFINE(FPX_METHD, "INTEG;INTEG;LAZYR", Prime extension field arithmetic method.)
Expand Down
13 changes: 4 additions & 9 deletions depends/relic/.github/workflows/bls12-381.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,6 @@ jobs:
os: ubuntu-latest,
cc: "clang",
}
- {
name: "MacOS Latest",
os: macos-latest,
cc: "clang",
}
steps:
- uses: actions/checkout@v2

Expand Down Expand Up @@ -70,17 +65,17 @@ jobs:
mkdir build
cd build
cmake -G "MinGW Makefiles" ..
../preset/x64-pbc-bls12-381.sh .
cmake -DSEED= -DBENCH=0 -DSTBIN=off -DRAND=HASHD .
cmake -DSEED= -DBENCH=0 -DSTBIN=off -DRAND=HASHD ..
../preset/x64-pbc-bls12-381.sh ..

- name: Run CMake (standard)
if: ${{ !(runner.os == 'Windows') }}
shell: bash
run: |
mkdir build
cd build
../preset/x64-pbc-bls12-381.sh ../
cmake -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DSEED= -DBENCH=0 .
cmake -DCMAKE_C_COMPILER=${{ matrix.config.cc }} -DSEED= -DBENCH=0 ..
../preset/x64-pbc-bls12-381.sh ..

- name: CMake Build
run: cmake --build build
Expand Down
Loading
Loading