secp256k1/include
Tim Ruffing aa5d34a8fe
Merge bitcoin-core/secp256k1#783: Make the public API docs more consistent and explicit
adec5a1638 Add missing null check for ctx and input keys in the public API (Elichai Turkel)
f4edfc7581 Improve consistency for NULL arguments in the public interface (Elichai Turkel)

Pull request description:

  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:
  1. 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).
  2. 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:
  1. Documenting the `data` argument to the default nonce functions

ACKs for top commit:
  ariard:
    ACK adec5a16
  jonasnick:
    ACK adec5a1638

Tree-SHA512: 6fe785776b7e451e9e8cae944987f927b1eb2e2d404dfcb1b0ceb0a30bda4ce16469708920269417e5ada09739723a430e270dea1868fe7d12ccd5699dde5976
2021-09-15 16:36:11 +02:00
..
secp256k1.h Add missing null check for ctx and input keys in the public API 2021-07-04 12:47:46 +03:00
secp256k1_ecdh.h Improve consistency for NULL arguments in the public interface 2021-07-04 12:47:45 +03:00
secp256k1_extrakeys.h Improve consistency for NULL arguments in the public interface 2021-07-04 12:47:45 +03:00
secp256k1_preallocated.h Add missing null check for ctx and input keys in the public API 2021-07-04 12:47:46 +03:00
secp256k1_recovery.h Improve consistency for NULL arguments in the public interface 2021-07-04 12:47:45 +03:00
secp256k1_schnorrsig.h Merge bitcoin-core/secp256k1#783: Make the public API docs more consistent and explicit 2021-09-15 16:36:11 +02:00