Skip to content

Commit cbd0dfb

Browse files
committed
Run the vendor script
Ran script with ./vendor-libsecp.sh 0cdc758a56360bf58a851fe91085a327ec97685a
1 parent ea15bcb commit cbd0dfb

File tree

123 files changed

+7441
-7441
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

123 files changed

+7441
-7441
lines changed

secp256k1-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ description = "FFI for Pieter Wuille's `libsecp256k1` library."
1212
keywords = [ "secp256k1", "libsecp256k1", "ffi" ]
1313
readme = "README.md"
1414
build = "build.rs"
15-
links = "rustsecp256k1_v0_11"
15+
links = "rustsecp256k1_v0_12"
1616
edition = "2021"
1717
rust-version = "1.63.0"
1818

secp256k1-sys/depend/secp256k1/CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ The Contributor Workflow & Peer Review in libsecp256k1 are similar to Bitcoin Co
4444

4545
In addition, libsecp256k1 tries to maintain the following coding conventions:
4646

47-
* No runtime heap allocation (e.g., no `malloc`) unless explicitly requested by the caller (via `rustsecp256k1_v0_11_context_create` or `rustsecp256k1_v0_11_scratch_space_create`, for example). Moreover, it should be possible to use the library without any heap allocations.
47+
* No runtime heap allocation (e.g., no `malloc`) unless explicitly requested by the caller (via `rustsecp256k1_v0_12_context_create` or `rustsecp256k1_v0_12_scratch_space_create`, for example). Moreover, it should be possible to use the library without any heap allocations.
4848
* The tests should cover all lines and branches of the library (see [Test coverage](#coverage)).
4949
* Operations involving secret data should be tested for being constant time with respect to the secrets (see [src/ctime_tests.c](src/ctime_tests.c)).
5050
* Local variables containing secret data should be cleared explicitly to try to delete secrets from memory.
51-
* Use `rustsecp256k1_v0_11_memcmp_var` instead of `memcmp` (see [#823](https://github.com/bitcoin-core/secp256k1/issues/823)).
51+
* Use `rustsecp256k1_v0_12_memcmp_var` instead of `memcmp` (see [#823](https://github.com/bitcoin-core/secp256k1/issues/823)).
5252
* As a rule of thumb, the default values for configuration options should target standard desktop machines and align with Bitcoin Core's defaults, and the tests should mostly exercise the default configuration (see [#1549](https://github.com/bitcoin-core/secp256k1/issues/1549#issuecomment-2200559257)).
5353

5454
#### Style conventions
@@ -72,7 +72,7 @@ In addition, libsecp256k1 tries to maintain the following coding conventions:
7272
* Use `void *ptr` instead of `void* ptr`.
7373
* Arguments of the publicly-facing API must have a specific order defined in [include/secp256k1.h](include/secp256k1.h).
7474
* User-facing comment lines in headers should be limited to 80 chars if possible.
75-
* All identifiers in file scope should start with `rustsecp256k1_v0_11_`.
75+
* All identifiers in file scope should start with `rustsecp256k1_v0_12_`.
7676
* Avoid trailing whitespace.
7777

7878
### Tests

secp256k1-sys/depend/secp256k1/Makefile.am

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ AM_CFLAGS = $(SECP_CFLAGS)
66

77
lib_LTLIBRARIES = libsecp256k1.la
88
include_HEADERS = include/secp256k1.h
9-
include_HEADERS += include/rustsecp256k1_v0_11_preallocated.h
9+
include_HEADERS += include/rustsecp256k1_v0_12_preallocated.h
1010
noinst_HEADERS =
1111
noinst_HEADERS += src/scalar.h
1212
noinst_HEADERS += src/scalar_4x64.h
@@ -63,7 +63,7 @@ noinst_HEADERS += src/hash_impl.h
6363
noinst_HEADERS += src/field.h
6464
noinst_HEADERS += src/field_impl.h
6565
noinst_HEADERS += src/bench.h
66-
noinst_HEADERS += src/wycheproof/ecdsa_rustsecp256k1_v0_11_sha256_bitcoin_test.h
66+
noinst_HEADERS += src/wycheproof/ecdsa_rustsecp256k1_v0_12_sha256_bitcoin_test.h
6767
noinst_HEADERS += src/hsort.h
6868
noinst_HEADERS += src/hsort_impl.h
6969
noinst_HEADERS += contrib/lax_der_parsing.h
@@ -72,15 +72,15 @@ noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
7272
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
7373
noinst_HEADERS += examples/examples_util.h
7474

75-
PRECOMPUTED_LIB = librustsecp256k1_v0_11_precomputed.la
75+
PRECOMPUTED_LIB = librustsecp256k1_v0_12_precomputed.la
7676
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
77-
librustsecp256k1_v0_11_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
78-
# We need `-I$(top_srcdir)/src` in VPATH builds if librustsecp256k1_v0_11_precomputed_la_SOURCES have been recreated in the build tree.
77+
librustsecp256k1_v0_12_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
78+
# We need `-I$(top_srcdir)/src` in VPATH builds if librustsecp256k1_v0_12_precomputed_la_SOURCES have been recreated in the build tree.
7979
# This helps users and packagers who insist on recreating the precomputed files (e.g., Gentoo).
80-
librustsecp256k1_v0_11_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)
80+
librustsecp256k1_v0_12_precomputed_la_CPPFLAGS = -I$(top_srcdir)/src $(SECP_CONFIG_DEFINES)
8181

8282
if USE_EXTERNAL_ASM
83-
COMMON_LIB = librustsecp256k1_v0_11_common.la
83+
COMMON_LIB = librustsecp256k1_v0_12_common.la
8484
else
8585
COMMON_LIB =
8686
endif
@@ -91,14 +91,14 @@ pkgconfig_DATA = libsecp256k1.pc
9191

9292
if USE_EXTERNAL_ASM
9393
if USE_ASM_ARM
94-
librustsecp256k1_v0_11_common_la_SOURCES = src/asm/field_10x26_arm.s
94+
librustsecp256k1_v0_12_common_la_SOURCES = src/asm/field_10x26_arm.s
9595
endif
9696
endif
9797

98-
librustsecp256k1_v0_11_la_SOURCES = src/secp256k1.c
99-
librustsecp256k1_v0_11_la_CPPFLAGS = $(SECP_CONFIG_DEFINES)
100-
librustsecp256k1_v0_11_la_LIBADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
101-
librustsecp256k1_v0_11_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
98+
librustsecp256k1_v0_12_la_SOURCES = src/secp256k1.c
99+
librustsecp256k1_v0_12_la_CPPFLAGS = $(SECP_CONFIG_DEFINES)
100+
librustsecp256k1_v0_12_la_LIBADD = $(COMMON_LIB) $(PRECOMPUTED_LIB)
101+
librustsecp256k1_v0_12_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
102102

103103
noinst_PROGRAMS =
104104
if USE_BENCHMARK
@@ -247,11 +247,11 @@ maintainer-clean-local: clean-precomp
247247

248248
### Pregenerated test vectors
249249
### (see the comments in the previous section for detailed rationale)
250-
TESTVECTORS = src/wycheproof/ecdsa_rustsecp256k1_v0_11_sha256_bitcoin_test.h
250+
TESTVECTORS = src/wycheproof/ecdsa_rustsecp256k1_v0_12_sha256_bitcoin_test.h
251251

252-
src/wycheproof/ecdsa_rustsecp256k1_v0_11_sha256_bitcoin_test.h:
252+
src/wycheproof/ecdsa_rustsecp256k1_v0_12_sha256_bitcoin_test.h:
253253
mkdir -p $(@D)
254-
python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_rustsecp256k1_v0_11_sha256_bitcoin_test.json > $@
254+
python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_rustsecp256k1_v0_12_sha256_bitcoin_test.json > $@
255255

256256
testvectors: $(TESTVECTORS)
257257

@@ -271,10 +271,10 @@ EXTRA_DIST += sage/gen_exhaustive_groups.sage
271271
EXTRA_DIST += sage/gen_split_lambda_constants.sage
272272
EXTRA_DIST += sage/group_prover.sage
273273
EXTRA_DIST += sage/prove_group_implementations.sage
274-
EXTRA_DIST += sage/rustsecp256k1_v0_11_params.sage
274+
EXTRA_DIST += sage/rustsecp256k1_v0_12_params.sage
275275
EXTRA_DIST += sage/weierstrass_prover.sage
276276
EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
277-
EXTRA_DIST += src/wycheproof/ecdsa_rustsecp256k1_v0_11_sha256_bitcoin_test.json
277+
EXTRA_DIST += src/wycheproof/ecdsa_rustsecp256k1_v0_12_sha256_bitcoin_test.json
278278
EXTRA_DIST += tools/tests_wycheproof_generate.py
279279

280280
if ENABLE_MODULE_ECDH

secp256k1-sys/depend/secp256k1/cmake/TryAppendCFlags.cmake

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
include(CheckCCompilerFlag)
22

3-
function(rustsecp256k1_v0_11_check_c_flags_internal flags output)
3+
function(rustsecp256k1_v0_12_check_c_flags_internal flags output)
44
string(MAKE_C_IDENTIFIER "${flags}" result)
55
string(TOUPPER "${result}" result)
66
set(result "C_SUPPORTS_${result}")
@@ -17,7 +17,7 @@ endfunction()
1717

1818
# Append flags to the COMPILE_OPTIONS directory property if CC accepts them.
1919
macro(try_append_c_flags)
20-
rustsecp256k1_v0_11_check_c_flags_internal("${ARGV}" result)
20+
rustsecp256k1_v0_12_check_c_flags_internal("${ARGV}" result)
2121
if(result)
2222
add_compile_options(${ARGV})
2323
endif()

secp256k1-sys/depend/secp256k1/contrib/lax_der_parsing.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,18 @@
77
#include <string.h>
88

99
#include "lax_der_parsing.h"
10-
extern int rustsecp256k1_v0_11_ecdsa_signature_parse_compact(
11-
const rustsecp256k1_v0_11_context *ctx,
12-
rustsecp256k1_v0_11_ecdsa_signature *sig, const unsigned char *input64);
13-
int rustsecp256k1_v0_11_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_11_context* ctx, rustsecp256k1_v0_11_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
10+
extern int rustsecp256k1_v0_12_ecdsa_signature_parse_compact(
11+
const rustsecp256k1_v0_12_context *ctx,
12+
rustsecp256k1_v0_12_ecdsa_signature *sig, const unsigned char *input64);
13+
int rustsecp256k1_v0_12_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_12_context* ctx, rustsecp256k1_v0_12_ecdsa_signature* sig, const unsigned char *input, size_t inputlen) {
1414
size_t rpos, rlen, spos, slen;
1515
size_t pos = 0;
1616
size_t lenbyte;
1717
unsigned char tmpsig[64] = {0};
1818
int overflow = 0;
1919

2020
/* Hack to initialize sig with a correctly-parsed but invalid signature. */
21-
rustsecp256k1_v0_11_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
21+
rustsecp256k1_v0_12_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
2222

2323
/* Sequence tag byte */
2424
if (pos == inputlen || input[pos] != 0x30) {
@@ -139,11 +139,11 @@ int rustsecp256k1_v0_11_ecdsa_signature_parse_der_lax(const rustsecp256k1_v0_11_
139139
}
140140

141141
if (!overflow) {
142-
overflow = !rustsecp256k1_v0_11_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
142+
overflow = !rustsecp256k1_v0_12_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
143143
}
144144
if (overflow) {
145145
memset(tmpsig, 0, 64);
146-
rustsecp256k1_v0_11_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
146+
rustsecp256k1_v0_12_ecdsa_signature_parse_compact(ctx, sig, tmpsig);
147147
}
148148
return 1;
149149
}

secp256k1-sys/depend/secp256k1/contrib/lax_der_parsing.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
* certain violations are easily supported. You may need to adapt it.
2727
*
2828
* Do not use this for new systems. Use well-defined DER or compact signatures
29-
* instead if you have the choice (see rustsecp256k1_v0_11_ecdsa_signature_parse_der and
30-
* rustsecp256k1_v0_11_ecdsa_signature_parse_compact).
29+
* instead if you have the choice (see rustsecp256k1_v0_12_ecdsa_signature_parse_der and
30+
* rustsecp256k1_v0_12_ecdsa_signature_parse_compact).
3131
*
3232
* The supported violations are:
3333
* - All numbers are parsed as nonnegative integers, even though X.609-0207
@@ -83,9 +83,9 @@ extern "C" {
8383
* encoded numbers are out of range, signature validation with it is
8484
* guaranteed to fail for every message and public key.
8585
*/
86-
int rustsecp256k1_v0_11_ecdsa_signature_parse_der_lax(
87-
const rustsecp256k1_v0_11_context* ctx,
88-
rustsecp256k1_v0_11_ecdsa_signature* sig,
86+
int rustsecp256k1_v0_12_ecdsa_signature_parse_der_lax(
87+
const rustsecp256k1_v0_12_context* ctx,
88+
rustsecp256k1_v0_12_ecdsa_signature* sig,
8989
const unsigned char *input,
9090
size_t inputlen
9191
) SECP256K1_ARG_NONNULL(1) SECP256K1_ARG_NONNULL(2) SECP256K1_ARG_NONNULL(3);

secp256k1-sys/depend/secp256k1/contrib/lax_der_privatekey_parsing.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
#include "lax_der_privatekey_parsing.h"
1010

11-
int ec_privkey_import_der(const rustsecp256k1_v0_11_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
11+
int ec_privkey_import_der(const rustsecp256k1_v0_12_context* ctx, unsigned char *out32, const unsigned char *privkey, size_t privkeylen) {
1212
const unsigned char *end = privkey + privkeylen;
1313
int lenb = 0;
1414
int len = 0;
@@ -45,17 +45,17 @@ int ec_privkey_import_der(const rustsecp256k1_v0_11_context* ctx, unsigned char
4545
return 0;
4646
}
4747
if (privkey[1]) memcpy(out32 + 32 - privkey[1], privkey + 2, privkey[1]);
48-
if (!rustsecp256k1_v0_11_ec_seckey_verify(ctx, out32)) {
48+
if (!rustsecp256k1_v0_12_ec_seckey_verify(ctx, out32)) {
4949
memset(out32, 0, 32);
5050
return 0;
5151
}
5252
return 1;
5353
}
5454

55-
int ec_privkey_export_der(const rustsecp256k1_v0_11_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
56-
rustsecp256k1_v0_11_pubkey pubkey;
55+
int ec_privkey_export_der(const rustsecp256k1_v0_12_context *ctx, unsigned char *privkey, size_t *privkeylen, const unsigned char *key32, int compressed) {
56+
rustsecp256k1_v0_12_pubkey pubkey;
5757
size_t pubkeylen = 0;
58-
if (!rustsecp256k1_v0_11_ec_pubkey_create(ctx, &pubkey, key32)) {
58+
if (!rustsecp256k1_v0_12_ec_pubkey_create(ctx, &pubkey, key32)) {
5959
*privkeylen = 0;
6060
return 0;
6161
}
@@ -79,7 +79,7 @@ int ec_privkey_export_der(const rustsecp256k1_v0_11_context *ctx, unsigned char
7979
memcpy(ptr, key32, 32); ptr += 32;
8080
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
8181
pubkeylen = 33;
82-
rustsecp256k1_v0_11_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
82+
rustsecp256k1_v0_12_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_COMPRESSED);
8383
ptr += pubkeylen;
8484
*privkeylen = ptr - privkey;
8585
} else {
@@ -104,7 +104,7 @@ int ec_privkey_export_der(const rustsecp256k1_v0_11_context *ctx, unsigned char
104104
memcpy(ptr, key32, 32); ptr += 32;
105105
memcpy(ptr, middle, sizeof(middle)); ptr += sizeof(middle);
106106
pubkeylen = 65;
107-
rustsecp256k1_v0_11_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
107+
rustsecp256k1_v0_12_ec_pubkey_serialize(ctx, ptr, &pubkeylen, &pubkey, SECP256K1_EC_UNCOMPRESSED);
108108
ptr += pubkeylen;
109109
*privkeylen = ptr - privkey;
110110
}

secp256k1-sys/depend/secp256k1/contrib/lax_der_privatekey_parsing.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ extern "C" {
4343
/** Export a private key in DER format.
4444
*
4545
* Returns: 1 if the private key was valid.
46-
* Args: ctx: pointer to a context object (not rustsecp256k1_v0_11_context_static).
46+
* Args: ctx: pointer to a context object (not rustsecp256k1_v0_12_context_static).
4747
* Out: privkey: pointer to an array for storing the private key in BER.
4848
* Should have space for 279 bytes, and cannot be NULL.
4949
* privkeylen: Pointer to an int where the length of the private key in
@@ -57,10 +57,10 @@ extern "C" {
5757
* simple 32-byte private keys are sufficient.
5858
*
5959
* Note that this function does not guarantee correct DER output. It is
60-
* guaranteed to be parsable by rustsecp256k1_v0_11_ec_privkey_import_der
60+
* guaranteed to be parsable by rustsecp256k1_v0_12_ec_privkey_import_der
6161
*/
6262
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der(
63-
const rustsecp256k1_v0_11_context* ctx,
63+
const rustsecp256k1_v0_12_context* ctx,
6464
unsigned char *privkey,
6565
size_t *privkeylen,
6666
const unsigned char *seckey,
@@ -82,7 +82,7 @@ SECP256K1_WARN_UNUSED_RESULT int ec_privkey_export_der(
8282
* key.
8383
*/
8484
SECP256K1_WARN_UNUSED_RESULT int ec_privkey_import_der(
85-
const rustsecp256k1_v0_11_context* ctx,
85+
const rustsecp256k1_v0_12_context* ctx,
8686
unsigned char *seckey,
8787
const unsigned char *privkey,
8888
size_t privkeylen

secp256k1-sys/depend/secp256k1/doc/ellswift.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,8 @@ but the approach here is simple enough and gives fairly uniform output even in t
144144
**Note**: in the paper these conditions result in $\infty$ as output, due to the use of projective coordinates there.
145145
We wish to avoid the need for callers to deal with this special case.
146146

147-
This is implemented in `rustsecp256k1_v0_11_ellswift_xswiftec_frac_var` (which decodes to an x-coordinate represented as a fraction), and
148-
in `rustsecp256k1_v0_11_ellswift_xswiftec_var` (which outputs the actual x-coordinate).
147+
This is implemented in `rustsecp256k1_v0_12_ellswift_xswiftec_frac_var` (which decodes to an x-coordinate represented as a fraction), and
148+
in `rustsecp256k1_v0_12_ellswift_xswiftec_var` (which outputs the actual x-coordinate).
149149

150150
## 3. The encoding function
151151

@@ -247,7 +247,7 @@ the loop can be simplified to only compute one of the inverses instead of all of
247247
* Let $t = G_{c,u}(x).$
248248
* If $t \neq \bot$, return $(u, t)$; restart loop otherwise.
249249

250-
This is implemented in `rustsecp256k1_v0_11_ellswift_xelligatorswift_var`.
250+
This is implemented in `rustsecp256k1_v0_12_ellswift_xelligatorswift_var`.
251251

252252
### 3.3 Finding the inverse
253253

@@ -388,7 +388,7 @@ Specialized for odd-ordered $a=0$ curves:
388388
* If $c \in \\{4, 6\\}:$ return $w(\frac{-\sqrt{-3}+1}{2}u + v).$
389389
* If $c \in \\{5, 7\\}:$ return $w(\frac{-\sqrt{-3}-1}{2}u - v).$
390390

391-
This is implemented in `rustsecp256k1_v0_11_ellswift_xswiftec_inv_var`.
391+
This is implemented in `rustsecp256k1_v0_12_ellswift_xswiftec_inv_var`.
392392

393393
And the x-only ElligatorSwift encoding algorithm is still:
394394

@@ -471,11 +471,11 @@ as decoder:
471471
* Let $y = \sqrt{g(x)}.$
472472
* Return $(x, y)$ if $sign(y) = sign(t)$; $(x, -y)$ otherwise.
473473

474-
This is implemented in `rustsecp256k1_v0_11_ellswift_swiftec_var`. The used $sign(x)$ function is the parity of $x$ when represented as in integer in $[0,q).$
474+
This is implemented in `rustsecp256k1_v0_12_ellswift_swiftec_var`. The used $sign(x)$ function is the parity of $x$ when represented as in integer in $[0,q).$
475475

476476
The corresponding encoder would invoke the x-only one, but negating the output $t$ if $sign(t) \neq sign(y).$
477477

478-
This is implemented in `rustsecp256k1_v0_11_ellswift_elligatorswift_var`.
478+
This is implemented in `rustsecp256k1_v0_12_ellswift_elligatorswift_var`.
479479

480480
Note that this is only intended for encoding points where both the x-coordinate and y-coordinate are unpredictable. When encoding x-only points
481481
where the y-coordinate is implicitly even (or implicitly square, or implicitly in $[0,q/2]$), the encoder in

0 commit comments

Comments
 (0)