status-im / nim-blscurve

Nim implementation of BLS signature scheme (Boneh-Lynn-Shacham) over Barreto-Lynn-Scott (BLS) curve BLS12-381
Apache License 2.0
26 stars 11 forks source link

Consolidate internal backend API and implement #90 #100

Closed mratsim closed 3 years ago

mratsim commented 3 years ago

In this PR, BLST and Miracl expose the exact same internal API for BLS "core" operation as in the spec https://datatracker.ietf.org/doc/draft-irtf-cfrg-bls-signature/

In particular coreSign was in-place for one and out-of-place for the other:

https://github.com/status-im/nim-blscurve/blob/4a0f354dee1b359bbe55f9a23a232d85af70af4b/blscurve/blst/bls_sig_min_pubkey_size_pop.nim#L324-L343

https://github.com/status-im/nim-blscurve/blob/4a0f354dee1b359bbe55f9a23a232d85af70af4b/blscurve/miracl/bls_signature_scheme.nim#L223-L240

The ContextCoreAggregateVerify has also been rework to workaround differences in BLST requiring the domain separation tag at init and in Miracl in "update" as a static string.

This allows an unified high-level API building on the same internal backend API instead of duplicating code.

Also subgroup check caching #90 has been implemented for Miracl.