Safe Haskell | None |
---|---|
Language | Haskell2010 |
Lower-level bindings. Functions starting with blst_
are raw c2hs
bindings. Others are slightly higher level wrappers around those bindings.
See https://github.com/supranational/blst/tree/f791f7a465cda8ecda74df0a60778331dde40809#introductory-tutorial for a more comprehensive explanation of the functions declared here.
Synopsis
- keygen :: ByteArrayAccess ba => ba -> IO Scalar
- data BlstError
- blst_keygen :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO ()
- skToPkInG1 :: Scalar -> IO (Point 'P1)
- blst_sk_to_pk_in_g1 :: Ptr () -> Ptr () -> IO ()
- skToPkInG2 :: Scalar -> IO (Point 'P2)
- blst_sk_to_pk_in_g2 :: Ptr () -> Ptr () -> IO ()
- signPkInG1 :: Point 'P2 -> Scalar -> IO (Point 'P2)
- blst_sign_pk_in_g1 :: Ptr () -> Ptr () -> Ptr () -> IO ()
- signPkInG2 :: Point 'P1 -> Scalar -> IO (Point 'P1)
- blst_sign_pk_in_g2 :: Ptr () -> Ptr () -> Ptr () -> IO ()
- encodeToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1)
- blst_encode_to_g1 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO ()
- hashToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1)
- blst_hash_to_g1 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO ()
- encodeToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2)
- blst_encode_to_g2 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO ()
- hashToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2)
- blst_hash_to_g2 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO ()
- coreVerifyPkInG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => Affine 'P1 -> Affine 'P2 -> EncodeMethod -> ba -> Maybe ba2 -> IO BlstError
- blst_core_verify_pk_in_g1 :: Ptr () -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt
- coreVerifyPkInG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => Affine 'P2 -> Affine 'P1 -> EncodeMethod -> ba -> Maybe ba2 -> IO BlstError
- blst_core_verify_pk_in_g2 :: Ptr () -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt
- p1ToAffine :: Point 'P1 -> IO (Affine 'P1)
- blst_p1_to_affine :: Ptr () -> Ptr () -> IO ()
- p2ToAffine :: Point 'P2 -> IO (Affine 'P2)
- blst_p2_to_affine :: Ptr () -> Ptr () -> IO ()
- p1AffSerialize :: Affine 'P1 -> IO (SizedByteArray P1SerializeSize Bytes)
- blst_p1_affine_serialize :: Ptr CUChar -> Ptr () -> IO ()
- p1AffCompress :: Affine 'P1 -> IO (SizedByteArray P1CompressSize Bytes)
- blst_p1_affine_compress :: Ptr CUChar -> Ptr () -> IO ()
- p1Deserialize :: ByteArrayAccess ba => SizedByteArray P1SerializeSize ba -> IO (Either BlstError (Affine 'P1))
- blst_p1_deserialize :: Ptr () -> Ptr CUChar -> IO CInt
- p1Uncompress :: ByteArrayAccess ba => SizedByteArray P1CompressSize ba -> IO (Either BlstError (Affine 'P1))
- blst_p1_uncompress :: Ptr () -> Ptr CUChar -> IO CInt
- p2AffSerialize :: Affine 'P2 -> IO (SizedByteArray P2SerializeSize Bytes)
- blst_p2_affine_serialize :: Ptr CUChar -> Ptr () -> IO ()
- p2AffCompress :: Affine 'P2 -> IO (SizedByteArray P2CompressSize Bytes)
- blst_p2_affine_compress :: Ptr CUChar -> Ptr () -> IO ()
- p2Deserialize :: ByteArrayAccess ba => SizedByteArray P2SerializeSize ba -> IO (Either BlstError (Affine 'P2))
- blst_p2_deserialize :: Ptr () -> Ptr CUChar -> IO CInt
- p2Uncompress :: ByteArrayAccess ba => SizedByteArray P2CompressSize ba -> IO (Either BlstError (Affine 'P2))
- blst_p2_uncompress :: Ptr () -> Ptr CUChar -> IO CInt
- lendianFromScalar :: Scalar -> IO (SizedByteArray SkSerializeSize ScrubbedBytes)
- blst_lendian_from_scalar :: Ptr CUChar -> Ptr () -> IO ()
- scalarFromLendian :: ByteArrayAccess ba => SizedByteArray SkSerializeSize ba -> IO Scalar
- blst_scalar_from_lendian :: Ptr () -> Ptr CUChar -> IO ()
- p1AddOrDoubleAffine :: Point 'P1 -> Affine 'P1 -> IO (Point 'P1)
- blst_p1_add_or_double_affine :: Ptr () -> Ptr () -> Ptr () -> IO ()
- p2AddOrDoubleAffine :: Point 'P2 -> Affine 'P2 -> IO (Point 'P2)
- blst_p2_add_or_double_affine :: Ptr () -> Ptr () -> Ptr () -> IO ()
- p1FromAffine :: Affine 'P1 -> IO (Point 'P1)
- blst_p1_from_affine :: Ptr () -> Ptr () -> IO ()
- p2FromAffine :: Affine 'P2 -> IO (Point 'P2)
- blst_p2_from_affine :: Ptr () -> Ptr () -> IO ()
- pairingChkNAggrPkInG1 :: ByteArrayAccess ba => PairingCtx -> Affine 'P1 -> Bool -> Maybe (Affine 'P2) -> Bool -> ba -> IO BlstError
- blst_pairing_chk_n_aggr_pk_in_g1 :: Ptr () -> Ptr () -> CUChar -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt
- pairingChkNAggrPkInG2 :: ByteArrayAccess ba => PairingCtx -> Affine 'P2 -> Bool -> Maybe (Affine 'P1) -> Bool -> ba -> IO BlstError
- blst_pairing_chk_n_aggr_pk_in_g2 :: Ptr () -> Ptr () -> CUChar -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt
- pairingInit :: ByteArrayAccess ba => EncodeMethod -> Maybe ba -> IO PairingCtx
- blst_pairing_sizeof :: IO CULong
- blst_pairing_init :: Ptr () -> CUChar -> Ptr CUChar -> CULong -> IO ()
- pairingCommit :: PairingCtx -> IO ()
- blst_pairing_commit :: Ptr () -> IO ()
- pairingFinalVerify :: PairingCtx -> IO Bool
- blst_pairing_finalverify :: Ptr () -> Ptr () -> IO CUChar
- module Crypto.BLST.Internal.Bindings.Types
Documentation
Possible C return values.
BlstSuccess | |
BlstBadEncoding | |
BlstPointNotOnCurve | |
BlstPointNotInGroup | |
BlstAggrTypeMismatch | |
BlstVerifyFail | |
BlstPkIsInfinity | |
BlstBadScalar |
Instances
Bounded BlstError Source # | |
Enum BlstError Source # | Generate secret key from bytes. Input must be at least 32 bytes long. |
Defined in Crypto.BLST.Internal.Bindings succ :: BlstError -> BlstError # pred :: BlstError -> BlstError # fromEnum :: BlstError -> Int # enumFrom :: BlstError -> [BlstError] # enumFromThen :: BlstError -> BlstError -> [BlstError] # enumFromTo :: BlstError -> BlstError -> [BlstError] # enumFromThenTo :: BlstError -> BlstError -> BlstError -> [BlstError] # | |
Exception BlstError Source # | |
Defined in Crypto.BLST.Internal.Bindings toException :: BlstError -> SomeException # fromException :: SomeException -> Maybe BlstError # displayException :: BlstError -> String # | |
Show BlstError Source # | |
Eq BlstError Source # | |
encodeToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1) Source #
Encode bytes to a point in G1.
blst_encode_to_g1 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO () Source #
hashToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1) Source #
Hash bytes to a point in G1.
blst_hash_to_g1 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO () Source #
encodeToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2) Source #
Encode bytes to a point in G2.
blst_encode_to_g2 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO () Source #
hashToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2) Source #
Hash bytes to a point in G2.
blst_hash_to_g2 :: Ptr () -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO () Source #
:: (ByteArrayAccess ba, ByteArrayAccess ba2) | |
=> Affine 'P1 | Public key |
-> Affine 'P2 | Signature |
-> EncodeMethod | Was message encoded or hashed to the curve |
-> ba | Message |
-> Maybe ba2 | Optional domain separation tag |
-> IO BlstError |
Core signature verification function in G1.
blst_core_verify_pk_in_g1 :: Ptr () -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt Source #
:: (ByteArrayAccess ba, ByteArrayAccess ba2) | |
=> Affine 'P2 | Public key |
-> Affine 'P1 | Signature |
-> EncodeMethod | Was message encoded or hashed to the curve |
-> ba | Message |
-> Maybe ba2 | Optional domain separation tag |
-> IO BlstError |
Core signature verification function in G2.
blst_core_verify_pk_in_g2 :: Ptr () -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt Source #
p1AffSerialize :: Affine 'P1 -> IO (SizedByteArray P1SerializeSize Bytes) Source #
Serialize affine G1 point.
p1AffCompress :: Affine 'P1 -> IO (SizedByteArray P1CompressSize Bytes) Source #
Serialize and compress affine G1 point.
p1Deserialize :: ByteArrayAccess ba => SizedByteArray P1SerializeSize ba -> IO (Either BlstError (Affine 'P1)) Source #
Deserialize affine G1 point.
p1Uncompress :: ByteArrayAccess ba => SizedByteArray P1CompressSize ba -> IO (Either BlstError (Affine 'P1)) Source #
Deserialize and decompress affine G1 point.
p2AffSerialize :: Affine 'P2 -> IO (SizedByteArray P2SerializeSize Bytes) Source #
Serialize affine G2 point.
p2AffCompress :: Affine 'P2 -> IO (SizedByteArray P2CompressSize Bytes) Source #
Serialize and compress affine G2 point.
p2Deserialize :: ByteArrayAccess ba => SizedByteArray P2SerializeSize ba -> IO (Either BlstError (Affine 'P2)) Source #
Deserialize affine G2 point.
p2Uncompress :: ByteArrayAccess ba => SizedByteArray P2CompressSize ba -> IO (Either BlstError (Affine 'P2)) Source #
Deserialize and decompress affine G2 point.
lendianFromScalar :: Scalar -> IO (SizedByteArray SkSerializeSize ScrubbedBytes) Source #
Get scalar bytes in little endian order.
scalarFromLendian :: ByteArrayAccess ba => SizedByteArray SkSerializeSize ba -> IO Scalar Source #
Build scalar from bytes in little endian order.
p1AddOrDoubleAffine :: Point 'P1 -> Affine 'P1 -> IO (Point 'P1) Source #
Add affine point to point in G1.
p2AddOrDoubleAffine :: Point 'P2 -> Affine 'P2 -> IO (Point 'P2) Source #
Add affine point to point in G2.
pairingChkNAggrPkInG1 Source #
:: ByteArrayAccess ba | |
=> PairingCtx | Pairing context. Use |
-> Affine 'P1 | Public key |
-> Bool | Check public key group? |
-> Maybe (Affine 'P2) | Signature. Only the first call per pairing context specifies the
signature, all consequent calls for the same context should use |
-> Bool | Check signature group? |
-> ba | Message |
-> IO BlstError |
Check aggregate signature in G1.
blst_pairing_chk_n_aggr_pk_in_g1 :: Ptr () -> Ptr () -> CUChar -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt Source #
pairingChkNAggrPkInG2 Source #
:: ByteArrayAccess ba | |
=> PairingCtx | Pairing context. Use |
-> Affine 'P2 | Public key |
-> Bool | Check public key group? |
-> Maybe (Affine 'P1) | Signature. Only the first call per pairing context specifies the
signature, all consequent calls for the same context should use |
-> Bool | Check signature group? |
-> ba | Message |
-> IO BlstError |
Check aggregate signature in G2.
blst_pairing_chk_n_aggr_pk_in_g2 :: Ptr () -> Ptr () -> CUChar -> Ptr () -> CUChar -> Ptr CUChar -> CULong -> Ptr CUChar -> CULong -> IO CInt Source #
pairingInit :: ByteArrayAccess ba => EncodeMethod -> Maybe ba -> IO PairingCtx Source #
Make new pairing context.
pairingCommit :: PairingCtx -> IO () Source #
Commit pairing context.
blst_pairing_commit :: Ptr () -> IO () Source #
pairingFinalVerify :: PairingCtx -> IO Bool Source #
Verify pairing context.