Skip to content

Rethink context objects #637

Open
Open
@sanket1729

Description

@sanket1729

As of latest secp master, there are a few things that we can take advantage of in the rust ecosystem.

Notes pasted from CHANGELOG.

  • Forbade randomizing (copies of) secp256k1_context_static. Randomizing a copy of secp256k1_context_static did not have any effect and did not provide defense-in-depth protection against side-channel attacks. Create a new context if you want to benefit from randomization.
  • Deprecated context flags SECP256K1_CONTEXT_VERIFY and SECP256K1_CONTEXT_SIGN. Use SECP256K1_CONTEXT_NONE instead.

Few suggestions to get things started:

  • Remove context altogether. Create a context as static Option. We can use crates like ctor or implement our own racy initialization with atomics. Contexts are really annoying as they leak everywhere in function signatures.
  • We can also keep two versions for each API. One with context param and one without.
  • Remove all randomization from the code and simplify our API? People may strong opinions here.

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