move hashes/fuzz into main fuzz/ directory

This commit is contained in:
Andrew Poelstra 2023-03-22 02:25:27 +00:00
parent 5a891dec2d
commit 0be75f7edc
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
10 changed files with 51 additions and 117 deletions

View File

@ -1,5 +1,6 @@
[package] [package]
name = "bitcoin-fuzz" name = "bitcoin-fuzz"
edition = "2018"
version = "0.0.1" version = "0.0.1"
authors = ["Automatically generated"] authors = ["Automatically generated"]
publish = false publish = false
@ -14,7 +15,12 @@ honggfuzz_fuzz = ["honggfuzz"]
[dependencies] [dependencies]
honggfuzz = { version = "0.5", optional = true, default-features = false } honggfuzz = { version = "0.5", optional = true, default-features = false }
afl = { version = "0.4", optional = true } afl = { version = "0.4", optional = true }
bitcoin = { version = "0.30.0" } bitcoin = { version = "0.30.0", features = [ "serde" ] }
rust-crypto = "0.2"
serde = { version = "1.0.103", features = [ "derive" ] }
serde_json = "1.0"
serde_cbor = "0.9"
[[bin]] [[bin]]
name = "deserialize_block" name = "deserialize_block"
@ -60,5 +66,31 @@ path = "fuzz_targets/bitcoin/script_bytes_to_asm_fmt.rs"
name = "deserialize_witness" name = "deserialize_witness"
path = "fuzz_targets/bitcoin/deserialize_witness.rs" path = "fuzz_targets/bitcoin/deserialize_witness.rs"
[patch.crates-io.bitcoin_hashes]
path = "../../hashes" [[bin]]
name = "sha1"
path = "fuzz_targets/hashes/sha1.rs"
[[bin]]
name = "ripemd160"
path = "fuzz_targets/hashes/ripemd160.rs"
[[bin]]
name = "sha256"
path = "fuzz_targets/hashes/sha256.rs"
[[bin]]
name = "sha512"
path = "fuzz_targets/hashes/sha512.rs"
[[bin]]
name = "sha512_256"
path = "fuzz_targets/hashes/sha512_256.rs"
[[bin]]
name = "cbor"
path = "fuzz_targets/hashes/cbor.rs"
[[bin]]
name = "json"
path = "fuzz_targets/hashes/json.rs"

View File

@ -1,11 +1,7 @@
extern crate serde; use bitcoin::hashes::Hmac;
#[macro_use] extern crate serde_derive; use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
extern crate bitcoin_hashes; use serde::{Deserialize, Serialize};
extern crate serde_cbor;
use bitcoin_hashes::Hmac;
use bitcoin_hashes::{sha1, sha512, ripemd160, sha256d};
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
struct Hmacs { struct Hmacs {

View File

@ -1,11 +1,7 @@
extern crate serde; use bitcoin::hashes::Hmac;
#[macro_use] extern crate serde_derive; use bitcoin::hashes::{sha1, sha512, ripemd160, sha256d};
extern crate bitcoin_hashes; use serde::{Deserialize, Serialize};
extern crate serde_json;
use bitcoin_hashes::Hmac;
use bitcoin_hashes::{sha1, sha512, ripemd160, sha256d};
#[derive(Deserialize, Serialize)] #[derive(Deserialize, Serialize)]
struct Hmacs { struct Hmacs {

View File

@ -1,9 +1,6 @@
extern crate bitcoin_hashes; use bitcoin::hashes::Hash;
extern crate crypto; use bitcoin::hashes::ripemd160;
use bitcoin_hashes::Hash;
use bitcoin_hashes::ripemd160;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::ripemd160::Ripemd160; use crypto::ripemd160::Ripemd160;

View File

@ -1,9 +1,6 @@
extern crate bitcoin_hashes; use bitcoin::hashes::Hash;
extern crate crypto; use bitcoin::hashes::sha1;
use bitcoin_hashes::Hash;
use bitcoin_hashes::sha1;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::sha1::Sha1; use crypto::sha1::Sha1;

View File

@ -1,9 +1,6 @@
extern crate bitcoin_hashes; use bitcoin::hashes::Hash;
extern crate crypto; use bitcoin::hashes::sha256;
use bitcoin_hashes::Hash;
use bitcoin_hashes::sha256;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::sha2::Sha256; use crypto::sha2::Sha256;

View File

@ -1,9 +1,6 @@
extern crate bitcoin_hashes; use bitcoin::hashes::Hash;
extern crate crypto; use bitcoin::hashes::sha512;
use bitcoin_hashes::Hash;
use bitcoin_hashes::sha512;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::sha2::Sha512; use crypto::sha2::Sha512;

View File

@ -1,9 +1,6 @@
extern crate bitcoin_hashes; use bitcoin::hashes::Hash;
extern crate crypto; use bitcoin::hashes::sha512_256;
use bitcoin_hashes::Hash;
use bitcoin_hashes::sha512_256;
use crypto::digest::Digest; use crypto::digest::Digest;
use crypto::sha2::Sha512Trunc256; use crypto::sha2::Sha512Trunc256;

View File

@ -1,53 +0,0 @@
[package]
name = "bitcoin_hashes-fuzz"
version = "0.0.1"
authors = ["copied from rust-bitcoin"]
publish = false
[package.metadata]
cargo-fuzz = true
[features]
honggfuzz_fuzz = ["honggfuzz"]
[dependencies]
honggfuzz = { version = "0.5", optional = true }
bitcoin_hashes = { path = "..", features = ["serde"] }
rust-crypto = "0.2"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
serde_cbor = "0.9"
# Prevent this from interfering with workspaces
[workspace]
members = ["."]
[[bin]]
name = "sha1"
path = "fuzz_targets/sha1.rs"
[[bin]]
name = "ripemd160"
path = "fuzz_targets/ripemd160.rs"
[[bin]]
name = "sha256"
path = "fuzz_targets/sha256.rs"
[[bin]]
name = "sha512"
path = "fuzz_targets/sha512.rs"
[[bin]]
name = "sha512_256"
path = "fuzz_targets/sha512_256.rs"
[[bin]]
name = "cbor"
path = "fuzz_targets/cbor.rs"
[[bin]]
name = "json"
path = "fuzz_targets/json.rs"

View File

@ -1,22 +0,0 @@
#!/bin/bash
set -e
cargo install --force honggfuzz
for TARGET in fuzz_targets/*; do
FILENAME=$(basename $TARGET)
FILE="${FILENAME%.*}"
if [ -d hfuzz_input/$FILE ]; then
HFUZZ_INPUT_ARGS="-f hfuzz_input/$FILE/input"
fi
rm -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
HFUZZ_BUILD_ARGS="--features honggfuzz_fuzz" HFUZZ_RUN_ARGS="-N1000000 --exit_upon_crash -v $HFUZZ_INPUT_ARGS" cargo hfuzz run $FILE
if [ -f hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT ]; then
cat hfuzz_workspace/$FILE/HONGGFUZZ.REPORT.TXT
for CASE in hfuzz_workspace/$FILE/SIG*; do
cat $CASE | xxd -p
done
exit 1
fi
done