mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-11 11:16:09 -05:00
![Pieter Wuille](/assets/img/avatar_default.png)
21ffe4b22a Merge bitcoin-core/secp256k1#1055: Prepare initial release e025ccdf74 release: prepare for initial release 0.2.0 6d1784a2e2 build: add missing files to EXTRA_DIST 8c949f56da Merge bitcoin-core/secp256k1#1173: Don't use compute credits for now 13bf1b6b32 changelog: make order of change types match keepachangelog.com b1f992a552 doc: improve release process 7e5b22684f Don't use compute credits for now ad39e2dc41 build: change package version to 0.1.0-dev 5c789dcd73 Merge bitcoin-core/secp256k1#1168: Replace deprecated context flags with NONE in benchmarks and tests d6dc0f4ae3 tests: Switch to NONE contexts in module tests 0c8a5caddd tests: Switch to NONE contexts in tests.c 86540e9e1f tests: add test for deprecated flags and rm them from run_context caa0ad631e group: add gej_eq_var 37ba744f5b tests: Switch to NONE contexts in exhaustive and ctime tests 8d7a9a8eda benchmarks: Switch to NONE contexts 90618e9263 doc: move CHANGELOG from doc/ to root directory e3f84777eb Merge bitcoin-core/secp256k1#1126: API cleanup with respect to contexts 4386a2306c examples: Switch to NONE contexts 7289b51d31 docs: Use doxygen style if and only if comment is user-facing e7d0185c90 docs: Get rid of "initialized for signing" terminology 06126364ad docs: Tidy and improve docs about contexts and randomization e02d6862bd selftest: Expose in public API e383fbfa66 selftest: Rename internal function to make name available for API d2c6d48de3 tests: Use new name of static context 53796d2b24 contexts: Rename static context 72fedf8a6c docs: Improve docs for static context 316ac7625a contexts: Deprecate all context flags except SECP256K1_CONTEXT_NONE 477f02c4de Merge bitcoin-core/secp256k1#1165: gitignore: Add *.sage.py files autogenerated by sage [skip ci] 092be61c5e gitignore: Add *.sage.py files autogenerated by sage 1a553ee8be docs: Change signature "validation" to "verification" ee7341fbac docs: Never require a verification context 751c4354d5 Merge bitcoin-core/secp256k1#1152: Update macOS image for CI 2286f80902 Merge bitcoin-core/secp256k1#993: Enable non-experimental modules by default e40fd277b7 Merge bitcoin-core/secp256k1#1156: Followups to int128_struct arithmetic 99bd335599 Make int128 overflow test use secp256k1_[ui]128_mul a8494b02bf Use compute credits for macOS jobs 3afce0af7c Avoid signed overflow in MSVC AMR64 secp256k1_mul128 c0ae48c995 Update macOS image for CI 9b5f589d30 Heuristically decide whether to use int128_struct 63ff064d2f int128: Add test override for testing __(u)mulh on MSVC X64 f2b7e88768 Add int128 randomized tests 6138d73be4 Merge bitcoin-core/secp256k1#1155: Add MSan CI jobs ddf2b2910e Merge bitcoin-core/secp256k1#1000: Synthetic int128 type. 86e3b38a4a Merge bitcoin-core/secp256k1#1149: Remove usage of CHECK from non-test file 00a42b91b3 Add MSan CI job 44916ae915 Merge bitcoin-core/secp256k1#1147: ci: print env to allow reproducing the job outside of CI c2ee9175e9 Merge bitcoin-core/secp256k1#1146: ci: prevent "-v/--version: not found" irrelevant error e13fae487e Merge bitcoin-core/secp256k1#1150: ci: always cat test_env.log a340d9500a ci: add int128_struct tests dceaa1f579 int128: Tidy #includes of int128.h and int128_impl.h 2914bccbc0 Simulated int128 type. 6a965b6b98 Remove usage of CHECK from non-test file 5c9f1a5c37 ci: always cat all logs_snippets 49ae843592 ci: mostly prevent "-v/--version: not found" irrelevant error 4e54c03153 ci: print env to allow reproducing the job outside of CI a43e982bca Merge bitcoin-core/secp256k1#1144: Cleanup `.gitignore` file f5039cb66c Cleanup `.gitignore` file 798727ae1e Revert "Add test logs to gitignore" 41e8704b48 build: Enable some modules by default 694ce8fb2d Merge bitcoin-core/secp256k1#1131: readme: Misc improvements 88b00897e7 readme: Fix line break 78f5296da4 readme: Sell "no runtime dependencies" ef48f088ad readme: Add IRC channel 9f8a13dc8e Merge bitcoin-core/secp256k1#1128: configure: Remove pkgconfig macros again (reintroduced by mismerge) cabe085bb4 configure: Remove pkgconfig macros again (reintroduced by mismerge) 3efeb9da21 Merge bitcoin-core/secp256k1#1121: config: Set preprocessor defaults for ECMULT_* config values 6a873cc4a9 Merge bitcoin-core/secp256k1#1122: tests: Randomize the context with probability 15/16 instead of 1/4 17065f48ae tests: Randomize the context with probability 15/16 instead of 1/4 c27ae45144 config: Remove basic-config.h da6514a04a config: Introduce DEBUG_CONFIG macro for debug output of config 63a3565e97 Merge bitcoin-core/secp256k1#1120: ecmult_gen: Skip RNG when creating blinding if no seed is available d0cf55e13a config: Set preprocessor defaults for ECMULT_* config values 55f8bc99dc ecmult_gen: Improve comments about projective blinding 7a86955800 ecmult_gen: Simplify code (no observable change) 4cc0b1b669 ecmult_gen: Skip RNG when creating blinding if no seed is available af65d30cc8 Merge bitcoin-core/secp256k1#1116: build: Fix #include "..." paths to get rid of further -I arguments 40a3473a9d build: Fix #include "..." paths to get rid of further -I arguments 43756da819 Merge bitcoin-core/secp256k1#1115: Fix sepc256k1 -> secp256k1 typo in group.h 069aba8125 Fix sepc256k1 -> secp256k1 typo in group.h accadc94df Merge bitcoin-core/secp256k1#1114: `_scratch_destroy`: move `VERIFY_CHECK` after invalid scrach space check cd47033335 Merge bitcoin-core/secp256k1#1084: ci: Add MSVC builds 1827c9bf2b scratch_destroy: move VERIFY_CHECK after invalid scrach space check 49e2acd927 configure: Improve rationale for WERROR_CFLAGS 8dc4b03341 ci: Add a C++ job that compiles the public headers without -fpermissive 51f296a46c ci: Run persistent wineserver to speed up wine 3fb3269c22 ci: Add 32-bit MinGW64 build 9efc2e5221 ci: Add MSVC builds 2be6ba0fed configure: Convince autotools to work with MSVC's archiver lib.exe bd81f4140a schnorrsig bench: Suppress a stupid warning in MSVC 09f3d71c51 configure: Add a few CFLAGS for MSVC 3b4f3d0d46 build: Reject C++ compilers in the preprocessor 1cc0941414 configure: Don't abort if the compiler does not define __STDC__ cca8cbbac8 configure: Output message when checking for valgrind 1a6be5745f bench: Make benchmarks compile on MSVC git-subtree-dir: src/secp256k1 git-subtree-split: 21ffe4b22a9683cf24ae0763359e401d1284cc7a
130 lines
5.6 KiB
C
130 lines
5.6 KiB
C
#ifndef SECP256K1_PREALLOCATED_H
|
|
#define SECP256K1_PREALLOCATED_H
|
|
|
|
#include "secp256k1.h"
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
/* The module provided by this header file is intended for settings in which it
|
|
* is not possible or desirable to rely on dynamic memory allocation. It provides
|
|
* functions for creating, cloning, and destroying secp256k1 context objects in a
|
|
* contiguous fixed-size block of memory provided by the caller.
|
|
*
|
|
* Context objects created by functions in this module can be used like contexts
|
|
* objects created by functions in secp256k1.h, i.e., they can be passed to any
|
|
* API function that expects a context object (see secp256k1.h for details). The
|
|
* only exception is that context objects created by functions in this module
|
|
* must be destroyed using secp256k1_context_preallocated_destroy (in this
|
|
* module) instead of secp256k1_context_destroy (in secp256k1.h).
|
|
*
|
|
* It is guaranteed that functions in this module will not call malloc or its
|
|
* friends realloc, calloc, and free.
|
|
*/
|
|
|
|
/** Determine the memory size of a secp256k1 context object to be created in
|
|
* caller-provided memory.
|
|
*
|
|
* The purpose of this function is to determine how much memory must be provided
|
|
* to secp256k1_context_preallocated_create.
|
|
*
|
|
* Returns: the required size of the caller-provided memory block
|
|
* In: flags: which parts of the context to initialize.
|
|
*/
|
|
SECP256K1_API size_t secp256k1_context_preallocated_size(
|
|
unsigned int flags
|
|
) SECP256K1_WARN_UNUSED_RESULT;
|
|
|
|
/** Create a secp256k1 context object in caller-provided memory.
|
|
*
|
|
* The caller must provide a pointer to a rewritable contiguous block of memory
|
|
* of size at least secp256k1_context_preallocated_size(flags) bytes, suitably
|
|
* aligned to hold an object of any type.
|
|
*
|
|
* The block of memory is exclusively owned by the created context object during
|
|
* the lifetime of this context object, which begins with the call to this
|
|
* function and ends when a call to secp256k1_context_preallocated_destroy
|
|
* (which destroys the context object again) returns. During the lifetime of the
|
|
* context object, the caller is obligated not to access this block of memory,
|
|
* i.e., the caller may not read or write the memory, e.g., by copying the memory
|
|
* contents to a different location or trying to create a second context object
|
|
* in the memory. In simpler words, the prealloc pointer (or any pointer derived
|
|
* from it) should not be used during the lifetime of the context object.
|
|
*
|
|
* Returns: a newly created context object.
|
|
* In: prealloc: a pointer to a rewritable contiguous block of memory of
|
|
* size at least secp256k1_context_preallocated_size(flags)
|
|
* bytes, as detailed above.
|
|
* flags: which parts of the context to initialize.
|
|
*
|
|
* See secp256k1_context_create (in secp256k1.h) for further details.
|
|
*
|
|
* See also secp256k1_context_randomize (in secp256k1.h)
|
|
* and secp256k1_context_preallocated_destroy.
|
|
*/
|
|
SECP256K1_API secp256k1_context* secp256k1_context_preallocated_create(
|
|
void* prealloc,
|
|
unsigned int flags
|
|
) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
|
|
|
|
/** Determine the memory size of a secp256k1 context object to be copied into
|
|
* caller-provided memory.
|
|
*
|
|
* Returns: the required size of the caller-provided memory block.
|
|
* In: ctx: an existing context to copy.
|
|
*/
|
|
SECP256K1_API size_t secp256k1_context_preallocated_clone_size(
|
|
const secp256k1_context* ctx
|
|
) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT;
|
|
|
|
/** Copy a secp256k1 context object into caller-provided memory.
|
|
*
|
|
* The caller must provide a pointer to a rewritable contiguous block of memory
|
|
* of size at least secp256k1_context_preallocated_size(flags) bytes, suitably
|
|
* aligned to hold an object of any type.
|
|
*
|
|
* The block of memory is exclusively owned by the created context object during
|
|
* the lifetime of this context object, see the description of
|
|
* secp256k1_context_preallocated_create for details.
|
|
*
|
|
* Returns: a newly created context object.
|
|
* Args: ctx: an existing context to copy.
|
|
* In: prealloc: a pointer to a rewritable contiguous block of memory of
|
|
* size at least secp256k1_context_preallocated_size(flags)
|
|
* bytes, as detailed above.
|
|
*/
|
|
SECP256K1_API secp256k1_context* secp256k1_context_preallocated_clone(
|
|
const secp256k1_context* ctx,
|
|
void* prealloc
|
|
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_WARN_UNUSED_RESULT;
|
|
|
|
/** Destroy a secp256k1 context object that has been created in
|
|
* caller-provided memory.
|
|
*
|
|
* The context pointer may not be used afterwards.
|
|
*
|
|
* The context to destroy must have been created using
|
|
* secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone.
|
|
* If the context has instead been created using secp256k1_context_create or
|
|
* secp256k1_context_clone, the behaviour is undefined. In that case,
|
|
* secp256k1_context_destroy must be used instead.
|
|
*
|
|
* If required, it is the responsibility of the caller to deallocate the block
|
|
* of memory properly after this function returns, e.g., by calling free on the
|
|
* preallocated pointer given to secp256k1_context_preallocated_create or
|
|
* secp256k1_context_preallocated_clone.
|
|
*
|
|
* Args: ctx: an existing context to destroy, constructed using
|
|
* secp256k1_context_preallocated_create or
|
|
* secp256k1_context_preallocated_clone.
|
|
*/
|
|
SECP256K1_API void secp256k1_context_preallocated_destroy(
|
|
secp256k1_context* ctx
|
|
) SECP256K1_ARG_NONNULL(1);
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif /* SECP256K1_PREALLOCATED_H */
|