Skip to content

Commit 4b0f711

Browse files
Merge #1277: autotools: Clean up after adding Wycheproof
7e977b3 autotools: Take VPATH builds into account when generating testvectors (Tim Ruffing) 2418d32 autotools: Create src/wycheproof dir before creating file in it (Tim Ruffing) 8764034 autotools: Make all "pregenerated" targets .PHONY (Tim Ruffing) e1b9ce8 autotools: Use same conventions for all pregenerated files (Tim Ruffing) 08f4b16 autotools: Move code around to tidy Makefile (Tim Ruffing) 529b54d autotools: Move Wycheproof header from EXTRA_DIST to noinst_HEADERS (Tim Ruffing) Pull request description: Follow-up to #1245. This builds on top of #1276. Let's only merge #1276 as a hotfix for the Core build. ACKs for top commit: hebasto: ACK 7e977b3 Tree-SHA512: 42e09feaed15d903e759360e1dfbd1afce9da07a55512e2e791147b72d9b6477e34ae6028439af57dbcae318081a37ddcf3a630f9617bfea95c130135ba2313f
2 parents 222ecaf + 7e977b3 commit 4b0f711

File tree

1 file changed

+25
-22
lines changed

1 file changed

+25
-22
lines changed

Makefile.am

+25-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
.PHONY: clean-precomp precomp
2-
31
ACLOCAL_AMFLAGS = -I build-aux/m4
42

53
# AM_CFLAGS will be automatically prepended to CFLAGS by Automake when compiling some foo
@@ -65,6 +63,7 @@ noinst_HEADERS += src/hash_impl.h
6563
noinst_HEADERS += src/field.h
6664
noinst_HEADERS += src/field_impl.h
6765
noinst_HEADERS += src/bench.h
66+
noinst_HEADERS += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
6867
noinst_HEADERS += contrib/lax_der_parsing.h
6968
noinst_HEADERS += contrib/lax_der_parsing.c
7069
noinst_HEADERS += contrib/lax_der_privatekey_parsing.h
@@ -202,7 +201,7 @@ precompute_ecmult_gen_LDADD = $(COMMON_LIB)
202201
# otherwise make's decision whether to rebuild them (even in the first
203202
# build by a normal user) depends on mtimes, and thus is very fragile.
204203
# This means that rebuilds of the prebuilt files always need to be
205-
# forced by deleting them, e.g., by invoking `make clean-precomp`.
204+
# forced by deleting them.
206205
src/precomputed_ecmult.c:
207206
$(MAKE) $(AM_MAKEFLAGS) precompute_ecmult$(EXEEXT)
208207
./precompute_ecmult$(EXEEXT)
@@ -217,11 +216,29 @@ precomp: $(PRECOMP)
217216
# e.g., after `make maintainer-clean`).
218217
BUILT_SOURCES = $(PRECOMP)
219218

220-
maintainer-clean-local: clean-precomp
221-
219+
.PHONY: clean-precomp
222220
clean-precomp:
223221
rm -f $(PRECOMP)
222+
maintainer-clean-local: clean-precomp
223+
224+
### Pregenerated test vectors
225+
### (see the comments in the previous section for detailed rationale)
226+
TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
227+
228+
src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
229+
mkdir -p $(@D)
230+
python3 $(top_srcdir)/tools/tests_wycheproof_generate.py $(top_srcdir)/src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
224231

232+
testvectors: $(TESTVECTORS)
233+
234+
BUILT_SOURCES += $(TESTVECTORS)
235+
236+
.PHONY: clean-testvectors
237+
clean-testvectors:
238+
rm -f $(TESTVECTORS)
239+
maintainer-clean-local: clean-testvectors
240+
241+
### Additional files to distribute
225242
EXTRA_DIST = autogen.sh CHANGELOG.md SECURITY.md
226243
EXTRA_DIST += doc/release-process.md doc/safegcd_implementation.md
227244
EXTRA_DIST += examples/EXAMPLES_COPYING
@@ -231,6 +248,9 @@ EXTRA_DIST += sage/group_prover.sage
231248
EXTRA_DIST += sage/prove_group_implementations.sage
232249
EXTRA_DIST += sage/secp256k1_params.sage
233250
EXTRA_DIST += sage/weierstrass_prover.sage
251+
EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
252+
EXTRA_DIST += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json
253+
EXTRA_DIST += tools/tests_wycheproof_generate.py
234254

235255
if ENABLE_MODULE_ECDH
236256
include src/modules/ecdh/Makefile.am.include
@@ -247,20 +267,3 @@ endif
247267
if ENABLE_MODULE_SCHNORRSIG
248268
include src/modules/schnorrsig/Makefile.am.include
249269
endif
250-
251-
EXTRA_DIST += src/wycheproof/WYCHEPROOF_COPYING
252-
EXTRA_DIST += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
253-
EXTRA_DIST += src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json
254-
EXTRA_DIST += tools/tests_wycheproof_generate.py
255-
256-
TESTVECTORS = src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h
257-
258-
src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.h:
259-
python3 tools/tests_wycheproof_generate.py src/wycheproof/ecdsa_secp256k1_sha256_bitcoin_test.json > $@
260-
261-
testvectors: $(TESTVECTORS)
262-
263-
maintainer-clean-testvectors: clean-testvectors
264-
265-
clean-testvectors:
266-
rm -f $(TESTVECTORS)

0 commit comments

Comments
 (0)