Skip to content

Commit 3a0652a

Browse files
fanquakejanus
authored andcommitted
Squashed 'src/secp256k1/' changes from 0559fc6e41..8746600eec
8746600eec Merge bitcoin-core/secp256k1#1093: hash: Make code agnostic of endianness 37d36927df tests: Add tests for _read_be32 and _write_be32 912b7ccc44 Merge bitcoin-core/secp256k1#1094: doc: Clarify configure flags for optional modules 55512d30b7 doc: clean up module help text in configure.ac d9d94a9969 doc: mention optional modules in README 616b43dd3b util: Remove endianness detection 8d89b9e6e5 hash: Make code agnostic of endianness d0ad5814a5 Merge bitcoin-core/secp256k1#995: build: stop treating schnorrsig, extrakeys modules as experimental 1ac7e31c5b Merge bitcoin-core/secp256k1#1089: Schnorrsig API improvements 587239dbe3 Merge bitcoin-core/secp256k1#731: Change SHA256 byte counter from size_t to uint64_t f8d9174357 Add SHA256 bit counter tests 7f09d0f311 README: mention that ARM assembly is experimental b8f8b99f0f docs: Fix return value for functions that don't have invalid inputs f813bb0df3 schnorrsig: Adapt example to new API 99e6568fc6 schnorrsig: Rename schnorrsig_sign to schnorsig_sign32 and deprecate fc94a2da44 Use SECP256K1_DEPRECATED for existing deprecated API functions 3db0560606 Add SECP256K1_DEPRECATED attribute for marking API parts as deprecated 80cf4eea5f build: stop treating schnorrsig, extrakeys modules as experimental e0508ee9db Merge bitcoin-core/secp256k1#1090: configure: Remove redundant pkg-config code 21b2ebaf74 configure: Remove redundant pkg-config code 0e5cbd01b3 Merge bitcoin-core/secp256k1#1088: configure: Use modern way to set AR 0d253d52e8 configure: Use modern way to set AR 9b514ce1d2 Add test vector for very long SHA256 messages 8e3dde1137 Simplify struct initializer for SHA256 padding eb28464a8b Change SHA256 byte counter from size_t to uint64_t ac83be33d0 Merge bitcoin-core/secp256k1#1079: configure: Add hidden --enable-dev-mode to enable all the stuff e0838d663d configure: Add hidden --enable-dev-mode to enable all the stuff fabd579dfa configure: Remove redundant code that sets _enable variables 0d4226c051 configure: Use canonical variable prefix _enable consistently 64b34979ed Merge bitcoin-core/secp256k1#748: Add usage examples 7c9502cece Add a copy of the CC0 license to the examples 42e03432e6 Add usage examples to the readme 517644eab1 Optionally compile the examples in autotools, compile+run in travis 422a7cc86a Add a ecdh shared secret example b0cfbcc143 Add a Schnorr signing and verifying example fee7d4bf9e Add an ECDSA signing and verifying example 1253a27756 Merge bitcoin-core/secp256k1#1033: Add _fe_half and use in _gej_add_ge and _gej_double 3ef94aa5ba Merge bitcoin-core/secp256k1#1026: ecdh: Add test computing shared_secret=basepoint with random inputs 3531a43b5b ecdh: Make generator_basepoint test depend on global iteration count c881dd49bd ecdh: Add test computing shared_secret=basepoint with random inputs 077528317d Merge bitcoin-core/secp256k1#1074: ci: Retry brew update a few times to avoid random failures e51ad3b737 ci: Retry `brew update` a few times to avoid random failures b1cb969e8a ci: Revert "Attempt to make macOS builds more reliable" 5dcc6f8dbd Merge bitcoin-core/secp256k1#1069: build: Replace use of deprecated autoconf macro AC_PROG_CC_C89 59547943d6 Merge bitcoin-core/secp256k1#1072: ci: Attempt to make macOS builds more reliable 85b00a1c65 Merge bitcoin-core/secp256k1#1068: sage: Fix incompatibility with sage 9.4 ebb1beea78 sage: Ensure that constraints are always fastfracs d8d54859ed ci: Run sage prover on CI 77cfa98dbc sage: Normalize sign of polynomial factors in prover eae75869cf sage: Exit with non-zero status in case of failures d9396a56da ci: Attempt to make macOS builds more reliable e0db3f8a25 build: Replace use of deprecated autoconf macro AC_PROG_CC_C89 e848c3799c Update sage files for new formulae d64bb5d4f3 Add fe_half tests for worst-case inputs b54d843eac sage: Fix printing of errors 4eb8b932ff Further improve doubling formula using fe_half 557b31fac3 Doubling formula using fe_half 2cbb4b1a42 Run more iterations of run_field_misc 9cc5c257ed Add test for secp256k1_fe_half 925f78d55e Add _fe_half and use in _gej_add_ge e108d0039c sage: Fix incompatibility with sage 9.4 d8a2463246 Merge bitcoin-core/secp256k1#899: Reduce stratch space needed by ecmult_strauss_wnaf. 0a40a4861a Merge bitcoin-core/secp256k1#1049: Faster fixed-input ecmult tests 070e772211 Faster fixed-input ecmult tests c8aa516b57 Merge bitcoin-core/secp256k1#1064: Modulo-reduce msg32 inside RFC6979 nonce fn to match spec. Fixes #1063 b797a500ec Create a SECP256K1_ECMULT_TABLE_VERIFY macro. a731200cc3 Replace ECMULT_TABLE_GET_GE_STORAGE macro with a function. fe34d9f341 Eliminate input_pos state field from ecmult_strauss_wnaf. 0397d00ba0 Eliminate na_1 and na_lam state fields from ecmult_strauss_wnaf. 7ba3ffcca0 Remove the unused pre_a_lam allocations. b3b57ad6ee Eliminate the pre_a_lam array from ecmult_strauss_wnaf. ae7ba0f922 Remove the unused prej allocations. e5c18892db Eliminate the prej array from ecmult_strauss_wnaf. c9da1baad1 Move secp256k1_fe_one to field.h 45f37b6506 Modulo-reduce msg32 inside RFC6979 nonce fn to match spec. Fixes #1063. a1102b1219 Merge bitcoin-core/secp256k1#1029: Simpler and faster ecdh skew fixup e82144edfb Fixup skew before global Z fixup 40b624c90b Add tests for _gej_cmov 8c13a9bfe1 ECDH skews by 0 or 1 1515099433 Simpler and faster ecdh skew fixup 39a36db94a Merge bitcoin-core/secp256k1#1054: tests: Fix test whose result is implementation-defined a310e79ee5 Merge bitcoin-core/secp256k1#1052: Use xoshiro256++ instead of RFC6979 for tests 423b6d19d3 Merge bitcoin-core/secp256k1#964: Add release-process.md 9281c9f4e1 Merge bitcoin-core/secp256k1#1053: ecmult: move `_ecmult_odd_multiples_table_globalz_windowa` 77a19750b4 Use xoshiro256++ PRNG instead of RFC6979 in tests 5f2efe684e secp256k1_testrand_int(2**N) -> secp256k1_testrand_bits(N) 05e049b73c ecmult: move `_ecmult_odd_multiples_table_globalz_windowa` 3d7cbafb5f tests: Fix test whose result is implementation-defined 3ed0d02bf7 doc: add CHANGELOG template 6f42dc16c8 doc: add release_process.md 0bd3e4243c build: set library version to 0.0.0 explicitly b4b02fd8c4 build: change libsecp version from 0.1 to 0.1.0-pre 09971a3ffd Merge bitcoin-core/secp256k1#1047: ci: Various improvements 0b83b203e1 Merge bitcoin-core/secp256k1#1030: doc: Fix upper bounds + cleanup in field_5x52_impl.h comment 1287786c7a doc: Add comment to top of field_10x26_impl.h 58da5bd589 doc: Fix upper bounds + cleanup in field_5x52_impl.h comment b39d431aed Merge bitcoin-core/secp256k1#1044: Add another ecmult_multi test b4ac1a1d5f ci: Run valgrind/memcheck tasks with 2 CPUs e70acab601 ci: Use Cirrus "greedy" flag to use idle CPU time when available d07e30176e ci: Update brew on macOS 22382f0ea0 ci: Test different ecmult window sizes a69df3ad24 Merge bitcoin-core/secp256k1#816: Improve checks at top of _fe_negate methods 22d25c8e0a Add another ecmult_multi test 515e7953ca Improve checks at top of _fe_negate methods 26a022a3a0 ci: Remove STATICPRECOMPUTATION 10461d8bd3 precompute_ecmult: Always compute all tables up to default WINDOW_G be6944ade9 Merge bitcoin-core/secp256k1#1042: Follow-ups to making all tables fully static e05da9e480 Fix c++ build c45386d994 Cleanup preprocessor indentation in precompute{,d}_ecmult{,_gen} 19d96e15f9 Split off .c file from precomputed_ecmult.h 1a6691adae Split off .c file from precomputed_ecmult_gen.h bb36331412 Simplify precompute_ecmult_print_* 38cd84a0cb Compute ecmult tables at runtime for tests_exhaustive e458ec26d6 Move ecmult table computation code to separate file fc1bf9f15f Split ecmult table computation and printing 31feab053b Rename function secp256k1_ecmult_gen_{create_prec -> compute}_table 725370c3f2 Rename ecmult_gen_prec -> ecmult_gen_compute_table 075252c1b7 Rename ecmult_static_pre_g -> precomputed_ecmult 7cf47f72bc Rename ecmult_gen_static_prec_table -> precomputed_ecmult_gen f95b8106d0 Rename gen_ecmult_static_pre_g -> precompute_ecmult bae77685eb Rename gen_ecmult_gen_static_prec_table -> precompute_ecmult_gen git-subtree-dir: src/secp256k1 git-subtree-split: 8746600eec5e7fcd35dabd480839a3a4bdfee87b
1 parent dbee7f3 commit 3a0652a

