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")"
|
||||
|
||||
# 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 libressl-dev bash
|
||||
apk add build-base clang bash libsodium-dev libsodium-static libressl-dev
|
||||
|
||||
# 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
|
||||
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
|
||||
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
|
||||
mv pegh pegh.static.libsodium-universal-aes
|
||||
mv pegh pegh.static.libsodium-openssl
|
||||
|
||||
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
|
||||
# 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
|
||||
if ./pegh.static.libsodium -h 2>&1 >/dev/null | grep '^Error: libsodium'
|
||||
then
|
||||
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
|
||||
echo "CPU has AES support so can run libsodium version"
|
||||
# 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
|
||||
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.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
|
||||
|
||||
exit 0
|
||||
|
4
test.sh
4
test.sh
@ -7,7 +7,7 @@ export dummy_mb="$1"
|
||||
[ "$dummy_file" = "" ] && export dummy_file='/tmp/randombytes'
|
||||
[ "$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
|
||||
|
||||
@ -27,7 +27,7 @@ mv pegh pegh.libsodium
|
||||
|
||||
# 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
|
||||
mv pegh pegh.libsodium-universal-aes
|
||||
mv pegh pegh.libsodium-openssl
|
||||
|
||||
export key="$(< /dev/urandom tr -dc 'a-z0-9' | head -c12)"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user