Commit Graph

80 Commits

Author SHA1 Message Date
Jonas Nick 613c34cd86 Remove test in configure.ac because it doesn't have an effect 2020-01-05 15:16:33 +00:00
djb dcb2e3b3ff
variable signing precompute table
make ECMULT_GEN_PREC_BITS configurable

ecmult_static_context.h: add compile time config assertion (#3) - Prevents accidentally using a file which was generated with a
different configuration.

README: mention valgrind issue

With --with-ecmult-gen-precision=8, valgrind needs a max stack size
adjustment to not run into a stack switching heuristic:

http://valgrind.org/docs/manual/manual-core.html

> -max-stackframe= [default: 2000000]
> The maximum size of a stack frame. If the stack pointer moves by more than this amount then Valgrind will assume that the program is switching to a different stack.
You may need to use this option if your program has large stack-allocated arrays.

basic-config: undef ECMULT_WINDOW_SIZE before (re-)defining it
2019-09-05 09:19:41 +02:00
Tim Ruffing a467047e11
Make ./configure string consistent
This was forgotten in some PR rebase.
2019-09-04 18:53:08 +02:00
Tim Ruffing 5db782e655 Allow usage of external default callbacks 2019-05-26 22:32:36 +02:00
Tim Ruffing a61a93ff50 Clean up ./configure help strings 2019-05-24 21:02:31 +02:00
Tim Ruffing 2842dc523e Make WINDOW_G configurable
This makes WINDOW_G a configurable value in the range of [2..24].
The upper limit of 24 is a defensive choice. The code is probably
correct for values up to 27 but those larger values yield in huge
tables (>= 256MiB), which are i) unlikely to be really beneficial
in practice and ii) increasingly difficult to test.
2019-05-24 21:02:31 +02:00
DesWurstes 310111e093
Keep LDFLAGS if `--coverage` 2019-02-25 11:34:52 +03:00
Gregory Maxwell 5545e13dea
Merge #584: configure: Use CFLAGS_FOR_BUILD when checking native compiler
a34bcaa Actually pass CFLAGS_FOR_BUILD and LDFLAGS_FOR_BUILD to linker (Tim Ruffing)
2d5f4ce configure: Use CFLAGS_FOR_BUILD when checking native compiler (Tim Ruffing)

Pull request description:

  This fixes a bug where configure would fail or disable static
  ecmult tables because it wrongly checks the native compiler using
  the target CFLAGS (instead of the native CFLAGS_FOR_BUILD).

  Moreover, this commit adds tests to figure out whether the native
  compiler supports the warning flags passed during the build, and it
  contains a few minor improvements to the code that checks the native
  compiler.

Tree-SHA512: 31a92a5516cf2f9801c918edfba0059aa4f8549b0c1de94fc166b5e92ad1868a480c48cdc5ff62679ba20e26f4a0e2948c71fd2b3e80766673d2bf7512da3875
2019-02-22 01:29:02 +00:00
Gregory Maxwell 6492bf88cc
Merge #518: Summarize build options after running configure
3965027 Summarize build options in configure script (Evan Klitzke)

Pull request description:

  This is a trivial build system change to summarize the build options after running configure.

  Example output:
  ```
  $ ./configure
  ....
  <many lines omitted>
  ...
  config.status: src/libsecp256k1-config.h is unchanged
  config.status: executing depfiles commands
  config.status: executing libtool commands

  Build Options:
    with endomorphism   = no
    with ecmult precomp = yes
    with jni            = no
    module ecdh         = no
    module recovery     = no

    asm                 = x86_64
    bignum              = gmp
    field               = 64bit
    scalar              = 64bit

    CC                  = gcc
    CFLAGS              = -g -O2 -W -std=c89 -pedantic -Wall -Wextra -Wcast-align -Wnested-externs -Wshadow -Wstrict-prototypes -Wno-unused-function -Wno-long-long -Wno-overlength-strings -fvisibility=hidden -O3
    CPPFLAGS            =
    LDFLAGS             =
  ```

  I tried to just include the configure options that looked interesting; let me know if there are any I didn't include that I should have.

Tree-SHA512: 428381654d772f76bc81210d39ba5c3f07a94dc6a6378a02ccc6f23ebce7f501896268bcd2e94e2b0d8aea54c9c70c44a9238a0f0960600f463b1e2847c7ed1f
2019-02-21 04:44:01 +00:00
Gregory Maxwell 58df8d03ad
Merge #511: Portability fix for the configure scripts generated
270f6c8 Portability fix for the configure scripts generated (Pierre Pronchery)

