Skip to content

Commit

Permalink
bitcoin-core: fix seccp256k1 configure option (#12299)
Browse files Browse the repository at this point in the history
This option was renamed in
bitcoin-core/secp256k1#1058, resulting in
`configure: WARNING: unrecognized options: --with-ecmult-gen-precision`.

Update the option and change the values.

Also add `--enable-option-checking`, so that it'll be harder for this to
happen in future. See:

https://www.gnu.org/savannah-checkouts/gnu/autoconf/manual/autoconf-2.72/html_node/Option-Checking.html.
  • Loading branch information
fanquake authored Jul 31, 2024
1 parent 999f374 commit c383795
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions projects/bitcoin-core/build_cryptofuzz.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ function build_libsecp256k1() {
--enable-module-recovery
--enable-experimental
--enable-module-schnorrsig
--enable-module-ecdh"
--enable-module-ecdh
--enable-option-checking"

if [[ $CFLAGS = *sanitize=memory* ]]
then
Expand Down Expand Up @@ -151,31 +152,31 @@ cd ../../
# Build with 3 configurations of libsecp256k1
# Discussion: https://github.com/google/oss-fuzz/pull/5717#issuecomment-842765383

build_libsecp256k1 "--with-ecmult-window=2" "--with-ecmult-gen-precision=2"
build_libsecp256k1 "--with-ecmult-window=2" "--with-ecmult-gen-kb=2"
cd $SRC/cryptofuzz/
make -B -j$(nproc)
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w2-p2
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w2-kb2

build_libsecp256k1 "--with-ecmult-window=15" "--with-ecmult-gen-precision=4"
build_libsecp256k1 "--with-ecmult-window=15" "--with-ecmult-gen-kb=22"
cd $SRC/cryptofuzz/
rm cryptofuzz
make
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w15-p4
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w15-kb22

# If the window size is larger than 15, this file must be deleted before proceeding
rm $SRC/secp256k1/src/precomputed_ecmult.c
build_libsecp256k1 "--with-ecmult-window=20" "--with-ecmult-gen-precision=8"
build_libsecp256k1 "--with-ecmult-window=20" "--with-ecmult-gen-kb=86"
cd $SRC/cryptofuzz/
rm cryptofuzz
make
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w20-p8
cp cryptofuzz $OUT/cryptofuzz-bitcoin-cryptography-w20-kb86

# Convert Wycheproof test vectors to Cryptofuzz corpus format
mkdir $SRC/corpus-cryptofuzz-wycheproof/
find $SRC/wycheproof/testvectors/ -type f -name 'ecdsa_secp256k1_*' -exec $SRC/cryptofuzz/cryptofuzz --from-wycheproof={},$SRC/corpus-cryptofuzz-wycheproof/ \;
# Pack the Wycheproof test vectors
zip -j cryptofuzz-bitcoin-cryptography_seed_corpus.zip $SRC/corpus-cryptofuzz-wycheproof/*
# Use them as the seed corpus for each of the fuzzers
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w2-p2_seed_corpus.zip
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w15-p4_seed_corpus.zip
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w20-p8_seed_corpus.zip
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w2-kb2_seed_corpus.zip
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w15-kb22_seed_corpus.zip
cp cryptofuzz-bitcoin-cryptography_seed_corpus.zip $OUT/cryptofuzz-bitcoin-cryptography-w20-kb86_seed_corpus.zip

0 comments on commit c383795

Please sign in to comment.