Some content is hidden

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

55 files changed

+2854
-2524
lines changed

.cirrus.yml

+177-192
Large diffs are not rendered by default.

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
src/ecmult_static_pre_g.h linguist-generated
2-
src/ecmult_gen_static_prec_table.h linguist-generated
1+
src/precomputed_ecmult.c linguist-generated
2+
src/precomputed_ecmult_gen.c linguist-generated

.gitignore

+12-15
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,19 @@ bench_ecmult
33
bench_internal
44
tests
55
exhaustive_tests
6-
gen_ecmult_gen_static_prec_table
7-
gen_ecmult_static_pre_g
6+
precompute_ecmult_gen
7+
precompute_ecmult
88
valgrind_ctime_test
9+
ecdh_example
10+
ecdsa_example
11+
schnorr_example
912
*.exe
10-
*.pdb
11-
src/BGL
12-
src/BGLd
13-
src/BGL-cli
14-
src/BGL-gui
15-
src/BGL-node
16-
src/BGL-tx
17-
src/BGL-util
18-
src/BGL-chainstate
19-
src/BGL-wallet
20-
src/test/fuzz/fuzz
21-
src/test/test_BGL
22-
src/qt/test/test_BGL-qt
13+
*.so
14+
*.a
15+
*.csv
16+
!.gitignore
17+
*.log
18+
*.trs
2319