Pull request description:

  Found thanks to the developer checks from the pkgsrc software
  distribution (for NetBSD, SmartOS, Minix, MacOS X, Linux, and more).

Tree-SHA512: 2589545aa4d0620db66e79df1dc148a487384b5169ba7323937490d802973388859d30d45b35ee3e614be6d49cb694f37f585a16caa87ad1e500a0b7368dcc0a
2019-02-21 04:28:20 +00:00
Tim Ruffing 2d5f4cebdc configure: Use CFLAGS_FOR_BUILD when checking native compiler
This fixes a bug where configure would fail or disable static
ecmult tables because it wrongly checks the native compiler using
the target CFLAGS (instead of the native CFLAGS_FOR_BUILD), and
similar for CPPFLAGS and LDFLAGS.

Moreover, this commit adds tests to figure out whether the native
compiler supports the warning flags passed during the build, and it
contains a few minor improvements to the code that checks the native
compiler.
2019-02-10 11:56:36 +01:00
Tim Ruffing c663397f46 Use __GNUC_PREREQ for detecting __builtin_expect 2018-12-17 11:47:25 +01:00
Evan Klitzke 3965027c81
Summarize build options in configure script 2018-03-27 16:10:15 -07:00
Pierre Pronchery 270f6c80db Portability fix for the configure scripts generated
Found thanks to the developer checks from the pkgsrc software
distribution (for NetBSD, SmartOS, Minix, MacOS X, Linux, and more).
2018-02-26 02:22:11 +01:00
Gregory Maxwell b549d3d5f7
Merge #472: [build] Set --enable-jni to no by default instead of auto.
57752d2 [build] Set --enable-jni to no by default instead of auto. (Karl-Johan Alm)

Pull request description:

  Having `--enable-jni` be `auto` doesn't make a lot of sense, and results in things like https://github.com/bitcoin/bitcoin/pull/11056.

Tree-SHA512: 27d6ea041f5d6e249857869ab87b8f7b1f6d18ec5ec82d2c46e692cd690b9f5c5857886725901a29d3539d427d8b6154d0c7909cfa2ce30bb3d4460c05708386
2018-02-06 22:54:03 +00:00
Pieter Wuille 7a78f60598 Print whether we're building benchmarks 2017-09-27 17:25:12 -07:00
Pieter Wuille 4afec9f1ae Build benchmarks by default 2017-09-27 17:25:12 -07:00
Karl-Johan Alm 57752d28b3
[build] Set --enable-jni to no by default instead of auto. 2017-08-17 17:10:57 +09:00
Andrew Poelstra a724d7296d configure: add --enable-coverage to set options for coverage analysis 2016-11-28 03:29:01 +00:00
Andrew Poelstra 20b8877be1 Add exhaustive test for group functions on a low-order subgroup
We observe that when changing the b-value in the elliptic curve formula
`y^2 = x^3 + ax + b`, the group law is unchanged. Therefore our functions
for secp256k1 will be correct if and only if they are correct when applied
to the curve defined by `y^2 = x^3 + 4` defined over the same field. This
curve has a point P of order 199.

This commit adds a test which computes the subgroup generated by P and
exhaustively checks that addition of every pair of points gives the correct
result.

Unfortunately we cannot test const-time scalar multiplication by the same
mechanism. The reason is that these ecmult functions both compute a wNAF
representation of the scalar, and this representation is tied to the order
of the group.

