Skip to content

Context overhaul tracking issue #538

Open
@apoelstra

Description

@apoelstra

Moving discussion from #346 and #529.

On a high level our plan is to:

  • Eliminate all verification contexts from the library (internally we replace them with ffi::secp256k1_context_no_precomp)
  • Eliminate all signing contexts from the library (internally, by using TLS when compiling with std and using a global static otherwise)
  • Signing contexts will be rerandomized after every operation unless the user explicitly calls a _no_rerandomize variant...
  • ...where rerandomization, on no-std builds, will be a "best effort" basis where we do a manual lock using atomics and give up when there is contention

Specifically we need to:

  • mirror the context structure in Rust so that we can directly construct/destruct them without FFI or allocation
  • implement the TLS/static context and its best-effort rerandomize function
  • make all our context-taking functions use this structure and ignore their context arguments
  • deprecate the Secp256k1 struct and all the context traits; move their non-constructor methods to bare functions
  • deprecate all the context-taking functions on the keytypes (this is harder; if we deprecate e.g. KeyPair::negate then what should the new function name be called?)
  • (after a release) delete the deprecated functions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions