12 Commits

Author SHA1 Message Date
Csaba Kiraly
0c5a581c5a
parametrize sectorsblock and querylen
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:12 -06:00
Csaba Kiraly
b08901c73c
sectorsperblock should be an external parameter
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:12 -06:00
Csaba Kiraly
355d0d2ab8
use blst_p1_add_or_double instead of blst_p1_add
blst exposes two add functions: one that works for the corner case
of doubling, and one that isn't. It seems safer to use the one that
works, even if it is highly improbable in these cases that doubling
would occur.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:12 -06:00
Csaba Kiraly
6ff0031293
speed up tag generation by a factor of s
Scalar multiplications in tag generation can be rearranged
to benefit from the way random points are being generated.
Since random points are themselves generated using scalar
multiplication and the base is common, the sum of multiplications
becomes a single multiplication with the scalar sum, resulting in
a nice speedup.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Csaba Kiraly
05e343a039
add optimized verifyPairing implementation
When verifying two pairings, one final exponentiation
can be spared through the use of cneg.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Csaba Kiraly
6104782618
exchange parameter order in pairing
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Csaba Kiraly
b44cb86800
change random number generator to a secure one
Use Rng based on BrHmacDrbgContext

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Csaba Kiraly
6b8c732fe0
add verifyPairings abstraction
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Csaba Kiraly
5eb2408c16
fixing DST tag in hashToG1
The DST tag should be unique to achieve domain separation
of hash functions as defined in:
https://tools.ietf.org/id/draft-irtf-cfrg-hash-to-curve-06.html#domain-separation

Changed DST tag to one that indicates the PoC status of this code.

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:11 -06:00
Tanguy
09996476de
fix getSector 2022-01-17 11:26:10 -06:00
Csaba Kiraly
998aad6378
improve documentation of BLS scheme
Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:10 -06:00
Csaba Kiraly
5ee331ac75
draft version of bls proofs
Implementation of the BLS-based public PoS scheme from
Shacham H., Waters B., "Compact Proofs of Retrievability"
using pairing over BLS12-381 ECC

Signed-off-by: Csaba Kiraly <csaba.kiraly@gmail.com>
2022-01-17 11:26:10 -06:00