@@ -191,7 +191,8 @@ SECP256K1_API extern const secp256k1_context *secp256k1_context_no_precomp;
191
191
/** Create a secp256k1 context object (in dynamically allocated memory).
192
192
*
193
193
* This function uses malloc to allocate memory. It is guaranteed that malloc is
194
- * called at most once for every call of this function.
194
+ * called at most once for every call of this function. If you need to avoid dynamic
195
+ * memory allocation entirely, see the functions in secp256k1_preallocated.h.
195
196
*
196
197
* Returns: a newly created context object.
197
198
* In: flags: which parts of the context to initialize.
@@ -205,7 +206,8 @@ SECP256K1_API secp256k1_context* secp256k1_context_create(
205
206
/** Copy a secp256k1 context object (into dynamically allocated memory).
206
207
*
207
208
* This function uses malloc to allocate memory. It is guaranteed that malloc is
208
- * called at most once for every call of this function.
209
+ * called at most once for every call of this function. If you need to avoid dynamic
210
+ * memory allocation entirely, see the functions in secp256k1_preallocated.h.
209
211
*
210
212
* Returns: a newly created context object.
211
213
* Args: ctx: an existing context to copy (cannot be NULL)
@@ -230,81 +232,6 @@ SECP256K1_API secp256k1_context* secp256k1_context_clone(
230
232
SECP256K1_API void secp256k1_context_destroy (
231
233
secp256k1_context * ctx
232
234
);
233
- /** Determine the memory size of a secp256k1 context object to be created in
234
- * caller-provided memory.
235
- *
236
- * The purpose of this function is to determine how much memory must be provided
237
- * to secp256k1_context_preallocated_create.
238
- *
239
- * Returns: the required size of the caller-provided memory block
240
- * In: flags: which parts of the context to initialize.
241
- */
242
-
243
- SECP256K1_API size_t secp256k1_context_preallocated_size (
244
- unsigned int flags
245
- ) SECP256K1_WARN_UNUSED_RESULT ;
246
-
247
- /** Create a secp256k1 context object in caller-provided memory.
248
- *
249
- * Returns: a newly created context object.
250
- * In: prealloc: a pointer to a rewritable contiguous block of memory of
251
- * size at least secp256k1_context_preallocated_size(flags)
252
- * bytes, suitably aligned to hold an object of any type
253
- * (cannot be NULL)
254
- * flags: which parts of the context to initialize.
255
- *
256
- * See also secp256k1_context_randomize.
257
- */
258
- SECP256K1_API secp256k1_context * secp256k1_context_preallocated_create (
259
- void * prealloc ,
260
- unsigned int flags
261
- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_WARN_UNUSED_RESULT ;
262
-
263
- /** Determine the memory size of a secp256k1 context object to be copied into
264
- * caller-provided memory.
265
- *
266
- * The purpose of this function is to determine how much memory must be provided
267
- * to secp256k1_context_preallocated_clone when copying the context ctx.
268
- *
269
- * Returns: the required size of the caller-provided memory block.
270
- * In: ctx: an existing context to copy (cannot be NULL)
271
- */
272
- SECP256K1_API size_t secp256k1_context_preallocated_clone_size (
273
- const secp256k1_context * ctx
274
- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_WARN_UNUSED_RESULT ;
275
-
276
- /** Copy a secp256k1 context object into caller-provided memory.
277
- *
278
- * Returns: a newly created context object.
279
- * Args: ctx: an existing context to copy (cannot be NULL)
280
- * In: prealloc: a pointer to a rewritable contiguous block of memory of
281
- * size at least secp256k1_context_preallocated_size(flags)
282
- * bytes, suitably aligned to hold an object of any type
283
- * (cannot be NULL)
284
- */
285
- SECP256K1_API secp256k1_context * secp256k1_context_preallocated_clone (
286
- const secp256k1_context * ctx ,
287
- void * prealloc
288
- ) SECP256K1_ARG_NONNULL (1 ) SECP256K1_ARG_NONNULL (2 ) SECP256K1_WARN_UNUSED_RESULT ;
289
-
290
- /** Destroy a secp256k1 context object that has been created in
291
- * caller-provided memory.
292
- *
293
- * The context pointer may not be used afterwards.
294
- *
295
- * The context to destroy must have been created using
296
- * secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone.
297
- * If the context has instead been created using secp256k1_context_create or
298
- * secp256k1_context_clone, the behaviour is undefined. In that case,
299
- * secp256k1_context_destroy must be used instead.
300
- *
301
- * Args: ctx: an existing context to destroy, constructed using
302
- * secp256k1_context_preallocated_create or
303
- * secp256k1_context_preallocated_clone (cannot be NULL)
304
- */
305
- SECP256K1_API void secp256k1_context_preallocated_destroy (
306
- secp256k1_context * ctx
307
- );
308
235
309
236
/** Set a callback function to be called when an illegal argument is passed to
310
237
* an API call. It will only trigger for violations that are mentioned
0 commit comments