Testing with the incomplete version of gej_add_ge (found in 5de4c5dff^)
shows that this detects the incompleteness when adding P - 106P, which
is exactly what we expected since 106 is a cube root of 1 mod 199.
2016-11-25 20:45:29 +00:00
Pieter Wuille e06e878fd7 Remove Schnorr experiment 2016-11-17 18:55:06 -08:00
Cory Fields 00c5d2e142 fix auto-enabled static precompuatation
This was broken in aa0b1fd149
2016-09-07 12:16:15 -04:00
Pieter Wuille 65285a63ee
Merge #403: configure: add flag to disable OpenSSL tests
a9b2a5d configure: add flag to disable OpenSSL tests (Andrew Poelstra)
2016-07-06 12:08:16 +02:00
Andrew Poelstra a9b2a5d850 configure: add flag to disable OpenSSL tests
OpenSSL messes up valgrind.
2016-07-06 08:25:33 +00:00
Pieter Wuille 24ad20f75b
Merge #399: build: verify that the native compiler works for static precomp
aa0b1fd build: verify that the native compiler works for static precomp (Cory Fields)
2016-06-29 11:11:46 +02:00
Cory Fields aa0b1fd149 build: verify that the native compiler works for static precomp 2016-05-27 15:45:14 -04:00
Pieter Wuille eee808d809 Test whether ECDH and Schnorr are enabled for JNI 2016-05-25 19:15:42 +02:00
Wladimir J. van der Laan 001f1763c7 ARM assembly implementation of field_10x26 inner
Rebased-by: Pieter Wuille <pieter.wuille@gmail.com>
2016-05-25 18:27:47 +02:00
GreenAddress 3093576aa4 JNI library
Squashed and rebased. Thanks to @theuni and @faizkhan00 for doing
the majority of work here! Also thanks to @btchip for help with debugging
and review.
2016-02-01 14:07:18 +01:00
Pieter Wuille 83221ecb00 Add experimental features to configure 2015-11-27 00:20:28 +01:00
Gregory Maxwell 118cd8210f Use explicit symbol visibility.
The use of static makes this somewhat redundant currently, though if
 we later have multiple compilation units it will be needed.

This also sets the dllexport needed for shared libraries on win32.
2015-09-25 05:42:20 +00:00
Pieter Wuille 85e3a2cc08
Merge pull request #112
2b4cf41 Use pkg-config always when possible, with failover to manual checks for libcrypto (Luke Dashjr)
2015-09-04 20:24:42 +02:00
Pieter Wuille 9f443be086 Move pubkey recovery code to separate module 2015-08-28 01:51:52 +02:00
Pieter Wuille 9d96e362a5
Merge pull request #280
ed5334a Update configure.ac to make it build on OpenBSD (mlmikael)
2015-08-04 16:32:39 +02:00
Pieter Wuille a5a66c70b6 Add support for custom EC-Schnorr-SHA256 signatures 2015-08-03 20:08:51 +02:00
Andrew Poelstra 0739bbb6f0 Add ECDH module which works by hashing the output of ecmult_const 2015-08-01 10:57:33 -05:00
mlmikael ed5334a7fe Update configure.ac to make it build on OpenBSD
This update is to make libsecp256k1 build on OpenBSD (more specifically OpenBSD 5.7 with Autotools 2.69).

Without the "AM_PROG_CC_C_O" line in configure.ac, ./autogen.sh crashes with "Makefile.am: C objects in subdir but `AM_PROG_CC_C_O' not in `configure.ac'\nautoreconf-2.69: automake failed with exit status: 1".
2015-07-19 16:07:46 +02:00
Pieter Wuille a83bb48068 Make ecmult static precomputation default 2015-07-15 21:41:51 -04:00
Thomas Daede fbecc38a89 Add ability to use a statically generated ecmult context.
This vastly shrinks the size of the context required for signing on devices with
memory-mapped Flash.

Tables are generated by the new gen_context tool into a header.
2015-07-13 18:00:03 -07:00
Pieter Wuille 4bc273bd9c
Merge pull request #222
7c3771d Disable overlength-strings warnings. (evoskuil)
2015-02-24 02:37:58 -08:00
evoskuil 7c3771dd0f Disable overlength-strings warnings. 2015-02-23 14:12:25 -08:00
Pieter Wuille ae55e850c7 Use faster byteswapping and avoid alignment-increasing casts. 2015-02-23 04:58:58 -08:00
Luke Dashjr 2b4cf416e7 Use pkg-config always when possible, with failover to manual checks for libcrypto 2015-02-13 23:44:07 +00:00
Gregory Maxwell f735446c4d Convert the rest of the codebase to C89.
Update build system to enforce -std=c89 -pedantic.
2015-01-25 17:44:10 +00:00
Pieter Wuille 7277fd76e2 Remove GMP field implementation 2014-12-17 12:41:31 +01:00
Pieter Wuille 1ba4a60a51 Configure options reorganization 2014-12-13 15:04:28 +01:00
Pieter Wuille 3c0f246e7e
Merge pull request #157
5190079 build: use subdir-objects for automake (Cory Fields)
2014-12-12 15:48:28 +01:00
Pieter Wuille 808dd9b3f5
Merge pull request #156
8336040 build: disable benchmark by default (Cory Fields)
2014-12-12 15:46:50 +01:00
Cory Fields 28ade27da1 build: nuke bashisms 2014-12-11 21:24:35 -05:00
Cory Fields 5190079e31 build: use subdir-objects for automake 2014-12-11 20:18:54 -05:00