Enable context creation in preallocated memory
Summary:
- Prepare for manual memory management in preallocated memory
- Determine ALIGNMENT more cleverly and move it to util.h
- Implement manual_malloc() helper function
- Add size constants for preallocated memory
- Switch to a single malloc call
- Support cloning a context into preallocated memory
- Check arguments of _preallocated functions
- Add tests for contexts in preallocated memory
- Export _preallocated functions
- Move _preallocated functions to separate header
- Explain caller's obligations for preallocated memory
This is a backport of secp256k1 PR566
Depends on D5030
Test Plan:
ninja check-secp256k1
Reviewers: #bitcoin_abc, Fabien
Reviewed By: #bitcoin_abc, Fabien
Subscribers: Fabien
Differential Revision: https://reviews.bitcoinabc.org/D5031