Commit message · Marko BencunShrink secp256k1 callbacks
Override libsecp256k1's default callbacks with tiny local stubs.
The vendored callbacks print an error and then call abort(). In the
firmware image those failure-only paths pull in a large chunk of newlib
stdio and signal handling even though the callbacks are only used for
fatal illegal-argument and internal-consistency failures and must never
return.
Saved: 2672 bytes
The final linked image drops the abort/stdio path retained only by those
callbacks, including the public symbols abort, raise, _raise_r,
_kill_r, _getpid_r, fprintf, printf, and _vfprintf_r. It also drops the
private stdio helpers behind them, such as __sfputc_r, __sfputs_r,
__swsetup_r, __swbuf_r, _fflush_r, _fwalk_sglue, __swhatbuf_r,
__swrite, __sread, __sseek, __sclose, __sinit, and __smakebuf_r.
Meanwhile secp256k1_default_illegal_callback_fn and
secp256k1_default_error_callback_fn shrink from 28 bytes each to 2
bytes each.
This keeps the relevant behavior intact: both callbacks still trap the
firmware in a non-returning fatal path, but without dragging in unused
diagnostic formatting code.
58/100 · ThinMessage clarity
✓ Descriptive subject✓ Provides detailed explanatory context
Why it was queuedcryptography-sensitive path