Debian Codegraph @

fuzzer/CMakeLists.txt

raw
1 #
2 # Copyright (C) 2015-2020 Felix Weinrank
3 #
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 # 1. Redistributions of source code must retain the above copyright
10 # notice, this list of conditions and the following disclaimer.
11 # 2. Redistributions in binary form must reproduce the above copyright
12 # notice, this list of conditions and the following disclaimer in the
13 # documentation and/or other materials provided with the distribution.
14 # 3. Neither the name of the project nor the names of its contributors
15 # may be used to endorse or promote products derived from this software
16 # without specific prior written permission.
17 #
18 # THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
19 # ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
20 # IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
21 # ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
22 # FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
24 # OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
26 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
27 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
28 # SUCH DAMAGE.
29 #
30
31 #project(usrsctp-fuzzer C)
32
33 #################################################
34 # INCLUDE MODULES
35 #################################################
36
37 include(CheckIncludeFile)
38
39
40 #################################################
41 # CHECK INCLUDES
42 #################################################
43
44 include_directories(${CMAKE_SOURCE_DIR}/usrsctplib)
45
46
47 #################################################
48 # OS DEPENDENT
49 #################################################
50
51 if (CMAKE_SYSTEM_NAME MATCHES "Linux")
52 add_definitions(-D_GNU_SOURCE)
53 endif ()
54
55 if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
56 add_definitions(-D__APPLE_USE_RFC_2292)
57 endif ()
58
59 #################################################
60 # COMPILER FLAGS
61 #################################################
62
63 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-variable")
64 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=fuzzer")
65
66
67 #################################################
68 # PROGRAMS
69 #################################################
70
71 # FUZZING_STAGE LEVELS
72 # 0 - MULTI - based on input
73 # 1 - COOKIE_WAIT
74 # 2 - COOKIE_ECHO
75 # 3 - ESTABLISHED
76 # 4 - DATA SENT
77 # 5 - DATA RECEIVED
78
79 add_executable(fuzzer_listen fuzzer_listen.c ../programs/programs_helper.c)
80 target_link_libraries(fuzzer_listen usrsctp)
81
82 add_executable(fuzzer_listen_verbose fuzzer_listen.c ../programs/programs_helper.c)
83 target_compile_definitions(fuzzer_listen_verbose PRIVATE FUZZ_VERBOSE)
84 target_link_libraries(fuzzer_listen_verbose usrsctp)
85
86 add_executable(fuzzer_fragment fuzzer_fragment.c ../programs/programs_helper.c)
87 target_link_libraries(fuzzer_fragment usrsctp)
88
89 add_executable(fuzzer_connect_multi fuzzer_connect.c ../programs/programs_helper.c)
90 target_compile_definitions(fuzzer_connect_multi PRIVATE FUZZING_STAGE=0)
91 target_link_libraries(fuzzer_connect_multi usrsctp)
92
93 add_executable(fuzzer_connect_multi_verbose fuzzer_connect.c ../programs/programs_helper.c)
94 target_compile_definitions(fuzzer_connect_multi_verbose PRIVATE FUZZING_STAGE=0 FUZZ_VERBOSE)
95 target_link_libraries(fuzzer_connect_multi_verbose usrsctp)
96
97 # add_executable(fuzzer_connect_cookie_wait fuzzer_connect.c)
98 # target_compile_definitions(fuzzer_connect_cookie_wait PRIVATE FUZZING_STAGE=1)
99 # target_link_libraries(fuzzer_connect_cookie_wait usrsctp)
100
101 # add_executable(fuzzer_connect_cookie_echoed fuzzer_connect.c)
102 # target_compile_definitions(fuzzer_connect_cookie_echoed PRIVATE FUZZING_STAGE=2)
103 # target_link_libraries(fuzzer_connect_cookie_echoed usrsctp)
104
105 # add_executable(fuzzer_connect_established fuzzer_connect.c)
106 # target_compile_definitions(fuzzer_connect_established PRIVATE FUZZING_STAGE=3)
107 # target_link_libraries(fuzzer_connect_established usrsctp)
108
109 # add_executable(fuzzer_connect_data_sent fuzzer_connect.c)
110 # target_compile_definitions(fuzzer_connect_data_sent PRIVATE FUZZING_STAGE=4)
111 # target_link_libraries(fuzzer_connect_data_sent usrsctp)
112
113 # add_executable(fuzzer_connect_data_received fuzzer_connect.c)
114 # target_compile_definitions(fuzzer_connect_data_received PRIVATE FUZZING_STAGE=5)
115 # target_link_libraries(fuzzer_connect_data_received usrsctp)