CI: compile/test against libressl too
This commit is contained in:
parent
d42539da59
commit
fcc9307d7c
18
.ci/build.sh
18
.ci/build.sh
@ -6,8 +6,15 @@ set -exu
|
|||||||
cd "$(dirname "$0")"
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
# dependencies to build+test pegh
|
# dependencies to build+test pegh
|
||||||
apk add build-base clang openssl-dev openssl-libs-static bash libsodium-dev libsodium-static
|
apk add build-base clang bash libsodium-dev libsodium-static libressl-dev
|
||||||
#apk add build-base clang libressl-dev bash
|
|
||||||
|
# first build for libressl, which doesn't have "EVP_PBE_scrypt" so can only be compiled with libsodium
|
||||||
|
make clean all PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 CC=clang LDFLAGS="-static -lcrypto" || clang pegh.c -DPEGH_LIBSODIUM -DPEGH_OPENSSL -static -lsodium -lcrypto -O3 -o pegh
|
||||||
|
mv pegh pegh.static.libsodium-libressl
|
||||||
|
|
||||||
|
# now remove libressl and install openssl
|
||||||
|
apk del libressl-dev
|
||||||
|
apk add openssl-dev openssl-libs-static
|
||||||
|
|
||||||
# gcc is apparantly incapable of building a static binary, even gcc -static helloworld.c ends up linked to libc, instead of solving, use clang
|
# gcc is apparantly incapable of building a static binary, even gcc -static helloworld.c ends up linked to libc, instead of solving, use clang
|
||||||
make clean all PEGH_LIBSODIUM=1 CC=clang LDFLAGS="-static -lsodium" || clang pegh.c -DPEGH_LIBSODIUM -static -lsodium -O3 -o pegh
|
make clean all PEGH_LIBSODIUM=1 CC=clang LDFLAGS="-static -lsodium" || clang pegh.c -DPEGH_LIBSODIUM -static -lsodium -O3 -o pegh
|
||||||
@ -15,7 +22,7 @@ mv pegh pegh.static.libsodium
|
|||||||
make clean all PEGH_OPENSSL=1 CC=clang LDFLAGS="-static -lcrypto" || clang pegh.c -DPEGH_OPENSSL -static -lcrypto -O3 -o pegh
|
make clean all PEGH_OPENSSL=1 CC=clang LDFLAGS="-static -lcrypto" || clang pegh.c -DPEGH_OPENSSL -static -lcrypto -O3 -o pegh
|
||||||
mv pegh pegh.static.openssl
|
mv pegh pegh.static.openssl
|
||||||
make clean all PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 CC=clang LDFLAGS="-static -lcrypto" || clang pegh.c -DPEGH_LIBSODIUM -DPEGH_OPENSSL -static -lsodium -lcrypto -O3 -o pegh
|
make clean all PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 CC=clang LDFLAGS="-static -lcrypto" || clang pegh.c -DPEGH_LIBSODIUM -DPEGH_OPENSSL -static -lsodium -lcrypto -O3 -o pegh
|
||||||
mv pegh pegh.static.libsodium-universal-aes
|
mv pegh pegh.static.libsodium-openssl
|
||||||
|
|
||||||
ls -lah pegh.static.*
|
ls -lah pegh.static.*
|
||||||
|
|
||||||
@ -28,16 +35,15 @@ ldd pegh.static.* || true
|
|||||||
|
|
||||||
# libsodium only supports AES-256-GCM on certain CPUs that have hardware instructions for it
|
# libsodium only supports AES-256-GCM on certain CPUs that have hardware instructions for it
|
||||||
# we can build them regardless, but we can't test them without that, pegh prints that right away
|
# we can build them regardless, but we can't test them without that, pegh prints that right away
|
||||||
|
export TEST_BINS="./pegh.static.openssl ./pegh.openssl ./pegh.static.libsodium-openssl ./pegh.libsodium-openssl ./pegh.static.libsodium-libressl"
|
||||||
set +e
|
set +e
|
||||||
if ./pegh.static.libsodium -h 2>&1 >/dev/null | grep '^Error: libsodium'
|
if ./pegh.static.libsodium -h 2>&1 >/dev/null | grep '^Error: libsodium'
|
||||||
then
|
then
|
||||||
echo "CPU does not have AES support so can't run libsodium version"
|
echo "CPU does not have AES support so can't run libsodium version"
|
||||||
# no aes support
|
|
||||||
export TEST_BINS="./pegh.static.openssl ./pegh.openssl ./pegh.static.libsodium-universal-aes ./pegh.libsodium-universal-aes"
|
|
||||||
else
|
else
|
||||||
echo "CPU has AES support so can run libsodium version"
|
echo "CPU has AES support so can run libsodium version"
|
||||||
# we can test everything
|
# we can test everything
|
||||||
export TEST_BINS="./pegh.static.openssl ./pegh.openssl ./pegh.static.libsodium-universal-aes ./pegh.libsodium-universal-aes ./pegh.libsodium ./pegh.static.libsodium"
|
export TEST_BINS="$TEST_BINS ./pegh.libsodium ./pegh.static.libsodium"
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
@ -14,7 +14,8 @@ docker run --rm -v "$BUILD_DIR":/tmp "$DOCKER_IMAGE" /tmp/build.sh || exit 1
|
|||||||
|
|
||||||
mv "$BUILD_DIR"pegh.static.openssl "./pegh-$ARCH-openssl"
|
mv "$BUILD_DIR"pegh.static.openssl "./pegh-$ARCH-openssl"
|
||||||
mv "$BUILD_DIR"pegh.static.libsodium "./pegh-$ARCH-libsodium"
|
mv "$BUILD_DIR"pegh.static.libsodium "./pegh-$ARCH-libsodium"
|
||||||
mv "$BUILD_DIR"pegh.static.libsodium-universal-aes "./pegh-$ARCH-libsodium-universal-aes"
|
mv "$BUILD_DIR"pegh.static.libsodium-openssl "./pegh-$ARCH-libsodium-openssl"
|
||||||
|
mv "$BUILD_DIR"pegh.static.libsodium-libressl "./pegh-$ARCH-libsodium-libressl"
|
||||||
rm -rf "$BUILD_DIR" 2>/dev/null
|
rm -rf "$BUILD_DIR" 2>/dev/null
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
4
test.sh
4
test.sh
@ -7,7 +7,7 @@ export dummy_mb="$1"
|
|||||||
[ "$dummy_file" = "" ] && export dummy_file='/tmp/randombytes'
|
[ "$dummy_file" = "" ] && export dummy_file='/tmp/randombytes'
|
||||||
[ "$dummy_mb" = "" ] && export dummy_mb='100'
|
[ "$dummy_mb" = "" ] && export dummy_mb='100'
|
||||||
|
|
||||||
[ "$TEST_BINS" = "" ] && TEST_BINS="./pegh.openssl ./pegh.libsodium ./pegh.libsodium-universal-aes"
|
[ "$TEST_BINS" = "" ] && TEST_BINS="./pegh.openssl ./pegh.libsodium ./pegh.libsodium-openssl"
|
||||||
|
|
||||||
set -euxo pipefail
|
set -euxo pipefail
|
||||||
|
|
||||||
@ -27,7 +27,7 @@ mv pegh pegh.libsodium
|
|||||||
|
|
||||||
# compile against both libsodium and openssl as a fallback for CPUs libsodium doesn't support
|
# compile against both libsodium and openssl as a fallback for CPUs libsodium doesn't support
|
||||||
make PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 || cc pegh.c -DPEGH_LIBSODIUM -DPEGH_OPENSSL -lsodium -lcrypto -O3 -o pegh
|
make PEGH_LIBSODIUM=1 PEGH_OPENSSL=1 || cc pegh.c -DPEGH_LIBSODIUM -DPEGH_OPENSSL -lsodium -lcrypto -O3 -o pegh
|
||||||
mv pegh pegh.libsodium-universal-aes
|
mv pegh pegh.libsodium-openssl
|
||||||
|
|
||||||
export key="$(< /dev/urandom tr -dc 'a-z0-9' | head -c12)"
|
export key="$(< /dev/urandom tr -dc 'a-z0-9' | head -c12)"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user