Skip to content

Commit

Permalink
Merge #654: [0.17 backport] Update secp-zkp to 44db4d801fff3cd9410513…
Browse files Browse the repository at this point in the history
…6cb443d603683baad2

479b6ff Squashed 'src/secp256k1/' changes from 43dd1f4fe..44db4d801 (Steven Roose)

Pull request description:

  0.17 backport of #653.

Tree-SHA512: 81271133ab3405745d47665c1f9131edbdd39f09d87a832eb8d02570ee34db6dfc7065b13c2870de15113fe8eaafda2c23ea43d89cbd2fa4ca39fa4dfbfa12f7
  • Loading branch information
instagibbs committed Jun 7, 2019
2 parents 856e33b + 1aa3afe commit ba9b83c
Show file tree
Hide file tree
Showing 60 changed files with 5,449 additions and 512 deletions.
4 changes: 3 additions & 1 deletion src/secp256k1/.gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
bench_inv
bench_ecdh
bench_ecmult
bench_generator
bench_rangeproof
bench_schnorrsig
bench_sign
bench_verify
bench_schnorr_verify
bench_recover
bench_internal
tests
Expand Down
3 changes: 1 addition & 2 deletions src/secp256k1/.travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: c
sudo: false
os: linux
addons:
apt:
packages: libgmp-dev
Expand Down Expand Up @@ -68,4 +68,3 @@ script:
- if [ -n "$HOST" ]; then export USE_HOST="--host=$HOST"; fi
- if [ "x$HOST" = "xi686-linux-gnu" ]; then export CC="$CC -m32"; fi
- ./configure --enable-experimental=$EXPERIMENTAL --enable-endomorphism=$ENDOMORPHISM --with-field=$FIELD --with-bignum=$BIGNUM --with-scalar=$SCALAR --enable-ecmult-static-precomputation=$STATICPRECOMPUTATION --enable-module-ecdh=$ECDH --enable-module-recovery=$RECOVERY --enable-module-rangeproof=$RANGEPROOF --enable-module-whitelist=$WHITELIST --enable-module-generator=$GENERATOR --enable-jni=$JNI $EXTRAFLAGS $USE_HOST && make -j2 $BUILD
os: linux
14 changes: 11 additions & 3 deletions src/secp256k1/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ else
JNI_LIB =
endif
include_HEADERS = include/secp256k1.h
include_HEADERS += include/secp256k1_preallocated.h
noinst_HEADERS =
noinst_HEADERS += src/scalar.h
noinst_HEADERS += src/scalar_4x64.h
Expand Down Expand Up @@ -114,7 +115,7 @@ exhaustive_tests_CPPFLAGS = -DSECP256K1_BUILD -I$(top_srcdir)/src $(SECP_INCLUDE
if !ENABLE_COVERAGE
exhaustive_tests_CPPFLAGS += -DVERIFY
endif
exhaustive_tests_LDADD = $(SECP_LIBS)
exhaustive_tests_LDADD = $(SECP_LIBS) $(COMMON_LIB)
exhaustive_tests_LDFLAGS = -static
TESTS += exhaustive_tests
endif
Expand Down Expand Up @@ -151,15 +152,14 @@ endif

if USE_ECMULT_STATIC_PRECOMPUTATION
CPPFLAGS_FOR_BUILD +=-I$(top_srcdir)
CFLAGS_FOR_BUILD += -Wall -Wextra -Wno-unused-function

gen_context_OBJECTS = gen_context.o
gen_context_BIN = gen_context$(BUILD_EXEEXT)
gen_%.o: src/gen_%.c
$(CC_FOR_BUILD) $(CPPFLAGS_FOR_BUILD) $(CFLAGS_FOR_BUILD) -c $< -o $@

$(gen_context_BIN): $(gen_context_OBJECTS)
$(CC_FOR_BUILD) $^ -o $@
$(CC_FOR_BUILD) $(CFLAGS_FOR_BUILD) $(LDFLAGS_FOR_BUILD) $^ -o $@

$(libsecp256k1_la_OBJECTS): src/ecmult_static_context.h
$(tests_OBJECTS): src/ecmult_static_context.h
Expand All @@ -178,6 +178,14 @@ if ENABLE_MODULE_ECDH
include src/modules/ecdh/Makefile.am.include
endif

if ENABLE_MODULE_SCHNORRSIG
include src/modules/schnorrsig/Makefile.am.include
endif

if ENABLE_MODULE_MUSIG
include src/modules/musig/Makefile.am.include
endif

if ENABLE_MODULE_RECOVERY
include src/modules/recovery/Makefile.am.include
endif
Expand Down
6 changes: 4 additions & 2 deletions src/secp256k1/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ Implementation details
* Optionally (off by default) use secp256k1's efficiently-computable endomorphism to split the P multiplicand into 2 half-sized ones.
* Point multiplication for signing
* Use a precomputed table of multiples of powers of 16 multiplied with the generator, so general multiplication becomes a series of additions.
* Access the table with branch-free conditional moves so memory access is uniform.
* No data-dependent branches
* Intended to be completely free of timing sidechannels for secret-key operations (on reasonable hardware/toolchains)
* Access the table with branch-free conditional moves so memory access is uniform.
* No data-dependent branches
* Optional runtime blinding which attempts to frustrate differential power analysis.
* The precomputed tables add and eventually subtract points for which no known scalar (private key) is known, preventing even an attacker with control over the private key used to control the data internally.

Build steps
Expand Down
Loading

0 comments on commit ba9b83c

Please sign in to comment.