aboutsummaryrefslogtreecommitdiffhomepage
path: root/projects/cryptofuzz
diff options
context:
space:
mode:
authorGravatar Guido Vranken <guidovranken@users.noreply.github.com>2019-08-01 00:40:12 +0200
committerGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2019-07-31 15:40:12 -0700
commitc09f8970dae1df27cf22c6887d9fd4798fb44ead (patch)
tree0725a7c57d5737fc5c64c54d99672322fc47adcf /projects/cryptofuzz
parent0a100f4c1c1484752423ec538a26533eef5b5d24 (diff)
[cryptofuzz] Golang (#2643)
Diffstat (limited to 'projects/cryptofuzz')
-rw-r--r--projects/cryptofuzz/Dockerfile1
-rwxr-xr-xprojects/cryptofuzz/build.sh35
2 files changed, 35 insertions, 1 deletions
diff --git a/projects/cryptofuzz/Dockerfile b/projects/cryptofuzz/Dockerfile
index 1dc4c63f..b534d6ae 100644
--- a/projects/cryptofuzz/Dockerfile
+++ b/projects/cryptofuzz/Dockerfile
@@ -38,6 +38,7 @@ RUN git clone --depth 1 -b oss-fuzz https://github.com/project-everest/hacl-star
RUN wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_0-stable.zip
RUN wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_2-stable.zip
RUN git clone --depth 1 https://github.com/google/cityhash.git
+RUN git clone --depth 1 https://github.com/golang/go
RUN apt-get remove -y libunwind8
COPY build.sh $SRC/
diff --git a/projects/cryptofuzz/build.sh b/projects/cryptofuzz/build.sh
index 5957efcd..bf5559a7 100755
--- a/projects/cryptofuzz/build.sh
+++ b/projects/cryptofuzz/build.sh
@@ -25,11 +25,35 @@ export INCLUDE_PATH_FLAGS=""
cd $SRC/cryptofuzz
python gen_repository.py
-cd $SRC/openssl
+if [[ $CFLAGS = *-m32* ]]
+then
+ export GOARCH=386
+ export CGO_ENABLED=1
+fi
+
+export GO111MODULE=off
+cd $SRC/go/src
+./make.bash
+export GOROOT=$(realpath $SRC/go)
+export GOPATH=$GOROOT/packages
+mkdir $GOPATH
+export PATH=$GOROOT/bin:$PATH
+export PATH=$GOROOT/packages/bin:$PATH
+
+apt-get remove golang-1.9-go -y
+rm /usr/bin/go
+
+go get golang.org/x/crypto/blake2b
+go get golang.org/x/crypto/blake2s
+go get golang.org/x/crypto/md4
+go get golang.org/x/crypto/ripemd160
# This enables runtime checks for C++-specific undefined behaviour.
export CXXFLAGS="$CXXFLAGS -D_GLIBCXX_DEBUG"
+# Prevent Boost compilation error with -std=c++17
+export CXXFLAGS="$CXXFLAGS -D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR"
+
export CXXFLAGS="$CXXFLAGS -I $SRC/cryptofuzz/fuzzing-headers/include"
if [[ $CFLAGS = *sanitize=memory* ]]
then
@@ -153,6 +177,15 @@ cd $SRC/cryptofuzz/modules/monero
make -B
##############################################################################
+# Compile Cryptofuzz Golang module
+if [[ $CFLAGS != *sanitize=memory* ]]
+then
+ export CXXFLAGS="$CXXFLAGS -DCRYPTOFUZZ_GOLANG"
+ cd $SRC/cryptofuzz/modules/golang
+ make -B
+fi
+
+##############################################################################
if [[ $CFLAGS != *sanitize=memory* && $CFLAGS != *-m32* ]]
then
# Compile LibreSSL (with assembly)