@@ -24,15 +24,13 @@ extern "C" {
2424 * 5. Opaque data pointers follow the function pointer they are to be passed to.
2525 */
2626
27- /** Opaque data structure that holds context information (precomputed tables etc.).
27+ /** Opaque data structure that holds context information
2828 *
29- * The purpose of context structures is to cache large precomputed data tables
30- * that are expensive to construct, and also to maintain the randomization data
31- * for blinding.
29+ * The purpose of context structures is to store the randomization data for
30+ * blinding, see secp256k1_context_randomize.
3231 *
3332 * Do not create a new context object for each operation, as construction is
34- * far slower than all other API calls (~100 times slower than an ECDSA
35- * verification).
33+ * far slower than all other API calls.
3634 *
3735 * A constructed context can safely be used from multiple threads
3836 * simultaneously, but API calls that take a non-const pointer to a context
@@ -194,12 +192,16 @@ typedef int (*secp256k1_nonce_function)(
194192#define SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY (1 << 10)
195193#define SECP256K1_FLAGS_BIT_COMPRESSION (1 << 8)
196194
197- /** Flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and
195+ /** Context flags to pass to secp256k1_context_create, secp256k1_context_preallocated_size, and
198196 * secp256k1_context_preallocated_create. */
197+ #define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT)
198+
199+ /** Deprecated context flags. These flags are treated equivalent to SECP256K1_CONTEXT_NONE. */
199200#define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY)
200201#define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN)
202+
203+ /* Testing flag. Do not use. */
201204#define SECP256K1_CONTEXT_DECLASSIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY)
202- #define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT)
203205
204206/** Flag to pass to secp256k1_ec_pubkey_serialize. */
205207#define SECP256K1_EC_COMPRESSED (SECP256K1_FLAGS_TYPE_COMPRESSION | SECP256K1_FLAGS_BIT_COMPRESSION)
@@ -226,9 +228,13 @@ SECP256K1_API extern const secp256k1_context *secp256k1_context_no_precomp;
226228 * memory allocation entirely, see the functions in secp256k1_preallocated.h.
227229 *
228230 * Returns: a newly created context object.
229- * In: flags: which parts of the context to initialize .
231+ * In: flags: Always set to SECP256K1_CONTEXT_NONE (see below) .
230232 *
231- * See also secp256k1_context_randomize.
233+ * The only valid non-deprecated flag in recent library versions is
234+ * SECP256K1_CONTEXT_NONE, which will create a context sufficient for all functionality
235+ * offered by the library. All other (deprecated) flags will be treated as equivalent
236+ * to the SECP256K1_CONTEXT_NONE flag. Though the flags parameter primarily exists for
237+ * historical reasons, future versions of the library may introduce new flags.
232238 */
233239SECP256K1_API secp256k1_context * secp256k1_context_create (
234240 unsigned int flags
0 commit comments