2420
# autoreconf
2521
Makefile.in
@@ -48,6 +44,7 @@ coverage.*.html
4844

4945
src/libsecp256k1-config.h
5046
src/libsecp256k1-config.h.in
47+
build-aux/ar-lib
5148
build-aux/config.guess
5249
build-aux/config.sub
5350
build-aux/depcomp

Makefile.am

+96-36
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,14 @@ noinst_HEADERS += src/eckey.h
2626
noinst_HEADERS += src/eckey_impl.h
2727
noinst_HEADERS += src/ecmult.h
2828
noinst_HEADERS += src/ecmult_impl.h
29+
noinst_HEADERS += src/ecmult_compute_table.h
30+
noinst_HEADERS += src/ecmult_compute_table_impl.h
2931
noinst_HEADERS += src/ecmult_const.h
3032
noinst_HEADERS += src/ecmult_const_impl.h
3133
noinst_HEADERS += src/ecmult_gen.h
3234
noinst_HEADERS += src/ecmult_gen_impl.h
33-
noinst_HEADERS += src/ecmult_gen_prec.h
34-
noinst_HEADERS += src/ecmult_gen_prec_impl.h
35+
noinst_HEADERS += src/ecmult_gen_compute_table.h
36+
noinst_HEADERS += src/ecmult_gen_compute_table_impl.h
3537
noinst_HEADERS += src/field_10x26.h
3638
noinst_HEADERS += src/field_10x26_impl.h
3739
noinst_HEADERS += src/field_5x52.h
@@ -42,6 +44,8 @@ noinst_HEADERS += src/modinv32.h
4244
noinst_HEADERS += src/modinv32_impl.h
4345
noinst_HEADERS += src/modinv64.h
4446
noinst_HEADERS += src/modinv64_impl.h
47+
noinst_HEADERS += src/precomputed_ecmult.h
48+
noinst_HEADERS += src/precomputed_ecmult_gen.h
4549
noinst_HEADERS += src/assumptions.h
4650
noinst_HEADERS += src/util.h
4751
noinst_HEADERS += src/scratch.h
@@ -59,15 +63,19 @@ noinst_HEADERS += contrib/lax_der_parsing.h
5963
noinst_HEADERS += contrib/lax_der_parsing.c
6064
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
6165
noinst_HEADERS += contrib/lax_der_privatekey_parsing.c
66+
noinst_HEADERS += examples/random.h
67+
68+
PRECOMPUTED_LIB = libsecp256k1_precomputed.la
69+
noinst_LTLIBRARIES = $(PRECOMPUTED_LIB)
70+
libsecp256k1_precomputed_la_SOURCES = src/precomputed_ecmult.c src/precomputed_ecmult_gen.c
71+
libsecp256k1_precomputed_la_CPPFLAGS = $(SECP_INCLUDES)
6272

