xref: /freebsd/contrib/libfido2/fuzz/CMakeLists.txt (revision 2ccfa855b2fc331819953e3de1b1c15ce5b95a7e)
1*2ccfa855SEd Maste# Copyright (c) 2019-2023 Yubico AB. All rights reserved.
20afa8e06SEd Maste# Use of this source code is governed by a BSD-style
30afa8e06SEd Maste# license that can be found in the LICENSE file.
4*2ccfa855SEd Maste# SPDX-License-Identifier: BSD-2-Clause
50afa8e06SEd Maste
60afa8e06SEd Mastelist(APPEND COMPAT_SOURCES
70afa8e06SEd Maste	../openbsd-compat/strlcpy.c
80afa8e06SEd Maste	../openbsd-compat/strlcat.c
90afa8e06SEd Maste)
100afa8e06SEd Maste
110afa8e06SEd Mastelist(APPEND COMMON_SOURCES
120afa8e06SEd Maste	libfuzzer.c
130afa8e06SEd Maste	mutator_aux.c
140afa8e06SEd Maste)
150afa8e06SEd Maste
16*2ccfa855SEd Maste# XXX: OSS-Fuzz require linking using CXX
17*2ccfa855SEd Masteset(FUZZ_LINKER_LANGUAGE "C" CACHE STRING "Linker language for fuzz harnesses")
18*2ccfa855SEd Mastemark_as_advanced(FUZZ_LINKER_LANGUAGE)
19*2ccfa855SEd Masteenable_language(${FUZZ_LINKER_LANGUAGE})
200afa8e06SEd Maste
210afa8e06SEd Maste# fuzz_cred
220afa8e06SEd Masteadd_executable(fuzz_cred fuzz_cred.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
23*2ccfa855SEd Masteset_target_properties(fuzz_cred PROPERTIES
24*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
25*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
260afa8e06SEd Mastetarget_link_libraries(fuzz_cred fido2_shared)
270afa8e06SEd Maste
280afa8e06SEd Maste# fuzz_assert
290afa8e06SEd Masteadd_executable(fuzz_assert fuzz_assert.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
30*2ccfa855SEd Masteset_target_properties(fuzz_assert PROPERTIES
31*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
32*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
330afa8e06SEd Mastetarget_link_libraries(fuzz_assert fido2_shared)
340afa8e06SEd Maste
350afa8e06SEd Maste# fuzz_mgmt
360afa8e06SEd Masteadd_executable(fuzz_mgmt fuzz_mgmt.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
37*2ccfa855SEd Masteset_target_properties(fuzz_mgmt PROPERTIES
38*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
39*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
400afa8e06SEd Mastetarget_link_libraries(fuzz_mgmt fido2_shared)
410afa8e06SEd Maste
420afa8e06SEd Maste# fuzz_credman
430afa8e06SEd Masteadd_executable(fuzz_credman fuzz_credman.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
44*2ccfa855SEd Masteset_target_properties(fuzz_credman PROPERTIES
45*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
46*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
470afa8e06SEd Mastetarget_link_libraries(fuzz_credman fido2_shared)
480afa8e06SEd Maste
490afa8e06SEd Maste# fuzz_bio
500afa8e06SEd Masteadd_executable(fuzz_bio fuzz_bio.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
51*2ccfa855SEd Masteset_target_properties(fuzz_bio PROPERTIES
52*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
53*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
540afa8e06SEd Mastetarget_link_libraries(fuzz_bio fido2_shared)
550afa8e06SEd Maste
560afa8e06SEd Maste# fuzz_hid
570afa8e06SEd Masteadd_executable(fuzz_hid fuzz_hid.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
58*2ccfa855SEd Masteset_target_properties(fuzz_hid PROPERTIES
59*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
60*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
610afa8e06SEd Mastetarget_link_libraries(fuzz_hid fido2_shared)
620afa8e06SEd Maste
630afa8e06SEd Maste# fuzz_netlink
640afa8e06SEd Masteadd_executable(fuzz_netlink fuzz_netlink.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
65*2ccfa855SEd Masteset_target_properties(fuzz_netlink PROPERTIES
66*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
67*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
680afa8e06SEd Mastetarget_link_libraries(fuzz_netlink fido2_shared)
690afa8e06SEd Maste
700afa8e06SEd Maste# fuzz_largeblob
710afa8e06SEd Masteadd_executable(fuzz_largeblob fuzz_largeblob.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
72*2ccfa855SEd Masteset_target_properties(fuzz_largeblob PROPERTIES
73*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
74*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
750afa8e06SEd Mastetarget_link_libraries(fuzz_largeblob fido2_shared)
76*2ccfa855SEd Maste
77*2ccfa855SEd Maste# fuzz_pcsc
78*2ccfa855SEd Masteadd_executable(fuzz_pcsc fuzz_pcsc.c ${COMMON_SOURCES} ${COMPAT_SOURCES})
79*2ccfa855SEd Masteset_target_properties(fuzz_pcsc PROPERTIES
80*2ccfa855SEd Maste	LINK_FLAGS ${FUZZ_LDFLAGS}
81*2ccfa855SEd Maste	LINKER_LANGUAGE ${FUZZ_LINKER_LANGUAGE})
82*2ccfa855SEd Mastetarget_link_libraries(fuzz_pcsc fido2_shared)
83