-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge #81: Update vendored version of secp256k1-zkp
c1feb16 add CHANGELOG entries for 0.11.0 (Andrew Poelstra) 53d2ec6 update libsecp-zkp to 6152622613fdf1c5af6f31f74c427c4e9ee120ce (Andrew Poelstra) e0b45ac secp256k1-zkp-sys: redo patch files for latest upstream (Andrew Poelstra) Pull request description: ACKs for top commit: jonasnick: ACK c1feb16 Tree-SHA512: d241f333d2e1a0add3deb866d8428c14f29c246c66bfeb043f81aa896c99d85774377719a567b364575a90a96a6722cfb3d8016147e7943cddce149a9b62dbab
- Loading branch information
Showing
234 changed files
with
28,986 additions
and
17,145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "secp256k1-zkp" | ||
version = "0.10.1" | ||
version = "0.11.0" | ||
authors = [ "Dawid Ciężarkiewicz <[email protected]>", | ||
"Andrew Poelstra <[email protected]>", | ||
"Lucas Soriano <[email protected]>", | ||
|
@@ -34,7 +34,7 @@ rand = ["actual-rand", "secp256k1/rand"] | |
actual-serde = { package = "serde", version = "1.0", default-features = false, optional = true } | ||
actual-rand = { package = "rand", version = "0.8", default-features = false, optional = true } | ||
secp256k1 = "0.29.0" | ||
secp256k1-zkp-sys = { version = "0.9.0", default-features = false, path = "./secp256k1-zkp-sys" } | ||
secp256k1-zkp-sys = { version = "0.10.0", default-features = false, path = "./secp256k1-zkp-sys" } | ||
internals = { package = "bitcoin-private", version = "0.1.0" } | ||
|
||
[dev-dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "secp256k1-zkp-sys" | ||
version = "0.9.1" | ||
version = "0.10.0" | ||
authors = [ "Dawid Ciężarkiewicz <[email protected]>", | ||
"Andrew Poelstra <[email protected]>", | ||
"Steven Roose <[email protected]>", | ||
|
@@ -13,7 +13,7 @@ description = "FFI for `libsecp256k1-zkp` library." | |
keywords = [ "secp256k1", "libsecp256k1-zkp", "ffi" ] | ||
readme = "README.md" | ||
build = "build.rs" | ||
links = "rustsecp256k1zkp_v0_8_0" | ||
links = "rustsecp256k1zkp_v0_10_0" | ||
|
||
# Should make docs.rs show all functions, even those behind non-default features | ||
[package.metadata.docs.rs] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,36 @@ | ||
13,37d12 | ||
< static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t size) { | ||
< const size_t base_alloc = ROUND_TO_ALIGN(sizeof(secp256k1_scratch)); | ||
< void *alloc = checked_malloc(error_callback, base_alloc + size); | ||
< secp256k1_scratch* ret = (secp256k1_scratch *)alloc; | ||
< if (ret != NULL) { | ||
< memset(ret, 0, sizeof(*ret)); | ||
< memcpy(ret->magic, "scratch", 8); | ||
< ret->data = (void *) ((char *) alloc + base_alloc); | ||
< ret->max_size = size; | ||
< } | ||
< return ret; | ||
< } | ||
< | ||
< static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch) { | ||
< if (scratch != NULL) { | ||
< VERIFY_CHECK(scratch->alloc_size == 0); /* all checkpoints should be applied */ | ||
< if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) { | ||
< secp256k1_callback_call(error_callback, "invalid scratch space"); | ||
< return; | ||
< } | ||
< memset(scratch->magic, 0, sizeof(scratch->magic)); | ||
< free(scratch); | ||
< } | ||
< } | ||
< | ||
diff --git a/secp256k1-zkp-sys/depend/secp256k1/src/scratch_impl.h b/secp256k1-zkp-sys/depend/secp256k1/src/scratch_impl.h | ||
index f71a20b..5389571 100644 | ||
--- a/secp256k1-zkp-sys/depend/secp256k1/src/scratch_impl.h | ||
+++ b/secp256k1-zkp-sys/depend/secp256k1/src/scratch_impl.h | ||
@@ -10,31 +10,6 @@ | ||
#include "util.h" | ||
#include "scratch.h" | ||
|
||
-static secp256k1_scratch* secp256k1_scratch_create(const secp256k1_callback* error_callback, size_t size) { | ||
- const size_t base_alloc = ROUND_TO_ALIGN(sizeof(secp256k1_scratch)); | ||
- void *alloc = checked_malloc(error_callback, base_alloc + size); | ||
- secp256k1_scratch* ret = (secp256k1_scratch *)alloc; | ||
- if (ret != NULL) { | ||
- memset(ret, 0, sizeof(*ret)); | ||
- memcpy(ret->magic, "scratch", 8); | ||
- ret->data = (void *) ((char *) alloc + base_alloc); | ||
- ret->max_size = size; | ||
- } | ||
- return ret; | ||
-} | ||
- | ||
-static void secp256k1_scratch_destroy(const secp256k1_callback* error_callback, secp256k1_scratch* scratch) { | ||
- if (scratch != NULL) { | ||
- if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) { | ||
- secp256k1_callback_call(error_callback, "invalid scratch space"); | ||
- return; | ||
- } | ||
- VERIFY_CHECK(scratch->alloc_size == 0); /* all checkpoints should be applied */ | ||
- memset(scratch->magic, 0, sizeof(scratch->magic)); | ||
- free(scratch); | ||
- } | ||
-} | ||
- | ||
static size_t secp256k1_scratch_checkpoint(const secp256k1_callback* error_callback, const secp256k1_scratch* scratch) { | ||
if (secp256k1_memcmp_var(scratch->magic, "scratch", 8) != 0) { | ||
secp256k1_callback_call(error_callback, "invalid scratch space"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
# This file was automatically created by vendor-libsecp.sh | ||
1d256089004a19bdbead7c5676e52c8e07b09fce | ||
6152622613fdf1c5af6f31f74c427c4e9ee120ce |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,78 @@ | ||
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); | ||
diff --git a/secp256k1-zkp-sys/depend/secp256k1/src/secp256k1.c b/secp256k1-zkp-sys/depend/secp256k1/src/secp256k1.c | ||
index 4c57826..dacaed2 100644 | ||
--- a/secp256k1-zkp-sys/depend/secp256k1/src/secp256k1.c | ||
+++ b/secp256k1-zkp-sys/depend/secp256k1/src/secp256k1.c | ||
@@ -158,17 +158,6 @@ secp256k1_context* secp256k1_context_preallocated_create(void* prealloc, unsigne | ||
return ret; | ||
} | ||
|
||
-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; | ||
-} | ||
- | ||
secp256k1_context* secp256k1_context_preallocated_clone(const secp256k1_context* ctx, void* prealloc) { | ||
secp256k1_context* ret; | ||
VERIFY_CHECK(ctx != NULL); | ||
@@ -180,19 +169,6 @@ secp256k1_context* secp256k1_context_preallocated_clone(const secp256k1_context* | ||
return ret; | ||
} | ||
|
||
-secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) { | ||
- secp256k1_context* ret; | ||
- size_t prealloc_size; | ||
- | ||
- VERIFY_CHECK(ctx != NULL); | ||
- ARG_CHECK(secp256k1_context_is_proper(ctx)); | ||
- | ||
- 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; | ||
-} | ||
- | ||
void secp256k1_context_preallocated_destroy(secp256k1_context* ctx) { | ||
ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx)); | ||
|
||
@@ -204,18 +180,6 @@ void secp256k1_context_preallocated_destroy(secp256k1_context* ctx) { | ||
secp256k1_ecmult_gen_context_clear(&ctx->ecmult_gen_ctx); | ||
} | ||
|
||
-void secp256k1_context_destroy(secp256k1_context* ctx) { | ||
- ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx)); | ||
- | ||
- /* Defined as noop */ | ||
- if (ctx == NULL) { | ||
- return; | ||
- } | ||
- | ||
- secp256k1_context_preallocated_destroy(ctx); | ||
- free(ctx); | ||
-} | ||
- | ||
void secp256k1_context_set_illegal_callback(secp256k1_context* ctx, void (*fun)(const char* message, void* data), const void* data) { | ||
/* We compare pointers instead of checking secp256k1_context_is_proper() here | ||
because setting callbacks is allowed on *copies* of the static context: | ||
@@ -240,16 +204,6 @@ void secp256k1_context_set_error_callback(secp256k1_context* ctx, void (*fun)(co | ||
ctx->error_callback.data = data; | ||
} | ||
|
||
-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); | ||
-} | ||
- | ||
/* Mark memory as no-longer-secret for the purpose of analysing constant-time behaviour | ||
* of the software. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,105 @@ | ||
226,228d225 | ||
< SECP256K1_API secp256k1_context* secp256k1_context_create( | ||
< unsigned int flags | ||
< ) SECP256K1_WARN_UNUSED_RESULT; | ||
231,233d227 | ||
< SECP256K1_API secp256k1_context* secp256k1_context_clone( | ||
< const secp256k1_context* ctx | ||
< ) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT; | ||
248,250d241 | ||
< SECP256K1_API void secp256k1_context_destroy( | ||
< secp256k1_context* ctx | ||
< ) SECP256K1_ARG_NONNULL(1); | ||
327,330d317 | ||
< SECP256K1_API SECP256K1_WARN_UNUSED_RESULT secp256k1_scratch_space* secp256k1_scratch_space_create( | ||
< const secp256k1_context* ctx, | ||
< size_t size | ||
< ) SECP256K1_ARG_NONNULL(1); | ||
338,341d324 | ||
< SECP256K1_API void secp256k1_scratch_space_destroy( | ||
< const secp256k1_context* ctx, | ||
< secp256k1_scratch_space* scratch | ||
< ) SECP256K1_ARG_NONNULL(1); | ||
diff --git a/secp256k1-zkp-sys/depend/secp256k1/include/secp256k1.h b/secp256k1-zkp-sys/depend/secp256k1/include/secp256k1.h | ||
index f4053f2..aa2d18b 100644 | ||
--- a/secp256k1-zkp-sys/depend/secp256k1/include/secp256k1.h | ||
+++ b/secp256k1-zkp-sys/depend/secp256k1/include/secp256k1.h | ||
@@ -257,70 +257,6 @@ SECP256K1_DEPRECATED("Use secp256k1_context_static instead"); | ||
*/ | ||
SECP256K1_API void secp256k1_selftest(void); | ||
|
||
- | ||
-/** Create a secp256k1 context object (in dynamically allocated memory). | ||
- * | ||
- * This function uses malloc to allocate memory. It is guaranteed that malloc is | ||
- * called at most once for every call of this function. If you need to avoid dynamic | ||
- * memory allocation entirely, see secp256k1_context_static and the functions in | ||
- * secp256k1_preallocated.h. | ||
- * | ||
- * Returns: pointer to a newly created context object. | ||
- * In: flags: Always set to SECP256K1_CONTEXT_NONE (see below). | ||
- * | ||
- * The only valid non-deprecated flag in recent library versions is | ||
- * SECP256K1_CONTEXT_NONE, which will create a context sufficient for all functionality | ||
- * offered by the library. All other (deprecated) flags will be treated as equivalent | ||
- * to the SECP256K1_CONTEXT_NONE flag. Though the flags parameter primarily exists for | ||
- * historical reasons, future versions of the library may introduce new flags. | ||
- * | ||
- * If the context is intended to be used for API functions that perform computations | ||
- * involving secret keys, e.g., signing and public key generation, then it is highly | ||
- * recommended to call secp256k1_context_randomize on the context before calling | ||
- * those API functions. This will provide enhanced protection against side-channel | ||
- * leakage, see secp256k1_context_randomize for details. | ||
- * | ||
- * Do not create a new context object for each operation, as construction and | ||
- * randomization can take non-negligible time. | ||
- */ | ||
-SECP256K1_API secp256k1_context *secp256k1_context_create( | ||
- unsigned int flags | ||
-) SECP256K1_WARN_UNUSED_RESULT; | ||
- | ||
-/** Copy a secp256k1 context object (into dynamically allocated memory). | ||
- * | ||
- * This function uses malloc to allocate memory. It is guaranteed that malloc is | ||
- * called at most once for every call of this function. If you need to avoid dynamic | ||
- * memory allocation entirely, see the functions in secp256k1_preallocated.h. | ||
- * | ||
- * Cloning secp256k1_context_static is not possible, and should not be emulated by | ||
- * the caller (e.g., using memcpy). Create a new context instead. | ||
- * | ||
- * Returns: pointer to a newly created context object. | ||
- * Args: ctx: pointer to a context to copy (not secp256k1_context_static). | ||
- */ | ||
-SECP256K1_API secp256k1_context *secp256k1_context_clone( | ||
- const secp256k1_context *ctx | ||
-) SECP256K1_ARG_NONNULL(1) SECP256K1_WARN_UNUSED_RESULT; | ||
- | ||
-/** Destroy a secp256k1 context object (created in dynamically allocated memory). | ||
- * | ||
- * The context pointer may not be used afterwards. | ||
- * | ||
- * The context to destroy must have been created using secp256k1_context_create | ||
- * or secp256k1_context_clone. If the context has instead been created using | ||
- * secp256k1_context_preallocated_create or secp256k1_context_preallocated_clone, the | ||
- * behaviour is undefined. In that case, secp256k1_context_preallocated_destroy must | ||
- * be used instead. | ||
- * | ||
- * Args: ctx: pointer to a context to destroy, constructed using | ||
- * secp256k1_context_create or secp256k1_context_clone | ||
- * (i.e., not secp256k1_context_static). | ||
- */ | ||
-SECP256K1_API void secp256k1_context_destroy( | ||
- secp256k1_context *ctx | ||
-) SECP256K1_ARG_NONNULL(1); | ||
- | ||
/** Set a callback function to be called when an illegal argument is passed to | ||
* an API call. It will only trigger for violations that are mentioned | ||
* explicitly in the header. | ||
@@ -392,29 +328,6 @@ SECP256K1_API void secp256k1_context_set_error_callback( | ||
const void *data | ||
) SECP256K1_ARG_NONNULL(1); | ||
|
||
-/** Create a secp256k1 scratch space object. | ||
- * | ||
- * Returns: a newly created scratch space. | ||
- * Args: ctx: pointer to a context object. | ||
- * In: size: amount of memory to be available as scratch space. Some extra | ||
- * (<100 bytes) will be allocated for extra accounting. | ||
- */ | ||
-SECP256K1_API SECP256K1_WARN_UNUSED_RESULT secp256k1_scratch_space *secp256k1_scratch_space_create( | ||
- const secp256k1_context *ctx, | ||
- size_t size | ||
-) SECP256K1_ARG_NONNULL(1); | ||
- | ||
-/** Destroy a secp256k1 scratch space. | ||
- * | ||
- * The pointer may not be used afterwards. | ||
- * Args: ctx: pointer to a context object. | ||
- * scratch: space to destroy | ||
- */ | ||
-SECP256K1_API void secp256k1_scratch_space_destroy( | ||
- const secp256k1_context *ctx, | ||
- secp256k1_scratch_space *scratch | ||
-) SECP256K1_ARG_NONNULL(1); | ||
- | ||
/** Parse a variable-length public key into the pubkey object. | ||
* | ||
* Returns: 1 if the public key was fully valid. |
Oops, something went wrong.