Bindings to secp256k1 internal functions (generic operations on the curve)
type t

Opaque data structure that holds context information (precomputed tables etc.).

Do not create a new context object for each operation, as construction is far slower than all other API calls (~100 times slower than an ECDSA verification).

A constructed context can safely be used from multiple threads simultaneously, but API call that take a non-const pointer to a context need exclusive access to it. In particular this is the case for secp256k1_context_destroy and secp256k1_context_randomize.

Regarding randomization, either do it once at creation time (in which case you do not need any locking for the other calls), or use a read-write lock.

val create : ?sign:bool -> ?verify:bool -> unit -> t

create ?sign ?bool () is a freshly allocated t.

val clone : t -> t

clone t is a copy of t.

val randomize : t -> Bigstring.t -> bool

While secp256k1 code is written to be constant-time no matter what secret values are, it's possible that a future compiler may output code which isn't, and also that the CPU may not emit the same radio frequencies or draw the same amount power for all values.

This function provides a seed which is combined into the blinding value: that blinding value is added before each multiplication (and removed afterwards) so that it does not affect function results, but shields against attacks which rely on any input-dependent behaviour.

You should call this after secp256k1_context_create or secp256k1_context_clone, and may call this repeatedly afterwards.