6373
if USE_EXTERNAL_ASM
6474
COMMON_LIB = libsecp256k1_common.la
65-
noinst_LTLIBRARIES = $(COMMON_LIB)
6675
else
6776
COMMON_LIB =
6877
endif
69-
.PHONY: deploy FORCE
70-
.INTERMEDIATE: $(OSX_TEMP_ISO) $(COVERAGE_INFO)
78+
noinst_LTLIBRARIES += $(COMMON_LIB)
7179

7280
export PYTHONPATH
7381

@@ -78,26 +86,43 @@ endif
7886

7987
libsecp256k1_la_SOURCES = src/secp256k1.c
8088
libsecp256k1_la_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/src $(SECP_INCLUDES)
81-
libsecp256k1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB)
82-
libsecp256k1_la_LDFLAGS = -no-undefined
89+
libsecp256k1_la_LIBADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
90+
libsecp256k1_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_CURRENT):$(LIB_VERSION_REVISION):$(LIB_VERSION_AGE)
8391

8492
empty :=
8593
space := $(empty) $(empty)
8694

87-
OSX_APP=BGL-Qt.app
88-
OSX_VOLNAME = $(subst $(space),-,$(PACKAGE_NAME))
89-
OSX_DMG = $(OSX_VOLNAME).dmg
90-
OSX_TEMP_ISO = $(OSX_DMG:.dmg=).temp.iso
91-
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
92-
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/BGL.icns
93-
OSX_PLIST=$(top_builddir)/share/qt/Info.plist #not installed
94-
95-
DIST_CONTRIB = \
96-
$(top_srcdir)/test/sanitizer_suppressions/lsan \
97-
$(top_srcdir)/test/sanitizer_suppressions/tsan \
98-
$(top_srcdir)/test/sanitizer_suppressions/ubsan \
99-
$(top_srcdir)/contrib/linearize/linearize-data.py \
100-
$(top_srcdir)/contrib/linearize/linearize-hashes.py
95+
noinst_PROGRAMS =
96+
if USE_BENCHMARK
97+
noinst_PROGRAMS += bench bench_internal bench_ecmult
98+
bench_SOURCES = src/bench.c
99+
bench_LDADD = libsecp256k1.la $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB)
100+
bench_internal_SOURCES = src/bench_internal.c
101+
bench_internal_LDADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
102+
bench_internal_CPPFLAGS = $(SECP_INCLUDES)
103+
bench_ecmult_SOURCES = src/bench_ecmult.c
104+
bench_ecmult_LDADD = $(SECP_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
105+
bench_ecmult_CPPFLAGS = $(SECP_INCLUDES)
106+
endif
107+
108+
TESTS =
109+
if USE_TESTS
110+
noinst_PROGRAMS += tests
111+
tests_SOURCES = src/tests.c
112+
tests_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/include $(SECP_INCLUDES) $(SECP_TEST_INCLUDES)
113+
if VALGRIND_ENABLED
114+
tests_CPPFLAGS += -DVALGRIND
115+
noinst_PROGRAMS += valgrind_ctime_test
116+
valgrind_ctime_test_SOURCES = src/valgrind_ctime_test.c
117+
valgrind_ctime_test_LDADD = libsecp256k1.la $(SECP_LIBS) $(COMMON_LIB)
118+
endif
119+
if !ENABLE_COVERAGE
120+
tests_CPPFLAGS += -DVERIFY
121+
endif
122+
tests_LDADD = $(SECP_LIBS) $(SECP_TEST_LIBS) $(COMMON_LIB) $(PRECOMPUTED_LIB)
123+
tests_LDFLAGS = -static
124+
TESTS += tests
125+
endif
101126

102127
if USE_EXHAUSTIVE_TESTS
103128
noinst_PROGRAMS += exhaustive_tests
@@ -106,37 +131,72 @@ exhaustive_tests_CPPFLAGS = $(SECP_INCLUDES)
106131
if !ENABLE_COVERAGE
107132
exhaustive_tests_CPPFLAGS += -DVERIFY
108133
endif
134+
# Note: do not include $(PRECOMPUTED_LIB) in exhaustive_tests (it uses runtime-generated tables).
109135
exhaustive_tests_LDADD = $(SECP_LIBS) $(COMMON_LIB)
110136
exhaustive_tests_LDFLAGS = -static
111137
TESTS += exhaustive_tests
112138
endif
113139

140+
if USE_EXAMPLES
141+
noinst_PROGRAMS += ecdsa_example
142+
ecdsa_example_SOURCES = examples/ecdsa.c
143+
ecdsa_example_CPPFLAGS = -I$(top_srcdir)/include
144+
ecdsa_example_LDADD = libsecp256k1.la
145+
ecdsa_example_LDFLAGS = -static
146+
if BUILD_WINDOWS
147+
ecdsa_example_LDFLAGS += -lbcrypt
148+
endif
149+
TESTS += ecdsa_example
150+
if ENABLE_MODULE_ECDH
151+
noinst_PROGRAMS += ecdh_example
152+
ecdh_example_SOURCES = examples/ecdh.c
153+
ecdh_example_CPPFLAGS = -I$(top_srcdir)/include
154+
ecdh_example_LDADD = libsecp256k1.la
155+
ecdh_example_LDFLAGS = -static
156+
if BUILD_WINDOWS
157+
ecdh_example_LDFLAGS += -lbcrypt
158+
endif
159+
TESTS += ecdh_example
160+
endif
161+
if ENABLE_MODULE_SCHNORRSIG
162+
noinst_PROGRAMS += schnorr_example
163+
schnorr_example_SOURCES = examples/schnorr.c
164+
schnorr_example_CPPFLAGS = -I$(top_srcdir)/include
165+
schnorr_example_LDADD = libsecp256k1.la
166+
schnorr_example_LDFLAGS = -static
167+
if BUILD_WINDOWS
168+
schnorr_example_LDFLAGS += -lbcrypt
169+
endif
170+
TESTS += schnorr_example
171+
endif
172+
endif
173+
114174
### Precomputed tables
115-
EXTRA_PROGRAMS = gen_ecmult_static_pre_g gen_ecmult_gen_static_prec_table
175+
EXTRA_PROGRAMS = precompute_ecmult precompute_ecmult_gen
116176
CLEANFILES = $(EXTRA_PROGRAMS)
117177

118-
gen_ecmult_static_pre_g_SOURCES = src/gen_ecmult_static_pre_g.c
119-
gen_ecmult_static_pre_g_CPPFLAGS = $(SECP_INCLUDES)
120-
gen_ecmult_static_pre_g_LDADD = $(SECP_LIBS) $(COMMON_LIB)
178+
precompute_ecmult_SOURCES = src/precompute_ecmult.c
179+
precompute_ecmult_CPPFLAGS = $(SECP_INCLUDES)
180+
precompute_ecmult_LDADD = $(SECP_LIBS) $(COMMON_LIB)
121181

122-
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_INSTALLER_ICONS) \
123-
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
182+
precompute_ecmult_gen_SOURCES = src/precompute_ecmult_gen.c
183+
precompute_ecmult_gen_CPPFLAGS = $(SECP_INCLUDES)
184+
precompute_ecmult_gen_LDADD = $(SECP_LIBS) $(COMMON_LIB)
124185

