diff --git a/src/lib.rules b/src/lib.rules index 4ec4711e3..a46315442 100644 --- a/src/lib.rules +++ b/src/lib.rules @@ -11,6 +11,7 @@ CFLAGS += -DCONFIG_NO_RANDOM_POOL CFLAGS += -DTEST_FUZZ endif +CFLAGS += $(FUZZ_CFLAGS) CFLAGS += -I.. -I../utils diff --git a/tests/fuzzing/rules.include b/tests/fuzzing/rules.include index 69548cd74..a3b0ee0aa 100644 --- a/tests/fuzzing/rules.include +++ b/tests/fuzzing/rules.include @@ -1,9 +1,21 @@ +FUZZ_CFLAGS = + +ifdef LIBFUZZER +CC ?= clang +#FUZZ_FLAGS ?= -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow +FUZZ_FLAGS ?= -fsanitize=fuzzer,address +ifndef CFLAGS +FUZZ_CFLAGS += $(FUZZ_FLAGS) +endif +endif + +FUZZ_CFLAGS += -DCONFIG_NO_RANDOM_POOL -DTEST_FUZZ +export FUZZ_CFLAGS +CFLAGS ?= -MMD -O2 -Wall -g +CFLAGS += $(FUZZ_CFLAGS) ifdef LIBFUZZER -CC=clang -CFLAGS = -MMD -O2 -Wall -g -CFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow CFLAGS += -DTEST_LIBFUZZER -LDFLAGS += -fsanitize=fuzzer,address,signed-integer-overflow,unsigned-integer-overflow +LDFLAGS += $(FUZZ_FLAGS) endif ifndef CC @@ -14,13 +26,6 @@ ifndef LDO LDO=$(CC) endif -ifndef CFLAGS -CFLAGS = -MMD -O2 -Wall -g -endif - -CFLAGS += -DCONFIG_NO_RANDOM_POOL -CFLAGS += -DTEST_FUZZ - WPAS_SRC=../../../wpa_supplicant SRC=../../../src @@ -34,7 +39,7 @@ $(SRC)/common/libcommon.a: $(MAKE) -C $(SRC)/common $(SRC)/crypto/libcrypto.a: - $(MAKE) -C $(SRC)/crypto + $(MAKE) -C $(SRC)/crypto TEST_FUZZ=y $(SRC)/eapol_auth/libeapol_auth.a: $(MAKE) -C $(SRC)/eapol_auth