hsblst-0.0.2: Haskell bindings to BLST
Safe HaskellSafe-Inferred
LanguageHaskell2010

Crypto.BLST.Internal.Bindings

Description

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

Documentation

blst_p2_from_affine :: Ptr () -> Ptr () -> IO () Source #

blst_p1_from_affine :: Ptr () -> Ptr () -> IO () Source #

blst_p2_to_affine :: Ptr () -> Ptr () -> IO () Source #

blst_p1_to_affine :: Ptr () -> Ptr () -> IO () Source #

blst_sign_pk_in_g2 :: Ptr () -> Ptr () -> Ptr () -> IO () Source #

blst_sign_pk_in_g1 :: Ptr () -> Ptr () -> Ptr () -> IO () Source #

blst_sk_to_pk_in_g2 :: Ptr () -> Ptr () -> IO () Source #

blst_sk_to_pk_in_g1 :: Ptr () -> Ptr () -> IO () Source #

skToPkInG1 :: Scalar -> IO (Point 'P1) Source #

Convert scalar to a point in G1.

skToPkInG2 :: Scalar -> IO (Point 'P2) Source #

Convert scalar to a P2 point in G2.

signPkInG1 :: Point 'P2 -> Scalar -> IO (Point 'P2) Source #

Sign a message point in G1.

signPkInG2 :: Point 'P1 -> Scalar -> IO (Point 'P1) Source #

Sign a message point in G2.

encodeToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1) Source #

Encode bytes to a point in G1.

hashToG1 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P1) Source #

Hash bytes to a point in G1.

encodeToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2) Source #

Encode bytes to a point in G2.

hashToG2 :: (ByteArrayAccess ba, ByteArrayAccess ba2) => ba -> Maybe ba2 -> IO (Point 'P2) Source #

Hash bytes to a point in G2.

coreVerifyPkInG1 Source #

Arguments

:: (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.

coreVerifyPkInG2 Source #

Arguments

:: (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.

p1ToAffine :: Point 'P1 -> IO (Affine 'P1) Source #

Convert point to affine point in G1.

p2ToAffine :: Point 'P2 -> IO (Affine 'P2) Source #

Convert point to affine point in G2.

p1AffCompress :: Affine 'P1 -> IO (SizedByteArray P1CompressSize Bytes) Source #

Serialize and compress affine G1 point.

p1Uncompress :: ByteArrayAccess ba => SizedByteArray P1CompressSize ba -> IO (Either BlstError (Affine 'P1)) Source #

Deserialize and decompress affine G1 point.

p2AffCompress :: Affine 'P2 -> IO (SizedByteArray P2CompressSize Bytes) Source #

Serialize and compress 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.

p1FromAffine :: Affine 'P1 -> IO (Point 'P1) Source #

Convert affine point to point in G1.

p2FromAffine :: Affine 'P2 -> IO (Point 'P2) Source #

Convert affine point to point in G2.

pairingChkNAggrPkInG1 Source #

Arguments

:: ByteArrayAccess ba 
=> PairingCtx

Pairing context. Use pairingInit to create.

-> 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 Nothing here.

-> Bool

Check signature group?

-> ba

Message

-> IO BlstError 

Check aggregate signature in G1.

pairingChkNAggrPkInG2 Source #

Arguments

:: ByteArrayAccess ba 
=> PairingCtx

Pairing context. Use pairingInit to create.

-> 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 Nothing here.

-> Bool

Check signature group?

-> ba

Message

-> IO BlstError 

Check aggregate signature in G2.

pairingInit :: ByteArrayAccess ba => EncodeMethod -> Maybe ba -> IO PairingCtx Source #

Make new pairing context.

pairingCommit :: PairingCtx -> IO () Source #

Commit pairing context.

pairingFinalVerify :: PairingCtx -> IO Bool Source #

Verify pairing context.