125186
# See Automake manual, Section "Errors with distclean".
126187
# We don't list any dependencies for the prebuilt files here because
127188
# otherwise make's decision whether to rebuild them (even in the first
128189
# build by a normal user) depends on mtimes, and thus is very fragile.
129190
# This means that rebuilds of the prebuilt files always need to be
130191
# forced by deleting them, e.g., by invoking `make clean-precomp`.
131-
src/ecmult_static_pre_g.h:
132-
$(MAKE) $(AM_MAKEFLAGS) gen_ecmult_static_pre_g$(EXEEXT)
133-
./gen_ecmult_static_pre_g$(EXEEXT)
134-
src/ecmult_gen_static_prec_table.h:
135-
$(MAKE) $(AM_MAKEFLAGS) gen_ecmult_gen_static_prec_table$(EXEEXT)
136-
./gen_ecmult_gen_static_prec_table$(EXEEXT)
137-
138-
PRECOMP = src/ecmult_gen_static_prec_table.h src/ecmult_static_pre_g.h
139-
noinst_HEADERS += $(PRECOMP)
192+
src/precomputed_ecmult.c:
193+
$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT)
194+
./precompute_ecmult$(EXEEXT)
195+
src/precomputed_ecmult_gen.c:
196+
$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult_gen$(EXEEXT)
197+
./precompute_ecmult_gen$(EXEEXT)
198+
199+
PRECOMP = src/precomputed_ecmult_gen.c src/precomputed_ecmult.c
140200
precomp: $(PRECOMP)
141201

