Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bitcoin-core: fix seccp256k1 configure option #12299

Merged
merged 1 commit into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading