Crate ffi
Expand description
§secp256k1-sys FFI bindings
Direct bindings to the underlying C library functions. These should not be needed for most users.
Modules§
Macros§
Structs§
- Context
- A Secp256k1 context, containing various precomputed values and such
needed to do elliptic curve computations. If you create one of these
with
secp256k1_context_create
you MUST destroy it withsecp256k1_context_destroy
, or else you will have a memory leak. - KeyPair
- Public
Key - Library-internal representation of a Secp256k1 public key
- Schnorr
SigExtra Params - Data structure that contains additional arguments for schnorrsig_sign_custom.
- Signature
- Library-internal representation of a Secp256k1 signature
- XOnly
Public Key
Constants§
- SECP256
K1_ SER_ COMPRESSED - Flag for keys to indicate compressed serialization format
- SECP256
K1_ SER_ UNCOMPRESSED - Flag for keys to indicate uncompressed serialization format
- SECP256
K1_ START_ NONE - Flag for context to enable no precomputation
- SECP256
K1_ START_ SIGN - Flag for context to enable signing precomputation
- SECP256
K1_ START_ VERIFY - Flag for context to enable verification precomputation
Statics§
- secp256k1_
context_ no_ precomp - secp256k1_
ecdh_ hash_ function_ default - Default ECDH hash function
- secp256k1_
nonce_ function_ bip340 - secp256k1_
nonce_ function_ default - secp256k1_
nonce_ function_ rfc6979
Traits§
- CPtr
- A trait for producing pointers that will always be valid in C. (assuming NULL pointer is a valid no-op) Rust doesn’t promise what pointers does it give to ZST (https://doc.rust-lang.org/nomicon/exotic-sizes.html#zero-sized-types-zsts) In case the type is empty this trait will give a NULL pointer, which should be handled in C.
Functions§
- ecdsa_
signature_ ⚠parse_ der_ lax - rustsecp256k1_
v0_ ⚠6_ 1_ context_ create - A reimplementation of the C function
secp256k1_context_create
in rust. - rustsecp256k1_
v0_ ⚠6_ 1_ context_ destroy - A reimplementation of the C function
secp256k1_context_destroy
in rust. - rustsecp256k1_
v0_ ⚠6_ 1_ default_ error_ callback_ fn - This function is an override for the C function, this is the an edited version of the original description:
- rustsecp256k1_
v0_ ⚠6_ 1_ default_ illegal_ callback_ fn - This function is an override for the C function, this is the an edited version of the original description:
- secp256k1_
context_ ⚠create - secp256k1_
context_ ⚠destroy - secp256k1_
context_ ⚠preallocated_ clone - secp256k1_
context_ ⚠preallocated_ clone_ size - secp256k1_
context_ ⚠preallocated_ create - secp256k1_
context_ ⚠preallocated_ destroy - secp256k1_
context_ ⚠preallocated_ size - secp256k1_
context_ ⚠randomize - secp256k1_
ec_ ⚠privkey_ negate Deprecated - secp256k1_
ec_ ⚠privkey_ tweak_ add Deprecated - secp256k1_
ec_ ⚠privkey_ tweak_ mul Deprecated - secp256k1_
ec_ ⚠pubkey_ cmp - secp256k1_
ec_ ⚠pubkey_ combine - secp256k1_
ec_ ⚠pubkey_ create - secp256k1_
ec_ ⚠pubkey_ negate - secp256k1_
ec_ ⚠pubkey_ parse - secp256k1_
ec_ ⚠pubkey_ serialize - secp256k1_
ec_ ⚠pubkey_ tweak_ add - secp256k1_
ec_ ⚠pubkey_ tweak_ mul - secp256k1_
ec_ ⚠seckey_ negate - secp256k1_
ec_ ⚠seckey_ tweak_ add - secp256k1_
ec_ ⚠seckey_ tweak_ mul - secp256k1_
ec_ ⚠seckey_ verify - secp256k1_
ecdh ⚠ - secp256k1_
ecdsa_ ⚠sign - secp256k1_
ecdsa_ ⚠signature_ normalize - secp256k1_
ecdsa_ ⚠signature_ parse_ compact - secp256k1_
ecdsa_ ⚠signature_ parse_ der - secp256k1_
ecdsa_ ⚠signature_ serialize_ compact - secp256k1_
ecdsa_ ⚠signature_ serialize_ der - secp256k1_
ecdsa_ ⚠verify - secp256k1_
keypair_ ⚠create - secp256k1_
keypair_ ⚠pub - secp256k1_
keypair_ ⚠sec - secp256k1_
keypair_ ⚠xonly_ pub - secp256k1_
keypair_ ⚠xonly_ tweak_ add - secp256k1_
schnorrsig_ ⚠sign - secp256k1_
schnorrsig_ ⚠sign_ custom - secp256k1_
schnorrsig_ ⚠verify - secp256k1_
xonly_ ⚠pubkey_ cmp - secp256k1_
xonly_ ⚠pubkey_ from_ pubkey - secp256k1_
xonly_ ⚠pubkey_ parse - secp256k1_
xonly_ ⚠pubkey_ serialize - secp256k1_
xonly_ ⚠pubkey_ tweak_ add - secp256k1_
xonly_ ⚠pubkey_ tweak_ add_ check
Type Aliases§
- Ecdh
Hash Fn - Hash function to use to post-process an ECDH point to get a shared secret.
- NonceFn
- A nonce generation function. Ordinary users of the library never need to see this type; only if you need to control nonce generation do you need to use it. I have deliberately made this hard to do: you have to write your own wrapper around the FFI functions to use it. And it’s an unsafe type. Nonces are generated deterministically by RFC6979 by default; there should be no need to ever change this.
- Schnorr
Nonce Fn - Same as secp256k1_nonce function with the exception of accepting an additional pubkey argument and not requiring an attempt argument. The pubkey argument can protect signature schemes with key-prefixed challenge hash inputs against reusing the nonce when signing with the wrong precomputed pubkey.