44 lines
1.4 KiB
Diff
44 lines
1.4 KiB
Diff
139,149d138
|
|
< secp256k1_context* secp256k1_context_create(unsigned int flags) {
|
|
< size_t const prealloc_size = secp256k1_context_preallocated_size(flags);
|
|
< secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size);
|
|
< if (EXPECT(secp256k1_context_preallocated_create(ctx, flags) == NULL, 0)) {
|
|
< free(ctx);
|
|
< return NULL;
|
|
< }
|
|
<
|
|
< return ctx;
|
|
< }
|
|
<
|
|
164,174d152
|
|
< secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) {
|
|
< secp256k1_context* ret;
|
|
< size_t prealloc_size;
|
|
<
|
|
< VERIFY_CHECK(ctx != NULL);
|
|
< prealloc_size = secp256k1_context_preallocated_clone_size(ctx);
|
|
< ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, prealloc_size);
|
|
< ret = secp256k1_context_preallocated_clone(ctx, ret);
|
|
< return ret;
|
|
< }
|
|
<
|
|
183,189d160
|
|
< void secp256k1_context_destroy(secp256k1_context* ctx) {
|
|
< if (ctx != NULL) {
|
|
< secp256k1_context_preallocated_destroy(ctx);
|
|
< free(ctx);
|
|
< }
|
|
< }
|
|
<
|
|
206,215d176
|
|
< }
|
|
<
|
|
< secp256k1_scratch_space* secp256k1_scratch_space_create(const secp256k1_context* ctx, size_t max_size) {
|
|
< VERIFY_CHECK(ctx != NULL);
|
|
< return secp256k1_scratch_create(&ctx->error_callback, max_size);
|
|
< }
|
|
<
|
|
< void secp256k1_scratch_space_destroy(const secp256k1_context *ctx, secp256k1_scratch_space* scratch) {
|
|
< VERIFY_CHECK(ctx != NULL);
|
|
< secp256k1_scratch_destroy(&ctx->error_callback, scratch);
|