I went over the public API and added missing explanations on when a pointer can be null and when it cannot, and added some missing checks for null ctx and null pubkey pointers.
Open questions IMHO:
- Can
secp256k1_context_create
return NULL? right now it could return null if you replaced the callbacks at compile time to ones that do return(unlike the default ones which never return). - Related to the first, should we document that the callbacks should never return? (in the tests we use returning callbacks but we can violate our own API) right now we say the following:
After this callback returns, anything may happen, including crashing.
Is this enough to document answer no
for the first question and just saying that if the callback returned then you violated the API so secp256k1_context_create
can return NULL even though it is promised not to?
Right now we AFAICT we never check if it returns null
Another nit I’m not sure about is wording (does nothing if NULL)
/(ignored if NULL)
/(can be NULL)
More missing docs:
- Documenting the
data
argument to the default nonce functions