181 Commits

Author SHA1 Message Date
Jonas Nick
9b118bc7fb
release cleanup: bump version after 0.4.0 2023-09-04 16:27:38 +00:00
Tim Ruffing
16339804c9 release: Prepare for 0.4.0 2023-09-04 18:18:24 +02:00
Jonas Nick
78ca880788
build: enable ellswift module via SECP_CONFIG_DEFINES
...like the other modules.
2023-07-26 14:44:20 +00:00
Hennadii Stepanov
ae9db95cea
build: Introduce SECP256K1_STATIC macro for Windows users
It is a non-Libtool-specific way to explicitly specify the user's
intention to consume a static `libseck256k1`.

This change allows to get rid of MSVC linker warnings LNK4217 and
LNK4286. Also, it makes possible to merge the `SECP256K1_API` and
`SECP256K1_API_VAR` into one.
2023-07-03 13:57:11 +01:00
Pieter Wuille
c47917bbd6 Add ellswift module implementing ElligatorSwift
The scheme implemented is described below, and largely follows the paper
"SwiftEC: Shallue–van de Woestijne Indifferentiable Function To Elliptic Curves",
by Chavez-Saab, Rodriguez-Henriquez, and Tibouchi
(https://eprint.iacr.org/2022/759).

A new 64-byte public key format is introduced, with the property that *every*
64-byte array is an encoding for a non-infinite curve point. Each curve point
has roughly 2^256 distinct encodings. This permits disguising public keys as
uniformly random bytes.

The new API functions:
* secp256k1_ellswift_encode: convert a normal public key to an ellswift 64-byte
  public key, using additional entropy to pick among the many possible
  encodings.
* secp256k1_ellswift_decode: convert an ellswift 64-byte public key to a normal
  public key.
* secp256k1_ellswift_create: a faster and safer equivalent to calling
  secp256k1_ec_pubkey_create + secp256k1_ellswift_encode.
* secp256k1_ellswift_xdh: x-only ECDH directly on ellswift 64-byte public keys,
  where the key encodings are fed to the hash function.

The scheme itself is documented in secp256k1_ellswift.h.
2023-06-20 11:31:58 -04:00
Hennadii Stepanov
1549db0ca5
build: Level up MSVC warnings 2023-05-25 09:43:55 +01:00
Pieter Wuille
95448ef2f8 release cleanup: bump version after 0.3.2 2023-05-13 13:54:32 -04:00
Tim Ruffing
d490ca2046 release: Prepare for 0.3.2 2023-05-12 22:52:30 +02:00
Hennadii Stepanov
c6bb29b303
build: Rename 64bit to x86_64 2023-05-12 10:50:18 +01:00
Hennadii Stepanov
03246457a8
autotools: Add SECP_ARM32_ASM_CHECK macro 2023-05-12 10:38:51 +01:00
Hennadii Stepanov
e5cf4bf3ff
build: Rename arm to arm32 2023-05-11 10:03:23 +01:00
Hennadii Stepanov
dc0657c762
build: Fix C4005 "macro redefinition" MSVC warnings in examples 2023-04-13 12:23:30 +01:00
Jonas Nick
656c6ea8d8
release cleanup: bump version after 0.3.1 2023-04-10 19:50:27 +00:00
Tim Ruffing
898e1c676e release: Prepare for 0.3.1 2023-04-10 17:12:12 +02:00
Jonas Nick
2bca0a5cbf
Merge bitcoin-core/secp256k1#1241: build: Improve SECP_TRY_APPEND_DEFAULT_CFLAGS macro
3addb4c1e8a50df7dcf4465a7f149f78bf5af78b build: Improve `SECP_TRY_APPEND_DEFAULT_CFLAGS` macro (Hennadii Stepanov)

Pull request description:

ACKs for top commit:
  real-or-random:
    utACK 3addb4c1e8a50df7dcf4465a7f149f78bf5af78b
  jonasnick:
    ACK 3addb4c1e8a50df7dcf4465a7f149f78bf5af78b

Tree-SHA512: 918d906570d82be9354fba72bb55d50b8f661cf7cd4404dc244deb489c2bca95b3942ae8af830873ba825dc8ddc68b99c973fc984ff13fdd1f6668f412ca56a3
2023-03-28 19:02:20 +00:00
Hennadii Stepanov
3addb4c1e8
build: Improve SECP_TRY_APPEND_DEFAULT_CFLAGS macro
Co-authored-by: Tim Ruffing <crypto@timruffing.de>
2023-03-26 10:38:43 +01:00
Hennadii Stepanov
8e79c7ed11
build: Ensure no optimization when building for coverage analysis 2023-03-14 18:56:24 +00:00
Jonas Nick
28e63f7ea7
release cleanup: bump version after 0.3.0 2023-03-08 22:07:11 +00:00
Jonas Nick
b40adf2360
release: prepare for 0.3.0 2023-03-08 22:00:43 +00:00
Tim Ruffing
9a5a611a21 build: Suppress stupid MSVC linker warning
... and use correct format to pass linker flags
2023-02-06 21:44:56 +01:00
Tim Ruffing
8c7e0fc1de build: Add -Wreserved-identifier supported by clang
This warns on certain identifiers reserved by the C standard, namely
 * identifiers that begin with an underscore followed by an uppercase
   letter, and
 * identifiers in the global namespace that begin with an underscore.

We had used such identifiers in the past for macros in include guards,
and we should make sure that we don't reintroduce such identifiers
going forward.

Note that C reserves more identifiers for "future library directions",
e.g., identifiers that begin with "str" followed by a lowercase letter.
But even the C standards committee has decided that this is somewhat
silly and adopted a proposal [1] for C23 that removes the restriction
that programs using these identifiers have UB. Instead, these
identifiers are now "potentially reserved", which is not a normative
restriction but simply an informative warning that the identifiers
may become fully reserved in the future.

[1] https://www.open-std.org/jtc1/sc22/WG14/www/docs/n2625.pdf
2023-02-02 14:56:58 +01:00
Hennadii Stepanov
9b7d18669d
Drop no longer used Autoheader macros 2023-01-28 07:26:10 +00:00
Hennadii Stepanov
2cd4e3c0a9
Drop no longer used SECP_{LIBS,INCLUDE} variables
The last usage of the `SECP_INCLUDE` variable was removed
in https://github.com/bitcoin-core/secp256k1/pull/1169.
2023-01-19 09:43:28 +00:00
Hennadii Stepanov
613626f94c
Drop no longer used SECP_TEST_{LIBS,INCLUDE} variables
The last usage of the `SECP_TEST_{LIBS,INCLUDE}` variables was removed
in https://github.com/bitcoin-core/secp256k1/pull/983.
2023-01-19 09:27:33 +00:00
Pieter Wuille
18974061a3 Make ctime tests building configurable 2023-01-11 16:07:37 -05:00
Pieter Wuille
4f1a54e41d Move valgrind CPPFLAGS into SECP_CONFIG_DEFINES 2023-01-11 16:03:15 -05:00
Hennadii Stepanov
b627ba7050
Remove dependency on src/libsecp256k1-config.h
This change eases the use of alternate build systems by moving
the variables in `src/libsecp256k1-config.h` to compiler macros
for each invocation, preventing duplication of these variables
for each build system.

Co-authored-by: Ali Sherief <ali@notatether.com>
2022-12-15 10:56:16 +00:00
Jonas Nick
02ebc290f7
release cleanup: bump version after 0.2.0 2022-12-12 22:08:22 +00:00
Jonas Nick
e025ccdf74
release: prepare for initial release 0.2.0
There are plenty of unreleased variants of libsecp256k1 version 0.1.0
(libsecp256k1.so.0.0.0) in the wild. We choose a new version number to allow a
clear distinction.

There are variants of 0.1.0 that are incompatible with the initial release,
hence we increase the minor version to arrive at version number 0.2.0. For the
same reason, we increase the LIB_VERSION_CURRENT and keep AGE at 0.

The changelog for 0.2.0 consists of the relevant changes since 2021-12-25, which
is the date when the initial release process PR was merged (and the library
version was set to a pre-release, see 423b6d19d373f1224fd671a982584d7e7900bc93).
This is somewhat arbitrary but at least points readers to relevant changes.
2022-12-12 21:26:36 +00:00
Jonas Nick
ad39e2dc41
build: change package version to 0.1.0-dev
The suffix -dev is slightly clearer.

Also, since the package version follows semantic versioning, rename
VERSION_BUILD to VERSION_PATCH for clarity.
2022-12-07 22:07:05 +00:00
Tim Ruffing
2286f80902
Merge bitcoin-core/secp256k1#993: Enable non-experimental modules by default
41e8704b484652cf5bbb2b7ecc27feedc3cf0ae1 build: Enable some modules by default (Tim Ruffing)

Pull request description:

  This has been discussed in https://github.com/bitcoin-core/secp256k1/issues/817#issuecomment-693198323 and I agree with the arguments brought up there.

  Alternatively, we could not enable them and add a discussion to the readme why we discourage people from using the modules. I believe enabling ECDH is not very controversial. But what about recovery? Do we want to leave it off and instead give a reason?

ACKs for top commit:
  sipa:
    ACK 41e8704b484652cf5bbb2b7ecc27feedc3cf0ae1
  jonasnick:
    ACK 41e8704b484652cf5bbb2b7ecc27feedc3cf0ae1

Tree-SHA512: 1dd21037043f2b2c94a92cd2f31e69b505ba5b43119897bc0934966d9ccd84fc4fc20e7509af634f1c3a096710db1a2253090f5f1f107b9d258945a5546e9ba4
2022-11-22 12:53:48 +01:00
Russell O'Connor
2914bccbc0 Simulated int128 type. 2022-11-07 16:37:24 -05:00
Tim Ruffing
41e8704b48 build: Enable some modules by default
We don't enable the ECDSA recovery module, because we don't recommend
ECDSA recovery for new protocols. In particular, the recovery API is
prone to misuse: It invites the caller to forget to check the public
key (and the verification function always returns 1).

In general, we also don't recommend ordinary ECDSA for new protocols.
But disabling the ECDSA functions is not possible because they're not
in a module, and let's be honest: disabling ECDSA would mean to ignore
reality blatantly.
2022-08-03 17:09:54 +02:00
Tim Ruffing
cabe085bb4 configure: Remove pkgconfig macros again (reintroduced by mismerge)
We had removed `PKG_PROG_PKG_CONFIG` in 21b2ebaf74222017f85123deb6f30a33c7678513
(#1090). But then then the not rebased (!) merge of 2be6ba0fedd0d2d62ba6f346d7ced7abde0d66e4
(#1084) brought that macro back at another location, without git
complaining about a conflict.

Fixes #1127.
2022-07-21 11:10:05 +02:00
Jonas Nick
cd47033335
Merge bitcoin-core/secp256k1#1084: ci: Add MSVC builds
49e2acd927ce9eb806cc10f3a1fd89a9ddd081e2 configure: Improve rationale for WERROR_CFLAGS (Tim Ruffing)
8dc4b03341c85a3be91e559d05771c51e60b0eba ci: Add a C++ job that compiles the public headers without -fpermissive (Tim Ruffing)
51f296a46c0b318b8dd572ef9ac3bb3a4140ae63 ci: Run persistent wineserver to speed up wine (Tim Ruffing)
3fb3269c22c25de3b720ad139dcf4e3cff9eda1a ci: Add 32-bit MinGW64 build (Tim Ruffing)
9efc2e5221560d19dd750e0ba32c03d4ee091227 ci: Add MSVC builds (Tim Ruffing)
2be6ba0fedd0d2d62ba6f346d7ced7abde0d66e4 configure: Convince autotools to work with MSVC's archiver lib.exe (Tim Ruffing)
bd81f4140a4228b1df3a9f631e2d207a197ae614 schnorrsig bench: Suppress a stupid warning in MSVC (Tim Ruffing)
09f3d71c51a9621653d766e2fe7e657534e57bd6 configure: Add a few CFLAGS for MSVC (Tim Ruffing)
3b4f3d0d46dd278fbe4ffa68b1b6e14e3ea3b17f build: Reject C++ compilers in the preprocessor (Tim Ruffing)
1cc09414149d0c0c6a4a500d83efc3bd66f3ebcd configure: Don't abort if the compiler does not define __STDC__ (Tim Ruffing)
cca8cbbac84624fd350efc4086af25a06dcf8090 configure: Output message when checking for valgrind (Tim Ruffing)
1a6be5745fcf9f90e4218b73712b71ea06361792 bench: Make benchmarks compile on MSVC (Tim Ruffing)

Pull request description:

ACKs for top commit:
  jonasnick:
    ACK 49e2acd927ce9eb806cc10f3a1fd89a9ddd081e2

Tree-SHA512: 986c498fb218231fff3519167d34a92e11dea6a4383788a9723be105c20578cd483c6b06ba5686c6669e3a02cfeebc29b8e5f1428552ebf4ec67fa7a86957548
2022-06-29 15:39:28 +00:00
Tim Ruffing
49e2acd927 configure: Improve rationale for WERROR_CFLAGS 2022-06-29 11:12:00 +02:00
Tim Ruffing
2be6ba0fed configure: Convince autotools to work with MSVC's archiver lib.exe 2022-06-29 11:05:40 +02:00
Elliott Jin
55512d30b7 doc: clean up module help text in configure.ac 2022-03-25 08:14:18 -07:00
Tim Ruffing
d0ad5814a5
Merge bitcoin-core/secp256k1#995: build: stop treating schnorrsig, extrakeys modules as experimental
7f09d0f311117289719b690f91f6a907c2c6f3e2 README: mention that ARM assembly is experimental (Jonas Nick)
80cf4eea5fa0162350614c08f2252a07f9d7804b build: stop treating schnorrsig, extrakeys modules as experimental (Jonas Nick)

Pull request description:

  Fixes #992

ACKs for top commit:
  real-or-random:
    ACK 7f09d0f311117289719b690f91f6a907c2c6f3e2
  fanquake:
    ACK 7f09d0f311117289719b690f91f6a907c2c6f3e2 - When this is in, I think we'll do a subtree update in Core, and prune some build cruft on our side.

Tree-SHA512: 13deb82dcca88bacb2cd5c1c589a8d4af2277c4d675262337ae4d7e93eb41d43825dda4945ca1c202c36aaa2e6fd42de9c6d711fe8d71bce578368281db698b2
2022-03-25 10:57:17 +01:00
Tim Ruffing
09f3d71c51 configure: Add a few CFLAGS for MSVC 2022-03-17 22:32:24 +01:00
Tim Ruffing
1cc0941414 configure: Don't abort if the compiler does not define __STDC__
This removes a check for $ac_cv_prog_cc_c89 which is set by AC_PROG_CC
if defined(__STDC__) in the preprocessor. (Standard compliant compilers
are supposed to define __STDC__ to 1 but the value is actually not
checked here.)

Unfortunately, MSVC doesn't define it, so configure fails for MSVC.

This check is not very useful in practice. Over 30 years after C89 has
been released, there are no C compilers out there that are not
sufficiently compliant with C89 for the project. The only practically
relevant case was that the check rejected C++ compilers. A different
method to reject C++ compilers will be introduced in a later commit.
2022-03-17 22:13:47 +01:00
Jonas Nick
80cf4eea5f build: stop treating schnorrsig, extrakeys modules as experimental 2022-03-17 14:14:08 +00:00
Tim Ruffing
21b2ebaf74 configure: Remove redundant pkg-config code
This removes code that detects the pkg-config tool. We used this
back in the days when we had dependencies. ;) It can always be brought
back if we'll need it in the future.

Note that we still deliver a .pc file for this library, and there is
code in Makefile.am to install it. But this does not require the
pkg-config tool; only consumers of the .pc file will need it. This can
be verified by running `make install` (maybe after `mkdir /tmp/pre` and
`./configure --prefix=/tmp/pre` and checking that the .pc file is
installed correctly.
2022-03-16 16:45:17 +01:00
Tim Ruffing
0d253d52e8 configure: Use modern way to set AR
This uses AM_PROG_AR to discover ar, which is the recommended way to do
so. Among other advantages, it honors the AR environment variable (as
set from the outside). The macro has been around since automake 1.11.2
(Dec 2011).

This commit also removes code that discovers ranlib and strip. ranlib
has been obsolete for decades (ar does its task now automatically), and
anyway LT_INIT takes care of discovering it. The code we used to set
STRIP was last mentioned in the automake 1.5 manual. Since automake 1.6
(Mar 2002), strip is discovered automatically when necessary (look for
the *private* macro AM_PROG_INSTALL_STRIP in the automake manual).
2022-03-14 18:35:59 +01:00
Tim Ruffing
e0838d663d configure: Add hidden --enable-dev-mode to enable all the stuff
Co-authored-by: Elichai Turkel <elichai.turkel@gmail.com>
2022-02-26 10:30:29 +01:00
Tim Ruffing
fabd579dfa configure: Remove redundant code that sets _enable variables
These are set automatically by autoconf [1], and this has been the
case in at least since 2.60, which is our minimum supported version.

[1] https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Package-Options.html
[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.60/html_node/Package-Options.html
2022-02-23 21:14:59 +01:00
Tim Ruffing
0d4226c051 configure: Use canonical variable prefix _enable consistently 2022-02-23 21:11:53 +01:00
Jonas Nick
64b34979ed
Merge bitcoin-core/secp256k1#748: Add usage examples
7c9502cece9c9e8d811333f7ab5bb22f4eb01c04 Add a copy of the CC0 license to the examples (Elichai Turkel)
42e03432e6be7f0bf18c7f86130d3930bdf4038d Add usage examples to the readme (Elichai Turkel)
517644eab14ef397e1f0bc2b45f2dff8b1a473ec Optionally compile the examples in autotools, compile+run in travis (Elichai Turkel)
422a7cc86ae86496794c5014028ee249bbe0e072 Add a ecdh shared secret example (Elichai Turkel)
b0cfbcc14347ff6b04ff62a0d935638840a37971 Add a Schnorr signing and verifying example (Elichai Turkel)
fee7d4bf9e4ea316ea4ff3151bbe52bec1f0745c Add an ECDSA signing and verifying example (Elichai Turkel)

Pull request description:

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

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
laanwj
e0db3f8a25 build: Replace use of deprecated autoconf macro AC_PROG_CC_C89
According to [autoconf 2.70](https://www.gnu.org/software/autoconf/manual/autoconf-2.70/html_node/Obsolete-Macros.html)
documentation, the `AC_PROG_CC_C89' is replaced by `AC_PROG_CC`, which
defines the same variable `ac_cv_prog_cc_c89`.

Avoids the following message:
```
configure.ac:23: warning: The macro `AC_PROG_CC_C89' is obsolete.
```

Also, remove deprecated `AM_PROG_CC_C_O`.
2022-02-03 08:57:36 +01:00