Commit Graph

37 Commits

Author SHA1 Message Date
Jonas Nick 64b34979ed
Merge bitcoin-core/secp256k1#748: Add usage examples
7c9502cece Add a copy of the CC0 license to the examples (Elichai Turkel)
42e03432e6 Add usage examples to the readme (Elichai Turkel)
517644eab1 Optionally compile the examples in autotools, compile+run in travis (Elichai Turkel)
422a7cc86a Add a ecdh shared secret example (Elichai Turkel)
b0cfbcc143 Add a Schnorr signing and verifying example (Elichai Turkel)
fee7d4bf9e Add an ECDSA signing and verifying example (Elichai Turkel)

Pull request description:

ACKs for top commit:
  real-or-random:
    ACK 7c9502cece
  jonasnick:
    ACK 7c9502cece

Tree-SHA512: c475cfd5b324b1e2d7126aa5bb1e7da25183b50adb7357d464c140de83d9097cb1bdc027d09aeadf167dbf9c8afd123235b0a1a742c5795089862418fafa1964
2022-02-23 17:37:58 +00:00
Elichai Turkel 517644eab1
Optionally compile the examples in autotools, compile+run in travis 2022-02-23 16:14:58 +02:00
Tim Ruffing e51ad3b737 ci: Retry `brew update` a few times to avoid random failures 2022-02-08 14:09:58 +01:00
Tim Ruffing b1cb969e8a ci: Revert "Attempt to make macOS builds more reliable"
This reverts commit d9396a56da, which
didn't have the desired effect.
2022-02-08 13:53:05 +01:00
Jonas Nick 59547943d6
Merge bitcoin-core/secp256k1#1072: ci: Attempt to make macOS builds more reliable
d9396a56da ci: Attempt to make macOS builds more reliable (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK d9396a56da

Tree-SHA512: 68df44107d74671de148e9c3e6dbc6b16bec937137d7d9771efce10f5d66459559b372346d05ecc23237b2e3af9479156f733219717cb93f5204f9ea5b2636a9
2022-02-06 19:30:14 +00:00
Tim Ruffing d8d54859ed ci: Run sage prover on CI 2022-02-04 15:37:32 +01:00
Tim Ruffing d9396a56da ci: Attempt to make macOS builds more reliable
The macOS CI tasks often error fail when doing `brew update` with
git fetch errors:
```
remote: fatal: packfile /data/repositories/b/nw/b6/07/5c/123272362/network.git/objects/pack/pack-2139bd07361b62a358e380a0e7d58ec35593d191.pack cannot be accessed
fatal: protocol error: bad pack header
Error: Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core failed!
```
Superficially this seems to be a problem on the GitHub server because
the message shows a "remote" error. But it seems we're the only one in
the world running into this specific issue when doing `brew update`, so
it's more likely that the something else is the culprit, and this error
message is just a symptom.

This commit replaces `brew update` with a complete reinstallation of
brew. This is essentially a shot in the dark but it's worth a try, and
I doubt it's significantly more expensive. If that won't work, we may
consider simply retrying `brew update` a few times.
2022-02-04 10:55:19 +01:00
Tim Ruffing b4ac1a1d5f ci: Run valgrind/memcheck tasks with 2 CPUs
... and increase the memory only for UBSan, ASan, LSan builds. Those are
the ones who need more memory.
2021-12-22 14:57:16 +01:00
Tim Ruffing e70acab601 ci: Use Cirrus "greedy" flag to use idle CPU time when available 2021-12-22 14:57:16 +01:00
Tim Ruffing d07e30176e ci: Update brew on macOS
The preinstalled brew is very old and tries to download prebuilt bottles
from a server which is no longer available. Because that will fail, brew
falls back to building our dependencies (e.g., autotools) from source,
which takes very long.

This commit makes sure that brew is updated before we start the build.

We also need to remove the `--shallow` argument from `brew tap`. It
doesn't exist in recent brew versions.
2021-12-22 14:56:49 +01:00
Tim Ruffing 22382f0ea0 ci: Test different ecmult window sizes 2021-12-22 14:56:27 +01:00
Tim Ruffing 26a022a3a0 ci: Remove STATICPRECOMPUTATION
This has been overlooked in #988.
2021-12-20 14:18:02 +01:00
Tim Ruffing 0559fc6e41
Merge bitcoin-core/secp256k1#988: Make signing table fully static
7dfceceea6 build: Remove #undef hack for ASM in the precomputation programs (Tim Ruffing)
bb36fe9be0 ci: Test `make precomp` (Tim Ruffing)
d94a37a20c build: Remove CC_FOR_BUILD stuff (Tim Ruffing)
ad63bb4c29 build: Prebuild and distribute ecmult_gen table (Tim Ruffing)
ac49361ed0 prealloc: Get rid of manual memory management for prealloc contexts (Tim Ruffing)
6573c08f65 ecmult_gen: Tidy precomputed file and save space (Tim Ruffing)
5eba83f17c ecmult_gen: Precompute tables for all values of ECMULT_GEN_PREC_BITS (Tim Ruffing)
fdb33dd122 refactor: Make PREC_BITS a parameter of ecmult_gen_build_prec_table (Tim Ruffing)
a4875e30a6 refactor: Move default callbacks to util.h (Tim Ruffing)
4c94c55bce doc: Remove obsolete hint for valgrind stack size (Tim Ruffing)
5106226991 exhaustive_tests: Fix with ecmult_gen table with custom generator (Tim Ruffing)
e1a76530db refactor: Make generator a parameter of ecmult_gen_create_prec_table (Tim Ruffing)
9ad09f6911 refactor: Rename program that generates static ecmult_gen table (Tim Ruffing)
8ae18f1ab3 refactor: Rename file that contains static ecmult_gen table (Tim Ruffing)
00d2fa116e ecmult_gen: Make code consistent with comment (Tim Ruffing)
3b0c2185ea ecmult_gen: Simplify ecmult_gen context after making table static (Tim Ruffing)
e43ba02cfc refactor: Decouple table generation and ecmult_gen context (Tim Ruffing)
22dc2c0a0d ecmult_gen: Move table creation to new file and force static prec (Tim Ruffing)

Pull request description:

  This resolves #893,  resolves #692 (and also resolves bitcoin/bitcoin#22854).

  - [x] Extract table generation to separate function in separate file (to be used by generation script and exhaustive tests)
  - [x] Tidy up
    - [x] Remove code that deals with non-static tables
    - [x] Make functions that need ecmult_gen not depend on signing context
    - [x] Rename stuff to make it fit the new structure and consistent with how we hande verification tables (#956)
  - [x] Fix exhaustive tests
    - [x] Make table generation function take generator as input
    - [x] Overwrite the static tables with a table with custom generator in exhaustive tests
  - [x] Overhaul script that generates table files
    - [x] Make table generation function take PREC_BITS as input (I have some code already, just not yet in this branch)
    - [x] Change generation script to generate three tables (for all three values of ECMULT_GEN_PREC_BITS)
  - [x] Ship pre-built tables
    - [x] Add pregenerated table file to repo
    - [x] Remove generation of table file from build process (like in #956)
    - [x] Remove left-over stuff (e.g., detecting a compiler running on the build machine) from build system
  - [x] Final cleanups (copyright headers, commit, messages, etc.)
  - [ ] (separate PR:) Make sure link-time optimization remove corresponding static tables (and code) when no signing/verifcation function is called
  - [ ] (separate PR:) Compile precomputation as a separate object file and link it (https://github.com/bitcoin-core/secp256k1/pull/988#issuecomment-977813538)
  - [ ] (separate PR:) Document the backwards-compatible API changes made in this PR and in #956.
    - [ ] Maybe deprecate the static context

ACKs for top commit:
  sipa:
    ACK 7dfceceea6
  robot-dreams:
    ACK 7dfceceea6 (based on range-diff between 56284c7d44c0ed46e636588bfbf6c403b7dfa6c1 and 7dfceceea6)

Tree-SHA512: 6efb3f36f05efe3b79bbd877881fe1409f71fd6488d24c811b2e77d9f053bed78670dd1dcbb42ad780458a51c4ffa36de9cd6567271b22041dc7a122ceb677c5
2021-12-15 11:06:47 +01:00
Tim Ruffing d94a37a20c build: Remove CC_FOR_BUILD stuff 2021-12-09 20:52:28 +01:00
Pieter Wuille 5eb519e1f6 ci: reduce TEST_ITERS in memcheck run 2021-12-05 11:54:05 -05:00
Tim Ruffing 6ad908aa00
Merge bitcoin-core/secp256k1#1008: bench.c: add `--help` option and ci: move env variables
592661c22f ci: move test environment variable declaration to .cirrus.yml (siv2r)
dcbe84b841 bench: add --help option to bench. (siv2r)

Pull request description:

  Fixes #1005

  **Changes:**
  - added `--help` option to `bench.c`
      - `help()` function prints the help to command-line
      - `have_invalid_args()` checks if the user has entered an invalid argument
  - moved `secp256k1_bench_iters` and `secp256k1_test_iters` environment variables declaration to `.cirrus.yml`

ACKs for top commit:
  sipa:
    utACK 592661c22f
  real-or-random:
    ACK 592661c22f

Tree-SHA512: ebc6a2e6e47b529212efa1c9b75cc79649fca7f42aa75ce46502db24ac94f46b6cef59c828d13265d1fa69187a81c140d1951e7daeb7c8e008a6c1ad75259741
2021-12-05 11:24:00 +01:00
siv2r 592661c22f ci: move test environment variable declaration to .cirrus.yml
environment var moved:
    1. SECP256K1_TEST_ITERS (replaces TEST_ITERS)
    2. SECP256K1_BENCH_ITERS (replaces BENCH_ITERS)
2021-12-04 22:47:40 +05:30
Tim Ruffing 72de1359e9 ci: Enable -g if we set CFLAGS manually
This enables sanitizers to output line numbers in stack traces.
2021-11-10 15:17:26 +01:00
Pieter Wuille bc08599e77 Remove OpenSSL testing support 2021-10-14 12:39:27 -04:00
Russell O'Connor 8de2d86a06 Bump memory limits in advance of making the ecmult context static. 2021-08-20 11:11:26 -04:00
Tim Ruffing 90e83449b2 ci: Add C++ test 2021-07-05 13:57:40 +02:00
Tim Ruffing 0302138f75 ci: Make compiler warning into errors on CI
This also tidies the list of environment variables in .cirrus.yml.
2021-07-01 20:37:40 +02:00
Tim Ruffing c58c4ea470 ci: Add ppc64le build 2021-06-08 17:03:53 +02:00
Tim Ruffing a35fdd3478 ci: Run PRs on merge result even for i686
This line should have been added in c7f754fe4d.

This mistake caused some i686 builds to fail when the PR was not
rebased, see https://cirrus-ci.com/build/5156197872435200.
2021-05-31 18:11:27 +02:00
Tim Ruffing 02dcea1ad9 ci: Make test iterations configurable and tweak for sanitizer builds 2021-05-21 20:48:07 +02:00
Tim Ruffing fcfcb97e74 ci: Simplify to use generic wrapper for QEMU, Valgrind, etc 2021-05-21 20:46:48 +02:00
Tim Ruffing de4157f13a ci: Run ASan/LSan and reorganize sanitizer and Valgrind jobs 2021-05-21 12:12:46 +02:00
Pieter Wuille 8bbad7a18e Add asm build to ARM32 CI 2021-05-03 12:03:56 -07:00
Pieter Wuille 7d65ed5214 Add ARM32/ARM64 CI 2021-05-03 12:03:52 -07:00
Pieter Wuille 4dc37bf81b Add mingw32-w64/wine CI build 2021-04-30 16:37:44 -07:00
Pieter Wuille 1f233b3fa0 Remove num/gmp support
The whole "num" API and its libgmp-based implementation are now unused. Remove them.
2021-03-15 13:01:52 -07:00
Tim Ruffing 9361f360bb ci: Select number of parallel make jobs depending on CI environment
This should improve compilation times on macOS. Things can certainly
be improved further, e.g., by running the benchmarks in parallel.
2021-03-03 18:16:25 +01:00
Tim Ruffing 28eccdf806 ci: Split output of logs into multiple sections 2021-03-03 01:21:11 +01:00
Tim Ruffing c7f754fe4d ci: Run PRs on merge result instead of on the source branch
This is taken from Bitcoin Core's .cirrus.yml
2021-03-03 01:21:11 +01:00
Tim Ruffing f24e122d13 ci: Switch all Linux builds to Debian
The experiment of using Nix Shell was not really successful. Most
notably, Nix uses a bunch of wrapper scripts around compilers, which
make the build much less "pure". This may be useful but it's exactly
not what we want for CI. In particular, this resulted in gcc being used
for the "clang" builds because a wrapper script redefined the CC env
variable.

This now builds a single docker image (Debian) for all architectures
that we test in CI on Linux.
2021-03-03 00:38:01 +01:00
Tim Ruffing 2b359f1c1d ci: Enable simple cache for brewing valgrind on macOS 2021-01-29 21:54:07 +01:00
Tim Ruffing 8c02e465c5 ci: Add support for Cirrus CI 2021-01-29 21:54:07 +01:00