Skip to content

Commit df3d4b5

Browse files
wolfssl: fix build (#13626)
guidovranken/wolf-ssl-ssh-fuzzers has an issue with using an older OCSP function declaration. This updates the Docker image to look at JacobBarthelmeh/wolf-ssl-ssh-fuzzers which contains a fix for the following error. ``` E_FOR_PRODUCTION -fsanitize=memory -fsanitize-memory-track-origins -fsanitize=fuzzer-no-link -DWOLFSSL_STATIC_PSK -I .. -I /src/wolf-ssl-ssh-fuzzers/oss-fuzz/projects/wolf-ssl-ssh/fuzzers/include ocsp.c -c -o ocsp.o ocsp.c:14:47: warning: passing 'const uint8_t *' (aka 'const unsigned char *') to parameter of type 'byte *' (aka 'unsigned char *') discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers] 14 | InitOcspResponse(&resp, &single, &status, data, size, NULL); | ^~~~ ../wolfssl/wolfcrypt/asn.h:2582:48: note: passing argument to parameter 'source' here 2582 | CertStatus* status, byte* source, word32 inSz, void* heap); | ^ ocsp.c:15:44: error: too few arguments to function call, expected 5, have 4 15 | OcspResponseDecode(&resp, NULL, NULL, 1); | ~~~~~~~~~~~~~~~~~~ ^ ../wolfssl/wolfcrypt/asn.h:2584:19: note: 'OcspResponseDecode' declared here 2584 | WOLFSSL_LOCAL int OcspResponseDecode(OcspResponse* resp, void* cm, void* heap, | ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 2585 | int noVerifyCert, int noVerifySignature); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1 warning and 1 error generated. ``` Botan was having issues being built when trying locally. This PR removes building Botan. Botan error: ``` | ^ /src/botan/build/include/public/botan/api.h:73:36: note: expanded from macro 'BOTAN_DEPRECATED' 73 | #define BOTAN_DEPRECATED(msg) [[deprecated(msg)]] | ^ bn_ops.cpp:416:59: error: no viable conversion from 'Botan::Modular_Reducer' to incomplete type 'const Barrett_Reduction' 416 | if ( Botan::is_bailie_psw_probable_prime(bn[0].Ref(), mod_n) ) { | ^~~~~ /src/botan/build/include/internal/botan/internal/primality.h:17:7: note: forward declaration of 'Botan::Barrett_Reduction' 17 | class Barrett_Reduction; ```
1 parent ae3986a commit df3d4b5

File tree

2 files changed

+7
-65
lines changed

2 files changed

+7
-65
lines changed

projects/wolfssl/Dockerfile

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,8 @@ RUN git clone --depth 1 https://github.com/wolfssl/wolfssl $SRC/wolfssl
2121
RUN git clone --depth 1 https://github.com/wolfSSL/wolfsm
2222
RUN git clone --depth 1 https://github.com/wolfSSL/wolfssh.git
2323
RUN git clone --depth 1 https://github.com/guidovranken/fuzzing-headers.git
24-
RUN git clone --depth 1 https://github.com/guidovranken/wolf-ssl-ssh-fuzzers
24+
RUN git clone --depth 1 https://github.com/JacobBarthelmeh/wolf-ssl-ssh-fuzzers
2525
RUN git clone --depth 1 https://github.com/MozillaSecurity/cryptofuzz
26-
RUN git clone --depth 1 https://github.com/randombit/botan.git
2726
RUN git clone --depth 1 https://github.com/google/wycheproof.git
2827
RUN wget https://archives.boost.io/release/1.82.0/source/boost_1_82_0.tar.bz2
2928
RUN git clone https://github.com/wolfssl/oss-fuzz-targets --depth 1 $SRC/fuzz-targets
@@ -40,12 +39,6 @@ RUN gsutil cp gs://cryptofuzz-backup.clusterfuzz-external.appspot.com/corpus/lib
4039
RUN gsutil cp gs://cryptofuzz-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/cryptofuzz_cryptofuzz-boringssl/public.zip $SRC/corpus_cryptofuzz-boringssl.zip
4140
RUN gsutil cp gs://cryptofuzz-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/cryptofuzz_cryptofuzz-nss/public.zip $SRC/corpus_cryptofuzz-nss.zip
4241

43-
# Botan corpora, which require a special import procedure
44-
RUN gsutil cp gs://botan-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/botan_ecc_p256/public.zip $SRC/corpus_botan_ecc_p256.zip
45-
RUN gsutil cp gs://botan-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/botan_ecc_p384/public.zip $SRC/corpus_botan_ecc_p384.zip
46-
RUN gsutil cp gs://botan-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/botan_ecc_p521/public.zip $SRC/corpus_botan_ecc_p521.zip
47-
RUN gsutil cp gs://botan-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/botan_ecc_bp256/public.zip $SRC/corpus_botan_ecc_bp256.zip
48-
4942
# OpenSSL/LibreSSL corpora, which require a special import procedure
5043
RUN gsutil cp gs://openssl-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/openssl_bignum/public.zip $SRC/corpus_openssl_expmod.zip
5144
RUN gsutil cp gs://libressl-backup.clusterfuzz-external.appspot.com/corpus/libFuzzer/libressl_bignum/public.zip $SRC/corpus_libressl_expmod.zip

projects/wolfssl/build.sh

Lines changed: 6 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,6 @@ then
3535
CFLAGS="" CXXFLAGS="" ./b2 headers
3636
cp -R boost/ /usr/include/
3737

38-
# Build Botan
39-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_BOTAN_IS_ORACLE"
40-
cd $SRC/botan
41-
if [[ $CFLAGS != *-m32* ]]
42-
then
43-
if [[ $CFLAGS != *sanitize=memory* ]]
44-
then
45-
./configure.py --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" --disable-shared --disable-modules=locking_allocator --build-targets=static --without-documentation
46-
else
47-
./configure.py --disable-asm --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" --disable-shared --disable-modules=locking_allocator --build-targets=static --without-documentation
48-
fi
49-
else
50-
./configure.py --cpu=x86_32 --cc-bin=$CXX --cc-abi-flags="$CXXFLAGS" --disable-shared --disable-modules=locking_allocator --build-targets=static --without-documentation
51-
fi
52-
make -j$(nproc)
53-
export LIBBOTAN_A_PATH="$SRC/botan/libbotan-3.a"
54-
export BOTAN_INCLUDE_PATH="$SRC/botan/build/include"
55-
5638
OLD_CFLAGS="$CFLAGS"
5739
OLD_CXXFLAGS="$CXXFLAGS"
5840

@@ -136,13 +118,11 @@ then
136118
./configure $WOLFCRYPT_CONFIGURE_PARAMS --disable-asm
137119
fi
138120
make -j$(nproc)
139-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
121+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
140122
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-normal-math/src/.libs/libwolfssl.a"
141123
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-normal-math/"
142124
cd $SRC/cryptofuzz-normal-math/modules/wolfcrypt
143125
make -j$(nproc)
144-
cd $SRC/cryptofuzz-normal-math/modules/botan
145-
make -j$(nproc)
146126
cd $SRC/cryptofuzz-normal-math/
147127
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
148128
cp cryptofuzz $OUT/cryptofuzz-normal-math
@@ -159,13 +139,11 @@ then
159139
CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K -DWOLFSSL_ECDSA_SET_K_ONE_LOOP -DWOLFSSL_SP_INT_NEGATIVE"
160140
./configure $WOLFCRYPT_CONFIGURE_PARAMS --enable-sp-math-all
161141
make -j$(nproc)
162-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
142+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
163143
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-sp-math-all/src/.libs/libwolfssl.a"
164144
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-sp-math-all/"
165145
cd $SRC/cryptofuzz-sp-math-all/modules/wolfcrypt
166146
make -j$(nproc)
167-
cd $SRC/cryptofuzz-sp-math-all/modules/botan
168-
make -j$(nproc)
169147
cd $SRC/cryptofuzz-sp-math-all/
170148
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
171149
cp cryptofuzz $OUT/cryptofuzz-sp-math-all
@@ -182,13 +160,11 @@ then
182160
CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K -DWOLFSSL_ECDSA_SET_K_ONE_LOOP -DSP_WORD_SIZE=8 -DWOLFSSL_SP_INT_NEGATIVE"
183161
./configure $WOLFCRYPT_CONFIGURE_PARAMS --enable-sp-math-all
184162
make -j$(nproc)
185-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
163+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
186164
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-sp-math-all-8bit/src/.libs/libwolfssl.a"
187165
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-sp-math-all-8bit/"
188166
cd $SRC/cryptofuzz-sp-math-all-8bit/modules/wolfcrypt
189167
make -j$(nproc)
190-
cd $SRC/cryptofuzz-sp-math-all-8bit/modules/botan
191-
make -j$(nproc)
192168
cd $SRC/cryptofuzz-sp-math-all-8bit/
193169
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
194170
cp cryptofuzz $OUT/cryptofuzz-sp-math-all-8bit
@@ -216,13 +192,11 @@ then
216192
./configure $WOLFCRYPT_CONFIGURE_PARAMS_SP_MATH --enable-sp --enable-sp-math
217193
fi
218194
make -j$(nproc)
219-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
195+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
220196
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-sp-math/src/.libs/libwolfssl.a"
221197
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-sp-math/"
222198
cd $SRC/cryptofuzz-sp-math/modules/wolfcrypt
223199
make -j$(nproc)
224-
cd $SRC/cryptofuzz-sp-math/modules/botan
225-
make -j$(nproc)
226200
cd $SRC/cryptofuzz-sp-math/
227201
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
228202
cp cryptofuzz $OUT/cryptofuzz-sp-math
@@ -239,13 +213,11 @@ then
239213
CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K -DWOLFSSL_ECDSA_SET_K_ONE_LOOP"
240214
./configure $WOLFCRYPT_CONFIGURE_PARAMS --enable-fastmath
241215
make -j$(nproc)
242-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
216+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
243217
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-fastmath/src/.libs/libwolfssl.a"
244218
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-fastmath/"
245219
cd $SRC/cryptofuzz-fastmath/modules/wolfcrypt
246220
make -j$(nproc)
247-
cd $SRC/cryptofuzz-fastmath/modules/botan
248-
make -j$(nproc)
249221
cd $SRC/cryptofuzz-fastmath/
250222
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
251223
cp cryptofuzz $OUT/cryptofuzz-fastmath
@@ -262,13 +234,11 @@ then
262234
CFLAGS="$CFLAGS -DHAVE_AES_ECB -DWOLFSSL_DES_ECB -DHAVE_ECC_SECPR2 -DHAVE_ECC_SECPR3 -DHAVE_ECC_BRAINPOOL -DHAVE_ECC_KOBLITZ -DWOLFSSL_ECDSA_SET_K -DWOLFSSL_ECDSA_SET_K_ONE_LOOP"
263235
./configure $WOLFCRYPT_CONFIGURE_PARAMS --enable-heapmath
264236
make -j$(nproc)
265-
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT -DCRYPTOFUZZ_BOTAN"
237+
export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_NO_OPENSSL -DCRYPTOFUZZ_WOLFCRYPT"
266238
export WOLFCRYPT_LIBWOLFSSL_A_PATH="$SRC/wolfssl-heapmath/src/.libs/libwolfssl.a"
267239
export WOLFCRYPT_INCLUDE_PATH="$SRC/wolfssl-heapmath/"
268240
cd $SRC/cryptofuzz-heapmath/modules/wolfcrypt
269241
make -j$(nproc)
270-
cd $SRC/cryptofuzz-heapmath/modules/botan
271-
make -j$(nproc)
272242
cd $SRC/cryptofuzz-heapmath/
273243
LIBFUZZER_LINK="$LIB_FUZZING_ENGINE" make -B -j$(nproc)
274244
cp cryptofuzz $OUT/cryptofuzz-heapmath
@@ -292,23 +262,6 @@ then
292262
unzip -n $SRC/corpus_cryptofuzz-boringssl.zip -d $SRC/cryptofuzz_seed_corpus/ >/dev/null
293263
unzip -n $SRC/corpus_cryptofuzz-nss.zip -d $SRC/cryptofuzz_seed_corpus/ >/dev/null
294264

295-
# Import Botan corpora
296-
mkdir $SRC/botan-p256-corpus/
297-
unzip $SRC/corpus_botan_ecc_p256.zip -d $SRC/botan-p256-corpus/ >/dev/null
298-
find $SRC/botan-p256-corpus/ -type f -exec $SRC/cryptofuzz-fastmath/cryptofuzz --from-botan={},$SRC/cryptofuzz-seed-corpus/,secp256r1 \;
299-
300-
mkdir $SRC/botan-p384-corpus/
301-
unzip $SRC/corpus_botan_ecc_p384.zip -d $SRC/botan-p384-corpus/ >/dev/null
302-
find $SRC/botan-p384-corpus/ -type f -exec $SRC/cryptofuzz-fastmath/cryptofuzz --from-botan={},$SRC/cryptofuzz-seed-corpus/,secp384r1 \;
303-
304-
mkdir $SRC/botan-p521-corpus/
305-
unzip $SRC/corpus_botan_ecc_p521.zip -d $SRC/botan-p521-corpus/ >/dev/null
306-
find $SRC/botan-p521-corpus/ -type f -exec $SRC/cryptofuzz-fastmath/cryptofuzz --from-botan={},$SRC/cryptofuzz-seed-corpus/,secp521r1 \;
307-
308-
mkdir $SRC/botan-bp256-corpus/
309-
unzip $SRC/corpus_botan_ecc_bp256.zip -d $SRC/botan-bp256-corpus/ >/dev/null
310-
find $SRC/botan-bp256-corpus/ -type f -exec $SRC/cryptofuzz-fastmath/cryptofuzz --from-botan={},$SRC/cryptofuzz-seed-corpus/,brainpool256r1 \;
311-
312265
# Import OpenSSL/LibreSSL corpora
313266
mkdir $SRC/openssl-expmod-corpus/
314267
unzip $SRC/corpus_openssl_expmod.zip -d $SRC/openssl-expmod-corpus/ >/dev/null
@@ -334,10 +287,6 @@ then
334287
cp $SRC/cryptofuzz_seed_corpus.zip $OUT/cryptofuzz-heapmath_seed_corpus.zip
335288

336289
# Remove files that are no longer needed to prevent running out of disk space
337-
rm -rf $SRC/botan-p256-corpus/
338-
rm -rf $SRC/botan-p384-corpus/
339-
rm -rf $SRC/botan-p521-corpus/
340-
rm -rf $SRC/botan-bp256-corpus/
341290
rm -rf $SRC/openssl-expmod-corpus/
342291
rm -rf $SRC/libressl-expmod-corpus/
343292
rm -rf $SRC/cryptofuzz_seed_corpus/

0 commit comments

Comments
 (0)