forked from tpm2-software/tpm2-pkcs11
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile-fuzz.am
79 lines (63 loc) · 3.21 KB
/
Makefile-fuzz.am
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# SPDX-License-Identifier: BSD-2-Clause
TEST_EXTENSIONS += .fuzz .fuzz32
WRAP_LD_FLAGS := \
-Wl,--wrap=Esys_Initialize \
-Wl,--wrap=backend_fapi_init \
-Wl,--wrap=Tss2_TctiLdr_Initialize \
-Wl,--wrap=Tss2_TctiLdr_Finalize \
-Wl,--wrap=Esys_GetCapability \
-Wl,--wrap=Esys_TestParms \
-Wl,--wrap=Esys_Finalize \
-Wl,--wrap=Esys_TR_FromTPMPublic \
-Wl,--wrap=Esys_TR_Serialize \
-Wl,--wrap=Esys_TR_Deserialize \
-Wl,--wrap=Esys_TR_SetAuth \
-Wl,--wrap=Esys_StartAuthSession \
-Wl,--wrap=Esys_TRSess_SetAttributes \
-Wl,--wrap=Esys_TRSess_GetAttributes \
-Wl,--wrap=Esys_CreateLoaded \
-Wl,--wrap=Esys_Create \
-Wl,--wrap=Esys_FlushContext \
-Wl,--wrap=Esys_Load \
-Wl,--wrap=Esys_TRSess_GetAttributes \
-Wl,--wrap=Esys_Unseal
if FUZZING
FUZZ_RUNNER := $(top_srcdir)/test/fuzz/scripts/fuzz-runner.sh
AM_FUZZ_LOG_FLAGS=$(FUZZING_FLAGS)
FUZZ_LOG_COMPILER=$(FUZZ_RUNNER)
test_fuzz_yaml_parser_fuzz_CFLAGS = $(AM_CFLAGS) $(FUZZING_CFLAGS)
test_fuzz_yaml_parser_fuzz_LDADD = $(libtpm2_test_pkcs11)
test_fuzz_yaml_parser_fuzz_SOURCES = test/fuzz/yaml-parser.fuzz.c
test_fuzz_utils_ctx_unwrap_objauth_fuzz_CFLAGS = $(AM_CFLAGS) $(CMOCKA_CFLAGS) $(FUZZING_CFLAGS)
test_fuzz_utils_ctx_unwrap_objauth_fuzz_LDADD = $(libtpm2_test_pkcs11) $(CMOCKA_LIBS)
test_fuzz_utils_ctx_unwrap_objauth_fuzz_SOURCES = test/fuzz/utils-ctx-unwrap-objauth.c
test_fuzz_init_token_sopin_fuzz_CFLAGS = $(AM_CFLAGS) $(FUZZING_CFLAGS) $(CMOCKA_CFLAGS) -I$(srcdir)/test/fake-tpm
test_fuzz_init_token_sopin_fuzz_LDFLAGS = $(WRAP_LD_FLAGS)
test_fuzz_init_token_sopin_fuzz_LDADD = $(libtpm2_test_pkcs11) $(AM_LDFLAGS) $(CMOCKA_LIBS)
test_fuzz_init_token_sopin_fuzz_SOURCES = test/fuzz/init-token-sopin.fuzz.c
test_fuzz_init_pin_fuzz_CFLAGS = $(AM_CFLAGS) $(FUZZING_CFLAGS) $(CMOCKA_CFLAGS) -I$(srcdir)/test/fake-tpm
test_fuzz_init_pin_fuzz_LDFLAGS = $(WRAP_LD_FLAGS)
test_fuzz_init_pin_fuzz_LDADD = $(libtpm2_test_pkcs11) $(AM_LDFLAGS) $(CMOCKA_LIBS)
test_fuzz_init_pin_fuzz_SOURCES = test/fuzz/init-pin.fuzz.c
AM_FUZZ32_LOG_FLAGS=$(FUZZING_FLAGS) -max_len=32
FUZZ32_LOG_COMPILER=$(FUZZ_RUNNER)
test_fuzz_init_token_label_fuzz32_CFLAGS = $(AM_CFLAGS) $(FUZZING_CFLAGS) $(CMOCKA_CFLAGS) -I$(srcdir)/test/fake-tpm
test_fuzz_init_token_label_fuzz32_LDFLAGS = $(WRAP_LD_FLAGS)
test_fuzz_init_token_label_fuzz32_LDADD = $(libtpm2_test_pkcs11) $(AM_LDFLAGS) $(CMOCKA_LIBS)
test_fuzz_init_token_label_fuzz32_SOURCES = test/fuzz/init-token-label.fuzz32.c
test_fuzz_db_token_label_fuzz32_CFLAGS = $(AM_CFLAGS) $(FUZZING_CFLAGS) $(CMOCKA_CFLAGS) -I$(srcdir)/test/fake-tpm
test_fuzz_db_token_label_fuzz32_LDFLAGS = $(WRAP_LD_FLAGS)
test_fuzz_db_token_label_fuzz32_LDADD = $(libtpm2_test_pkcs11) $(AM_LDFLAGS) $(CMOCKA_LIBS)
test_fuzz_db_token_label_fuzz32_SOURCES = test/fuzz/db-token-label.fuzz32.c
fuzz_PROGRAMS = \
test/fuzz/yaml-parser.fuzz \
test/fuzz/init-token-sopin.fuzz \
test/fuzz/init-pin.fuzz \
test/fuzz/db-token-label.fuzz32 \
test/fuzz/init-token-label.fuzz32 \
test/fuzz/utils-ctx-unwrap-objauth.fuzz
# make check will run the fuzz targets
check_PROGRAMS += $(fuzz_PROGRAMS)
fuzzdir = $(srcdir)
fuzz-targets: $(fuzz_PROGRAMS)
endif # FUZZING