mirror of https://github.com/google/oss-fuzz.git
openweave: fix build to work with latest base builder (#6463)
* openweave: fix build to work with latest base builder * openweave: deploy true fix * openweave: cleanup
This commit is contained in:
parent
aa9cd06607
commit
3d235e5951
|
@ -14,11 +14,7 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
# Using Ubuntu 16.04 because of breakage on Ubuntu 20.04.
|
||||
# See https://github.com/google/oss-fuzz/issues/6291 for more details.
|
||||
FROM gcr.io/oss-fuzz-base/base-builder:xenial
|
||||
# Delete line above and uncomment line below to upgrade to 20.04.
|
||||
# FROM gcr.io/oss-fuzz-base/base-builder
|
||||
FROM gcr.io/oss-fuzz-base/base-builder
|
||||
RUN apt-get update && apt-get install -y python3-pip python-setuptools bridge-utils \
|
||||
libglib2.0-dev libdbus-1-dev libudev-dev \
|
||||
libical-dev libreadline-dev udev \
|
||||
|
@ -28,3 +24,4 @@ RUN cpan -i Text::Template
|
|||
RUN git clone --depth 1 https://github.com/openweave/openweave-core
|
||||
WORKDIR $SRC/openweave-core
|
||||
COPY build.sh $SRC/
|
||||
COPY patch.diff $SRC/
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#
|
||||
################################################################################
|
||||
|
||||
git apply --ignore-space-change --ignore-whitespace $SRC/patch.diff
|
||||
|
||||
function copy_lib
|
||||
{
|
||||
local fuzzer_path=$1
|
||||
|
@ -35,7 +37,16 @@ fi
|
|||
./bootstrap
|
||||
# java fails with Source option 6 is no longer supported. Use 7 or later.
|
||||
./configure --disable-java --enable-fuzzing --disable-shared
|
||||
|
||||
# patch bluez
|
||||
sed -i 's/sys\/socket.h>/sys\/socket.h>\n#include <linux\/sockios.h>/g' ./third_party/bluez/repo/tools/l2test.c
|
||||
sed -i 's/sys\/stat.h>/sys\/stat.h>\n#include <linux\/sockios.h>/g' ./third_party/bluez/repo/tools/rctest.c
|
||||
|
||||
# OpenSSL now declares RAND_bytes so we must patch
|
||||
find ./src/test-apps/fuzz/ -name "FuzzP*.cpp" -exec sed -i 's/RAND_bytes/RAND_bytes2/g' {} \;
|
||||
|
||||
make -j$(nproc)
|
||||
|
||||
find src/test-apps/fuzz/ -type f -executable -name "Fuzz*" | while read i; do
|
||||
patchelf --set-rpath '$ORIGIN/lib' ${i}
|
||||
copy_lib ${i} libglib
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
diff --git a/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp b/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
|
||||
index 7a6cb42..c05caae 100644
|
||||
--- a/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
|
||||
+++ b/src/lib/support/crypto/WeaveRNG-OpenSSL.cpp
|
||||
@@ -53,8 +53,9 @@ WEAVE_ERROR InitSecureRandomDataSource(nl::Weave::Crypto::EntropyFunct entropyFu
|
||||
|
||||
WEAVE_ERROR GetSecureRandomData(uint8_t *buf, uint16_t len)
|
||||
{
|
||||
- if (RAND_bytes((unsigned char *)buf, (int)len) != 1)
|
||||
- return WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE;
|
||||
+ //if (RAND_bytes((unsigned char *)buf, (int)len) != 1)
|
||||
+ // return WEAVE_ERROR_RANDOM_DATA_UNAVAILABLE;
|
||||
+ memset((unsigned char *)buf, 'A', (int)len);
|
||||
|
||||
return WEAVE_NO_ERROR;
|
||||
}
|
||||
diff --git a/src/tools/weave/CertUtils.cpp b/src/tools/weave/CertUtils.cpp
|
||||
index 2bd8097..a1dce36 100644
|
||||
--- a/src/tools/weave/CertUtils.cpp
|
||||
+++ b/src/tools/weave/CertUtils.cpp
|
||||
@@ -695,8 +695,9 @@ bool SetCertSerialNumber(X509 *cert)
|
||||
ASN1_INTEGER *snInt = X509_get_serialNumber(cert);
|
||||
|
||||
// Generate a random value to be used as the serial number.
|
||||
- if (!RAND_bytes(reinterpret_cast<uint8_t *>(&rnd), sizeof(rnd)))
|
||||
- ReportOpenSSLErrorAndExit("RAND_bytes", res = false);
|
||||
+ //if (!RAND_bytes(reinterpret_cast<uint8_t *>(&rnd), sizeof(rnd)))
|
||||
+ // ReportOpenSSLErrorAndExit("RAND_bytes", res = false);
|
||||
+ memset(reinterpret_cast<uint8_t *>(&rnd), 'A', sizeof(rnd));
|
||||
|
||||
// Avoid negative numbers.
|
||||
rnd &= 0x7FFFFFFFFFFFFFFF;
|
||||
diff --git a/src/tools/weave/Cmd_GenProvisioningData.cpp b/src/tools/weave/Cmd_GenProvisioningData.cpp
|
||||
index 85ca2e2..bd5c18b 100644
|
||||
--- a/src/tools/weave/Cmd_GenProvisioningData.cpp
|
||||
+++ b/src/tools/weave/Cmd_GenProvisioningData.cpp
|
||||
@@ -543,8 +543,9 @@ char *GeneratePairingCode(uint32_t pairingCodeLen)
|
||||
}
|
||||
|
||||
// Generate random data for the pairing code, excluding the check digit at the end.
|
||||
- if (!RAND_bytes((uint8_t *)pairingCode, pairingCodeLen - 1))
|
||||
- ReportOpenSSLErrorAndExit("Failed to get random data", pairingCode = NULL);
|
||||
+ //if (!RAND_bytes((uint8_t *)pairingCode, pairingCodeLen - 1))
|
||||
+ // ReportOpenSSLErrorAndExit("Failed to get random data", pairingCode = NULL);
|
||||
+ memset((uint8_t *)pairingCode, 'A', pairingCodeLen - 1);
|
||||
|
||||
// Convert the random data to characters in the range 0-9, A-H, J-N, P, R-Y (base-32 alphanumeric, excluding I, O, Q and Z).
|
||||
for (uint32_t i = 0; i < pairingCodeLen - 1; i++)
|
Loading…
Reference in New Issue