Skip to content

Commit 6115628

Browse files
committed
Squashed 'src/secp256k1/' changes from 642c885b61..2f2ccc4695
2f2ccc4695 Merge bitcoin-core/secp256k1#1600: cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable 421ed1b46f cmake: Introduce `SECP256K1_APPEND_LDFLAGS` variable 1988855079 Merge bitcoin-core/secp256k1#1586: fix: remove duplicate 'the' from header file comment b307614401 Merge bitcoin-core/secp256k1#1583: ci: Bump GCC_SNAPSHOT_MAJOR to 15 fa67b6752d refactor: Use array initialization for unterminated strings 9b0f37bff1 fix: remove duplicate 'the' from header file comment e34b476730 ci: Bump GCC_SNAPSHOT_MAJOR to 15 3fdf146bad Merge bitcoin-core/secp256k1#1578: ci: Silent Homebrew's noisy reinstall warnings f8c1b0e0e6 Merge bitcoin-core/secp256k1#1577: release cleanup: bump version after 0.5.1 7057d3c9af ci: Silent Homebrew's noisy reinstall warnings c3e40d75db release cleanup: bump version after 0.5.1 git-subtree-dir: src/secp256k1 git-subtree-split: 2f2ccc469540fde6495959cec061e95aab033148
1 parent 41797f8 commit 6115628

File tree

11 files changed

+35
-21
lines changed

11 files changed

+35
-21
lines changed

.github/workflows/ci.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,7 @@ jobs:
632632

633633
- name: Install Homebrew packages
634634
run: |
635-
brew install automake libtool gcc
635+
brew install --quiet automake libtool gcc
636636
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
637637
638638
- name: Install and cache Valgrind
@@ -691,7 +691,7 @@ jobs:
691691

692692
- name: Install Homebrew packages
693693
run: |
694-
brew install automake libtool gcc
694+
brew install --quiet automake libtool gcc
695695
ln -s $(brew --prefix gcc)/bin/gcc-?? /usr/local/bin/gcc
696696
697697
- name: CI script

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [Unreleased]
9+
810
## [0.5.1] - 2024-08-01
911

1012
#### Added
@@ -141,6 +143,7 @@ This version was in fact never released.
141143
The number was given by the build system since the introduction of autotools in Jan 2014 (ea0fe5a5bf0c04f9cc955b2966b614f5f378c6f6).
142144
Therefore, this version number does not uniquely identify a set of source files.
143145

