por: select backend and curve using defines

The implementation supports two backends:
 - BLST (default)
 - Constantine (-d:por_backend_constantine)

The implementation supports PoR over the following curves:
 - BLS12-381 (default)
 - BN254_Starks (use -d:por_backend_constantine -d:por_curve_bn254)

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
This commit is contained in:
Csaba Kiraly 2022-05-24 14:27:32 +02:00
parent c05f0552a1
commit 71a1dc6375
No known key found for this signature in database
GPG Key ID: 0FE274EE8C95166E
2 changed files with 20 additions and 5 deletions

View File

@ -11,6 +11,9 @@
# Shacham H., Waters B., "Compact Proofs of Retrievability"
# using pairing over BLS12-381 ECC
# use BLS12_381 curve by default.
# Specify -d:por_curve_bn254 to use BN254_Snarks
import
constantine,
# constantine/platforms/abstractions,
@ -38,8 +41,10 @@ when defined(debugConstantine):
export `$`
#set up curve and G1/G2
#const C = BN254_Snarks
const C = BLS12_381
when defined(por_curve_bn254):
const C = BN254_Snarks
else:
const C = BLS12_381
type
ec_SecretKey* = SecretKey

View File

@ -9,7 +9,15 @@
# Implementation of the BLS-based public PoS scheme from
# Shacham H., Waters B., "Compact Proofs of Retrievability"
# using pairing over BLS12-381 ECC
# using pairing over the BLS12-381 ECC or BN254_Starks
#
# The implementation supports two backends:
# - BLST (default)
# - Constantine (-d:por_backend_constantine)
#
# The implementation supports PoR over the following curves:
# - BLS12-381 (default)
# - BN254_Starks (use -d:por_backend_constantine -d:por_curve_bn254)
#
# Notation from the paper
# In Z:
@ -82,8 +90,10 @@
# - blst supports only the BLS12-381 curve
# - constantine is more experimental, supports BLS and BN curves as well
# As of now configuration of backends is in the backend_* file itself
import ./backends/backend_blst
#import ./backends/backend_constantine
when defined(por_backend_constantine):
import ./backends/backend_constantine
else:
import ./backends/backend_blst
import ../rng
import endians