Currently we offer secp256k1_context_no_precomp
[1] but it’s a “none” context.
If static precomputation (for ecmult_gen contexts) is enabled, we could easily offer a static secp256k1_context_sign
. I believe we should do this and additionally offer static precomputation for ecmult contexts. This will make it possible to offer a static secp256k1_context_verify
and a fully static secp256k1_context_sign_verify
depending on the compilation flags.
I think this is very helpful for embedded targets and is probably much more convenient to use than the prealloc API [2], which requires to users to obtain the size of the context secp256k1_context_preallocated_size()
at runtime and deal with manual allocation etc.
[1] Note that the docs can be improved here. They describe the context in terms of internals (“precomputed tables”). We should also describe this in terms of equivalent context flags. The same is true for the name of this thing. https://github.com/bitcoin-core/secp256k1/blob/8c727b9087ae012d5bb77e0766c21da763561a3c/include/secp256k1.h#L186-L191 [2] Also with behind language bindings #892, see also @gmaxwell’s comment there advocating for a fully static context