142202
# Ensure the prebuilt files will be build first (only if they don't exist,

README.md

+54-40
Original file line numberDiff line numberDiff line change
@@ -62,53 +62,67 @@ Features:
6262
* Suitable for embedded systems.
6363
* Optional module for public key recovery.
6464
* Optional module for ECDH key exchange.
65-
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki) (experimental).
66-
67-
<b>Bitgesell is a fork of BGL with the following changes:</b> <br>
68-
* Block Reward [Burn rate is 90% of tx fees]
69-
```sh
70-
nFees*0.1 + GetBlockSubsidy()
71-
```
72-
* Block Weight [10 times smaller than Bitgesell]
73-
```sh
74-
<= 400,000
75-
```
76-
* 100% Segwit
77-
```sh
78-
Eliminates problems with legacy type of transactions
79-
```
80-
* Halving Interval [Halving cycle of bitgetsell is 1yr while that of BGL is 4yr]
81-
```sh
82-
210000 blocks/4
83-
```
84-
* Block Subsidy [Max coins = 21,000,000] <br>
85-
`210000 blocks/4` <br> <hr>
86-
`Hashing algorithm for blocks is Keccak (sha-3).` <br> <hr>
87-
`The master branch is regularly built (see` [doc/build-*.md](https://github.com/BitgesellOfficial/bitgesell/tree/master/doc) `for instructions) and tested, but is not guaranteed to be completely stable.` <br> <hr>
88-
[tags](https://github.com/BitgesellOfficial/bitgesell/tags) `are created regularly to indicate new official, stable release versions of BGL Core.` <br>
89-
90-
91-
### Built With
92-
93-
* [C++](#)
94-
* [C](#)
95-
* [Python](#)
96-
* [SourcePawn](#)
97-
* [M4](#)
98-
* [Shell](#)
99-
100-
101-
<!-- GETTING STARTED -->
102-
## Getting Started
103-
104-
Visit official website: [click here](https://bitgesell.ca/) <br>
65+
* Optional module for Schnorr signatures according to [BIP-340](https://github.com/bitcoin/bips/blob/master/bip-0340.mediawiki).
66+
67+
Implementation details
68+
----------------------
69+
70+
* General
71+
* No runtime heap allocation.
72+
* Extensive testing infrastructure.
73+
* Structured to facilitate review and analysis.
74+
* Intended to be portable to any system with a C89 compiler and uint64_t support.
75+
* No use of floating types.
76+
* Expose only higher level interfaces to minimize the API surface and improve application security. ("Be difficult to use insecurely.")
77+
* Field operations
78+
* Optimized implementation of arithmetic modulo the curve's field size (2^256 - 0x1000003D1).
79+
* Using 5 52-bit limbs (including hand-optimized assembly for x86_64, by Diederik Huys).
80+
* Using 10 26-bit limbs (including hand-optimized assembly for 32-bit ARM, by Wladimir J. van der Laan).
81+
* This is an experimental feature that has not received enough scrutiny to satisfy the standard of quality of this library but is made available for testing and review by the community.
82+
* Scalar operations
83+
* Optimized implementation without data-dependent branches of arithmetic modulo the curve's order.
84+
* Using 4 64-bit limbs (relying on __int128 support in the compiler).
85+
* Using 8 32-bit limbs.
86+
* Modular inverses (both field elements and scalars) based on [safegcd](https://gcd.cr.yp.to/index.html) with some modifications, and a variable-time variant (by Peter Dettman).
87+
* Group operations
88+
* Point addition formula specifically simplified for the curve equation (y^2 = x^3 + 7).
89+
* Use addition between points in Jacobian and affine coordinates where possible.
90+
* Use a unified addition/doubling formula where necessary to avoid data-dependent branches.
91+
* Point/x comparison without a field inversion by comparison in the Jacobian coordinate space.
92+
* Point multiplication for verification (a*P + b*G).
93+
* Use wNAF notation for point multiplicands.
94+
* Use a much larger window for multiples of G, using precomputed multiples.
95+
* Use Shamir's trick to do the multiplication with the public key and the generator simultaneously.
96+
* Use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones.
97+
* Point multiplication for signing
98+
* Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions.
99+
* Intended to be completely free of timing sidechannels for secret-key operations (on reasonable hardware/toolchains)
100+
* Access the table with branch-free conditional moves so memory access is uniform.
101+
* No data-dependent branches
102+
* Optional runtime blinding which attempts to frustrate differential power analysis.
103+
* The precomputed tables add and eventually subtract points for which no known scalar (secret key) is known, preventing even an attacker with control over the secret key used to control the data internally.
104+
105+
Build steps
106+
-----------
107+
108+
libsecp256k1 is built using autotools:
105109

106110
$ ./autogen.sh
107111
$ ./configure
108112
$ make
109113
$ make check # run the test suite
110114
$ sudo make install # optional
111115

116+
To compile optional modules (such as Schnorr signatures), you need to run `./configure` with additional flags (such as `--enable-module-schnorrsig`). Run `./configure --help` to see the full list of available flags.
117+
118+
Usage examples
119+
-----------
120+
Usage examples can be found in the [examples](examples) directory. To compile them you need to configure with `--enable-examples`.
121+
* [ECDSA example](examples/ecdsa.c)
122+
* [Schnorr signatures example](examples/schnorr.c)
123+
* [Deriving a shared secret (ECDH) example](examples/ecdh.c)
124+
To compile the Schnorr signature and ECDH examples, you also need to configure with `--enable-module-schnorrsig` and `--enable-module-ecdh`.
125+
112126
Test coverage
113127
-----------
114128

ci/linux-debian.Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ RUN apt-get install --no-install-recommends --no-upgrade -y \
1919
gcc-arm-linux-gnueabihf libc6-dev-armhf-cross libc6-dbg:armhf \
2020
gcc-aarch64-linux-gnu libc6-dev-arm64-cross libc6-dbg:arm64 \
2121
gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross libc6-dbg:ppc64el \
22-
wine gcc-mingw-w64-x86-64
22+
wine gcc-mingw-w64-x86-64 \
23+
sagemath
2324

2425
# Run a dummy command in wine to make it set up configuration
2526
RUN wine64-stable xcopy || true

0 commit comments

Comments
 (0)