146+
[unreleased]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.1...HEAD
144147
[0.5.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.5.0...v0.5.1
145148
[0.5.0]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.1...v0.5.0
146149
[0.4.1]: https://github.com/bitcoin-core/secp256k1/compare/v0.4.0...v0.4.1

CMakeLists.txt

+13-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ project(libsecp256k1
44
# The package (a.k.a. release) version is based on semantic versioning 2.0.0 of
55
# the API. All changes in experimental modules are treated as
66
# backwards-compatible and therefore at most increase the minor version.
7-
VERSION 0.5.1
7+
VERSION 0.5.2
88
DESCRIPTION "Optimized C library for ECDSA signatures and secret/public key operations on curve secp256k1."
99
HOMEPAGE_URL "https://github.com/bitcoin-core/secp256k1"
1010
LANGUAGES C
@@ -27,7 +27,7 @@ endif()
2727
# All changes in experimental modules are treated as if they don't affect the
2828
# interface and therefore only increase the revision.
2929
set(${PROJECT_NAME}_LIB_VERSION_CURRENT 4)
30-
set(${PROJECT_NAME}_LIB_VERSION_REVISION 1)
30+
set(${PROJECT_NAME}_LIB_VERSION_REVISION 2)
3131
set(${PROJECT_NAME}_LIB_VERSION_AGE 2)
3232

3333
set(CMAKE_C_STANDARD 90)
@@ -276,6 +276,14 @@ if(SECP256K1_APPEND_CFLAGS)
276276
string(APPEND CMAKE_C_COMPILE_OBJECT " ${SECP256K1_APPEND_CFLAGS}")
277277
endif()
278278

279+
set(SECP256K1_APPEND_LDFLAGS "" CACHE STRING "Linker flags that are appended to the command line after all other flags added by the build system. This variable is intended for debugging and special builds.")
280+
if(SECP256K1_APPEND_LDFLAGS)
281+
# Appending to this low-level rule variable is the only way to
282+
# guarantee that the flags appear at the end of the command line.
283+
string(APPEND CMAKE_C_CREATE_SHARED_LIBRARY " ${SECP256K1_APPEND_LDFLAGS}")
284+
string(APPEND CMAKE_C_LINK_EXECUTABLE " ${SECP256K1_APPEND_LDFLAGS}")
285+
endif()
286+
279287
add_subdirectory(src)
280288
if(SECP256K1_BUILD_EXAMPLES)
281289
add_subdirectory(examples)
@@ -355,6 +363,9 @@ endif()
355363
if(SECP256K1_APPEND_CFLAGS)
356364
message("SECP256K1_APPEND_CFLAGS ............... ${SECP256K1_APPEND_CFLAGS}")
357365
endif()
366+
if(SECP256K1_APPEND_LDFLAGS)
367+
message("SECP256K1_APPEND_LDFLAGS .............. ${SECP256K1_APPEND_LDFLAGS}")
368+
endif()
358369
message("")
359370
if(print_msan_notice)
360371
message(

ci/linux-debian.Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ RUN apt-get update && apt-get install --no-install-recommends -y \
4040
apt-get clean && rm -rf /var/lib/apt/lists/*
4141

4242
# Build and install gcc snapshot
43-
ARG GCC_SNAPSHOT_MAJOR=14
43+
ARG GCC_SNAPSHOT_MAJOR=15
4444
RUN apt-get update && apt-get install --no-install-recommends -y wget libgmp-dev libmpfr-dev libmpc-dev flex && \
4545
mkdir gcc && cd gcc && \
4646
wget --progress=dot:giga --https-only --recursive --accept '*.tar.xz' --level 1 --no-directories "https://gcc.gnu.org/pub/gcc/snapshots/LATEST-${GCC_SNAPSHOT_MAJOR}" && \

configure.ac

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ AC_PREREQ([2.60])
55
# backwards-compatible and therefore at most increase the minor version.
66
define(_PKG_VERSION_MAJOR, 0)
77
define(_PKG_VERSION_MINOR, 5)
8-
define(_PKG_VERSION_PATCH, 1)
9-
define(_PKG_VERSION_IS_RELEASE, true)
8+
define(_PKG_VERSION_PATCH, 2)
9+
define(_PKG_VERSION_IS_RELEASE, false)
1010

1111
# The library version is based on libtool versioning of the ABI. The set of
1212
# rules for updating the version can be found here:
1313
# https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html
1414
# All changes in experimental modules are treated as if they don't affect the
1515
# interface and therefore only increase the revision.
1616
define(_LIB_VERSION_CURRENT, 4)
17-
define(_LIB_VERSION_REVISION, 1)
17+
define(_LIB_VERSION_REVISION, 2)
1818
define(_LIB_VERSION_AGE, 2)
1919

2020
AC_INIT([libsecp256k1],m4_join([.], _PKG_VERSION_MAJOR, _PKG_VERSION_MINOR, _PKG_VERSION_PATCH)m4_if(_PKG_VERSION_IS_RELEASE, [true], [], [-dev]),[https://github.com/bitcoin-core/secp256k1/issues],[libsecp256k1],[https://github.com/bitcoin-core/secp256k1])

examples/schnorr.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
#include "examples_util.h"
1919

2020
int main(void) {
21-
unsigned char msg[12] = "Hello World!";
21+
unsigned char msg[] = {'H', 'e', 'l', 'l', 'o', ' ', 'W', 'o', 'r', 'l', 'd', '!'};
2222
unsigned char msg_hash[32];
23-
unsigned char tag[17] = "my_fancy_protocol";
23+
unsigned char tag[] = {'m', 'y', '_', 'f', 'a', 'n', 'c', 'y', '_', 'p', 'r', 'o', 't', 'o', 'c', 'o', 'l'};
2424
unsigned char seckey[32];
2525
unsigned char randomize[32];
2626
unsigned char auxiliary_rand[32];

include/secp256k1_ellswift.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extern "C" {
3535
*
3636
* If the Y coordinate is relevant, it is given the same parity as t.
3737
*
38-
* Changes w.r.t. the the paper:
38+
* Changes w.r.t. the paper:
3939
* - The u=0, t=0, and u^3+t^2+7=0 conditions result in decoding to the point
4040
* at infinity in the paper. Here they are remapped to finite points.
4141
* - The paper uses an additional encoding bit for the parity of y. Here the

src/modules/ellswift/tests_impl.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -406,9 +406,9 @@ void run_ellswift_tests(void) {
406406
/* Test hash initializers. */
407407
{
408408
secp256k1_sha256 sha, sha_optimized;
409-
static const unsigned char encode_tag[25] = "secp256k1_ellswift_encode";
410-
static const unsigned char create_tag[25] = "secp256k1_ellswift_create";
411-
static const unsigned char bip324_tag[26] = "bip324_ellswift_xonly_ecdh";
409+
static const unsigned char encode_tag[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'e', 'n', 'c', 'o', 'd', 'e'};
410+
static const unsigned char create_tag[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'c', 'r', 'e', 'a', 't', 'e'};
411+
static const unsigned char bip324_tag[] = {'b', 'i', 'p', '3', '2', '4', '_', 'e', 'l', 'l', 's', 'w', 'i', 'f', 't', '_', 'x', 'o', 'n', 'l', 'y', '_', 'e', 'c', 'd', 'h'};
412412

413413
/* Check that hash initialized by
414414
* secp256k1_ellswift_sha256_init_encode has the expected

src/modules/schnorrsig/main_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ static void secp256k1_nonce_function_bip340_sha256_tagged_aux(secp256k1_sha256 *
4545

4646
/* algo argument for nonce_function_bip340 to derive the nonce exactly as stated in BIP-340
4747
* by using the correct tagged hash function. */
48-
static const unsigned char bip340_algo[13] = "BIP0340/nonce";
48+
static const unsigned char bip340_algo[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
4949

5050
static const unsigned char schnorrsig_extraparams_magic[4] = SECP256K1_SCHNORRSIG_EXTRAPARAMS_MAGIC;
5151

src/modules/schnorrsig/tests_impl.h

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ static void nonce_function_bip340_bitflip(unsigned char **args, size_t n_flip, s
2121
}
2222

2323
static void run_nonce_function_bip340_tests(void) {
24-
unsigned char tag[13] = "BIP0340/nonce";
25-
unsigned char aux_tag[11] = "BIP0340/aux";
26-
unsigned char algo[13] = "BIP0340/nonce";
24+
unsigned char tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
25+
unsigned char aux_tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'a', 'u', 'x'};
26+
unsigned char algo[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'n', 'o', 'n', 'c', 'e'};
2727
size_t algolen = sizeof(algo);
2828
secp256k1_sha256 sha;
2929
secp256k1_sha256 sha_optimized;
@@ -158,7 +158,7 @@ static void test_schnorrsig_api(void) {
158158
/* Checks that hash initialized by secp256k1_schnorrsig_sha256_tagged has the
159159
* expected state. */
160160
static void test_schnorrsig_sha256_tagged(void) {
161-
unsigned char tag[17] = "BIP0340/challenge";
161+
unsigned char tag[] = {'B', 'I', 'P', '0', '3', '4', '0', '/', 'c', 'h', 'a', 'l', 'l', 'e', 'n', 'g', 'e'};
162162
secp256k1_sha256 sha;
163163
secp256k1_sha256 sha_optimized;
164164

@@ -806,7 +806,7 @@ static void test_schnorrsig_sign(void) {
806806
unsigned char sk[32];
807807
secp256k1_xonly_pubkey pk;
808808
secp256k1_keypair keypair;
809-
const unsigned char msg[32] = "this is a msg for a schnorrsig..";
809+
const unsigned char msg[] = {'t', 'h', 'i', 's', ' ', 'i', 's', ' ', 'a', ' ', 'm', 's', 'g', ' ', 'f', 'o', 'r', ' ', 'a', ' ', 's', 'c', 'h', 'n', 'o', 'r', 'r', 's', 'i', 'g', '.', '.'};
810810
unsigned char sig[64];
811811
unsigned char sig2[64];
812812
unsigned char zeros64[64] = { 0 };

src/testrand_impl.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
static uint64_t secp256k1_test_state[4];
1919

2020
SECP256K1_INLINE static void testrand_seed(const unsigned char *seed16) {
21-
static const unsigned char PREFIX[19] = "secp256k1 test init";
21+
static const unsigned char PREFIX[] = {'s', 'e', 'c', 'p', '2', '5', '6', 'k', '1', ' ', 't', 'e', 's', 't', ' ', 'i', 'n', 'i', 't'};
2222
unsigned char out32[32];
2323
secp256k1_sha256 hash;
2424
int i;

0 commit comments

Comments
 (0)