github.com/onflow/flow-go/crypto@v0.24.8/bls_include.h (about) 1 // +build relic 2 3 // this file is about the core functions required by the BLS signature scheme 4 5 #ifndef _REL_BLS_INCLUDE_H 6 #define _REL_BLS_INCLUDE_H 7 8 #include "relic.h" 9 #include "bls12381_utils.h" 10 11 // Signature, Public key and Private key lengths 12 #define FULL_SIGNATURE_LEN G1_BYTES 13 #define FULL_PK_LEN G2_BYTES 14 #define SIGNATURE_LEN (FULL_SIGNATURE_LEN/(G1_SERIALIZATION+1)) 15 #define PK_LEN (FULL_PK_LEN/(G2_SERIALIZATION+1)) 16 #define SK_BITS (Fr_BITS) 17 #define SK_LEN BITS_TO_BYTES(SK_BITS) 18 19 // Simultaneous Pairing in verification 20 #define DOUBLE_PAIRING 1 21 #define SINGLE_PAIRING (DOUBLE_PAIRING^1) 22 23 // Signature and public key membership check 24 #define MEMBERSHIP_CHECK 1 25 26 // algorithm choice for the hashing to G1 27 // both methods are similar implementations of the same optimzed SSWU 28 // but offer different timings. 29 #define RELIC_SSWU 1 // relic library implementation 30 #define LOCAL_SSWU 2 // local implementation 31 #define hashToPoint LOCAL_SSWU 32 33 // bls core (functions in bls_core.c) 34 int get_signature_len(); 35 int get_pk_len(); 36 int get_sk_len(); 37 38 void bls_sign(byte*, const bn_t, const byte*, const int); 39 int bls_verify(const ep2_t, const byte*, const byte*, const int); 40 int bls_verifyPerDistinctMessage(const byte*, const int, const byte*, const uint32_t*, 41 const uint32_t*, const ep2_st*); 42 int bls_verifyPerDistinctKey(const byte*, 43 const int, const ep2_st*, const uint32_t*, 44 const byte*, const uint32_t*); 45 void bls_batchVerify(const int, byte*, const ep2_st*, 46 const byte*, const byte*, const int); 47 48 #endif