@@ -24,15 +24,13 @@ extern "C" {
24
24
* 5. Opaque data pointers follow the function pointer they are to be passed to.
25
25
*/
26
26
27
- /** Opaque data structure that holds context information (precomputed tables etc.).
27
+ /** Opaque data structure that holds context information
28
28
*
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.
32
31
*
33
32
* 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.
36
34
*
37
35
* A constructed context can safely be used from multiple threads
38
36
* simultaneously, but API calls that take a non-const pointer to a context
@@ -194,12 +192,16 @@ typedef int (*secp256k1_nonce_function)(
194
192
#define SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY (1 << 10)
195
193
#define SECP256K1_FLAGS_BIT_COMPRESSION (1 << 8)
196
194
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
198
196
* 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. */
199
200
#define SECP256K1_CONTEXT_VERIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_VERIFY)
200
201
#define SECP256K1_CONTEXT_SIGN (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_SIGN)
202
+
203
+ /* Testing flag. Do not use. */
201
204
#define SECP256K1_CONTEXT_DECLASSIFY (SECP256K1_FLAGS_TYPE_CONTEXT | SECP256K1_FLAGS_BIT_CONTEXT_DECLASSIFY)
202
- #define SECP256K1_CONTEXT_NONE (SECP256K1_FLAGS_TYPE_CONTEXT)
203
205
204
206
/** Flag to pass to secp256k1_ec_pubkey_serialize. */
205
207
#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;
226
228
* memory allocation entirely, see the functions in secp256k1_preallocated.h.
227
229
*
228
230
* 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) .
230
232
*
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.
232
238
*/
233
239
SECP256K1_API secp256k1_context * secp256k1_context_create (
234
240
unsigned int flags
0 commit comments