• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#
2# Copyright (C) 2015-2019 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
37include(CheckIncludeFile)
38
39
40#################################################
41# CHECK INCLUDES
42#################################################
43
44include_directories(${CMAKE_SOURCE_DIR}/usrsctplib)
45
46
47#################################################
48# OS DEPENDENT
49#################################################
50
51if (CMAKE_SYSTEM_NAME MATCHES "Linux")
52	add_definitions(-D_GNU_SOURCE)
53endif ()
54
55if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
56	add_definitions(-D__APPLE_USE_RFC_2292)
57endif ()
58
59#################################################
60# COMPILER FLAGS
61#################################################
62
63set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-unused-variable")
64set(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
79add_executable(fuzzer_listen fuzzer_listen.c ../programs/programs_helper.c)
80target_link_libraries(fuzzer_listen usrsctp-static)
81
82add_executable(fuzzer_connect_multi fuzzer_connect.c ../programs/programs_helper.c)
83target_compile_definitions(fuzzer_connect_multi PRIVATE FUZZING_STAGE=0)
84target_link_libraries(fuzzer_connect_multi usrsctp-static)
85
86add_executable(fuzzer_connect_multi_verbose fuzzer_connect.c ../programs/programs_helper.c)
87target_compile_definitions(fuzzer_connect_multi_verbose PRIVATE FUZZING_STAGE=0 FUZZ_VERBOSE)
88target_link_libraries(fuzzer_connect_multi_verbose usrsctp-static)
89
90# add_executable(fuzzer_connect_cookie_wait fuzzer_connect.c)
91# target_compile_definitions(fuzzer_connect_cookie_wait PRIVATE FUZZING_STAGE=1)
92# target_link_libraries(fuzzer_connect_cookie_wait usrsctp-static)
93
94# add_executable(fuzzer_connect_cookie_echoed fuzzer_connect.c)
95# target_compile_definitions(fuzzer_connect_cookie_echoed PRIVATE FUZZING_STAGE=2)
96# target_link_libraries(fuzzer_connect_cookie_echoed usrsctp-static)
97
98# add_executable(fuzzer_connect_established fuzzer_connect.c)
99# target_compile_definitions(fuzzer_connect_established PRIVATE FUZZING_STAGE=3)
100# target_link_libraries(fuzzer_connect_established usrsctp-static)
101
102# add_executable(fuzzer_connect_data_sent fuzzer_connect.c)
103# target_compile_definitions(fuzzer_connect_data_sent PRIVATE FUZZING_STAGE=4)
104# target_link_libraries(fuzzer_connect_data_sent usrsctp-static)
105
106# add_executable(fuzzer_connect_data_received fuzzer_connect.c)
107# target_compile_definitions(fuzzer_connect_data_received PRIVATE FUZZING_STAGE=5)
108# target_link_libraries(fuzzer_connect_data_received usrsctp-static)
109