C secp256k1 : ec_pubkey_parse successful on NULL context despite attribute

Looking at the main API file secp256k1.h of the C library, we have:

SECP256K1_API SECP256K1_WARN_UNUSED_RESULT int secp256k1_ec_pubkey_parse(     const secp256k1_context* ctx,     secp256k1_pubkey* pubkey,     const unsigned char *input,     size_t inputlen ) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3); 

Hence I am expecting the function secp256k1_ec_pubkey_parse to fail if any of the three pointer arguments are NULL. This is indeed the case when pubkey or input are NULL (and in fact if we set up a callback function with secp256k1_context_set_illegal_callback, it will be duly called with the appropriate return value). However this function succeeds on NULL context. Does anyone know why this is happening? Is this the expected behaviour? I am guessing this isn’t very important, but I am trying to learn and I don’t like it when I don’t understand. I attach a C snippet:

#include "secp256k1.h" #include <assert.h>  int main() {   int return_value;    secp256k1_context *ctx;            secp256k1_pubkey pub;               ctx = secp256k1_context_create(SECP256K1_CONTEXT_NONE);    // This is a valid public key   const unsigned char *pub1 = "\x03"     "\xf0\x28\x89\x2b\xad\x7e\xd5\x7d\x2f\xb5\x7b\xf3\x30\x81\xd5\xcf"     "\xcf\x6f\x9e\xd3\xd3\xd7\xf1\x59\xc2\xe2\xff\xf5\x79\xdc\x34\x1a";    // secp256k1_ec_pubkey_parse   return_value = secp256k1_ec_pubkey_parse(ctx, &pub, pub1, 33);    assert(return_value == 1);  // public key is indeed valid    // same call with NULL context   return_value = secp256k1_ec_pubkey_parse(NULL, &pub, pub1, 33);    assert(return_value == 1);  // call is successfull    // secp2561k1_context_destroy  secp256k1_context_destroy(ctx); } 

Recent Questions – Bitcoin Stack Exchange

The First End-To-End Bitcoin Micropayment Test on Lightning Network is Successful

Readers may remember our coverage of a Roger Ver interview from a few days ago where the veteran Bitcoiner and entrepreneur told Bitcoin Uncensored that Lightning Network was still untested and could take a long time to get off the ground. At the time, he was right. But this morning CCN can report that a […]

The post The First End-To-End Bitcoin Micropayment Test on Lightning Network is Successful appeared first on CCN: Financial Bitcoin & Cryptocurrency News.

News – CCN: Financial Bitcoin & Cryptocurrency News

Sydney Stock Exchange Public Blockchain Sees Successful Prototype

The Sydney Stock Exchange (SSX) has successfully prototyped its open blockchain ledger for real-time issuance and allocation of equity security, within a month after confirming the project. Following its mid-September confirmation that it is pressing ahead to build an open, public blockchain platform that will reduce settlement times of trades and equities, the Sydney Stock […]

The post Sydney Stock Exchange Public Blockchain Sees Successful Prototype appeared first on CCN: Financial Bitcoin & Cryptocurrency News.

News – CCN: Financial Bitcoin & Cryptocurrency News