[][src]Module secp256k1::ffi

FFI bindings

Direct bindings to the underlying C library functions. These should not be needed for most users.

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 with secp256k1_context_destroy, or else you will have a memory leak.

PublicKey

Library-internal representation of a Secp256k1 public key

SharedSecret

Library-internal representation of an ECDH shared secret

Signature

Library-internal representation of a Secp256k1 signature

Constants

SECP256K1_START_NONE

Flag for context to enable no precomputation

SECP256K1_START_VERIFY

Flag for context to enable verification precomputation

SECP256K1_START_SIGN

Flag for context to enable signing precomputation

SECP256K1_SER_UNCOMPRESSED

Flag for keys to indicate uncompressed serialization format

SECP256K1_SER_COMPRESSED

Flag for keys to indicate compressed serialization format

Statics

secp256k1_ecdh_hash_function_default
secp256k1_context_no_precomp
secp256k1_nonce_function_rfc6979

Functions

ecdsa_signature_parse_der_lax
secp256k1_context_create

A reimplementation of the C function secp256k1_context_create in rust.

secp256k1_context_destroy

A reimplementation of the C function secp256k1_context_destroy in rust.

secp256k1_default_illegal_callback_fn

This function is an override for the C function, this is the an edited version of the original description:

secp256k1_default_error_callback_fn

This function is an override for the C function, this is the an edited version of the original description:

secp256k1_context_preallocated_create

Creates a dummy context, tracking flags to ensure proper calling semantics

secp256k1_context_preallocated_size

Return dummy size of context struct.

secp256k1_context_preallocated_clone_size

Return dummy size of context struct.

secp256k1_context_preallocated_clone

Copies a dummy context

secp256k1_context_preallocated_destroy

"Destroys" a dummy context

secp256k1_context_randomize

Asserts that cx is properly initialized

secp256k1_ec_pubkey_parse

Parse 33/65 byte pubkey into PublicKey, losing compressed information

secp256k1_ec_pubkey_serialize

Serialize PublicKey back to 33/65 byte pubkey

secp256k1_ecdsa_signature_parse_der
secp256k1_ecdsa_signature_parse_compact

Copies input64 to sig, checking the pubkey part is valid

secp256k1_ecdsa_signature_serialize_der

Copies up to 72 bytes into output from sig

secp256k1_ecdsa_signature_serialize_compact

Copies sig to output64

secp256k1_ecdsa_signature_normalize
secp256k1_ecdsa_verify

Verifies that sig is msg32||pk[0..32]

secp256k1_ecdsa_sign

Sets sig to msg32||sk

secp256k1_ec_seckey_verify

Checks that sk != 0xffff...ffff

secp256k1_ec_pubkey_create

Sets pk to sk||sk

secp256k1_ec_privkey_tweak_add

Copies the first 16 bytes of tweak into the last 16 bytes of sk

secp256k1_ec_pubkey_tweak_add

The PublicKey equivalent of secp256k1_ec_privkey_tweak_add

secp256k1_ec_privkey_tweak_mul

Copies the last 16 bytes of tweak into the last 16 bytes of sk

secp256k1_ec_pubkey_tweak_mul

The PublicKey equivalent of secp256k1_ec_privkey_tweak_mul

secp256k1_ec_pubkey_combine
secp256k1_ecdh

Sets out to point[0..16]||scalar[0..16]

test_pk_validate

Checks that pk != 0xffff...ffff and pk[0..32] == pk[32..64]

Type Definitions

EcdhHashFn

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.