• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash -eu
2# Copyright 2021 Google LLC
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8#      http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
15#
16################################################################################
17
18# Build wolfSSL (dependency of wolfMQTT)
19cd $SRC/wolfssl/
20autoreconf -ivf
21if [[ $CFLAGS = *sanitize=memory* ]]
22then
23    ./configure --enable-static --disable-crypttests --disable-examples --disable-asm
24elif [[ $CFLAGS = *-m32* ]]
25then
26    ./configure --enable-static --disable-crypttests --disable-examples --disable-fastmath
27else
28    ./configure --enable-static --disable-crypttests --disable-examples
29fi
30make -j$(nproc)
31export CFLAGS="$CFLAGS -I $(realpath .)"
32export LDFLAGS="-L$(realpath src/.libs/)"
33
34# Build wolfMQTT
35cd $SRC/wolfmqtt/
36./autogen.sh
37./configure --enable-static --disable-examples --enable-mqtt5
38make -j$(nproc)
39
40$CXX $CXXFLAGS \
41    -std=c++17 \
42    -I $SRC/fuzzing-headers/include/ \
43    -I $SRC/wolfssl/ \
44    -I $SRC/wolfmqtt/ \
45    $SRC/wolfmqtt-fuzzers/fuzzer.cpp \
46    $SRC/wolfmqtt/src/.libs/libwolfmqtt.a \
47    $SRC/wolfssl/src/.libs/libwolfssl.a \
48    $LIB_FUZZING_ENGINE \
49    -o $OUT/wolfmqtt-fuzzer
50