diff --git a/.travis.yml b/.travis.yml index fa3084379..11b233dea 100644 --- a/.travis.yml +++ b/.travis.yml @@ -20,6 +20,19 @@ matrix: - graphviz before_install: - sh .travis/install-clang-format-linux.sh + script: + - .travis/all-tests.sh + - os: linux + compiler: arm-linux-gnueabi-gcc + addons: + apt: + packages: + - gcc-arm-linux-gnueabi + - libc6-dev-armel-cross + - qemu + script: + - scripts/arm-cross-compile.sh + - scripts/arm-run-tests-qemu.sh - os: linux compiler: gcc env: @@ -35,6 +48,8 @@ matrix: - graphviz before_install: - sh .travis/install-clang-format-linux.sh + script: + - .travis/all-tests.sh - os: linux compiler: gcc env: CC_OVERRIDE=gcc-5 @@ -46,6 +61,8 @@ matrix: - gcc-5 - doxygen - graphviz + script: + - .travis/all-tests.sh - os: linux compiler: gcc env: @@ -60,6 +77,8 @@ matrix: - libssl-dev - doxygen - graphviz + script: + - .travis/all-tests.sh - os: osx compiler: clang env: @@ -70,6 +89,8 @@ matrix: before_install: - brew update - brew install libsodium doxygen graphviz + script: + - .travis/all-tests.sh - os: osx compiler: clang env: @@ -78,6 +99,5 @@ matrix: before_install: - brew update - brew install doxygen graphviz - -script: - - .travis/all-tests.sh + script: + - .travis/all-tests.sh diff --git a/README.md b/README.md index 26ee72495..b5f403db4 100644 --- a/README.md +++ b/README.md @@ -149,14 +149,21 @@ Builds are tested using the Appveyor continuous integration system on Windows Se The supported schemes are defined in the projects' `winconfig.h` file. -Building on other platforms +Building and running on ARM --------------------------- -We do not yet fully support building liboqs on ARM platforms, but are working towards maintaining ARM support in a future release. +Binaries for ARM can be cross-compiled from Ubuntu Linux. Builds are tested using the Travis continuous integration system on Ubuntu 14.04.5 with QEMU target CPU Cortex-A8. -At present, we have successfully built liboqs on a Raspberry Pi 3B (armv7l) with the following configure command: +In order to cross compile, you need to have an appropriate toolchain installed, and to test you need QEMU installed. On Ubuntu: - ./configure --disable-aes-ni --disable-sig-qtesla --disable-kem-frodokem + sudo apt install gcc-arm-linux-gnueabi libc6-dev-armel-cross qemu + +Once the toolchain is installed, you can use the following scripts to build and test ARM builds from Ubuntu Linux: + + scripts/arm-cross-compile.sh + scripts/arm-run-tests-qemu.sh + +At present there are still some quirks with our ARM build, including problems with the Picnic and qTESLA and the known answer tests causing build errors or segmentation faults. See issues #461, #462, and #463. Documentation ------------- diff --git a/scripts/arm-cross-compile.sh b/scripts/arm-cross-compile.sh new file mode 100755 index 000000000..ebf7d5704 --- /dev/null +++ b/scripts/arm-cross-compile.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# sudo apt-get install gcc-arm-linux-gnueabi libc6-dev-armel-cross + +set -e + +CBUILD="$(gcc -dumpmachine)" +CHOST=arm-linux-gnueabi + +rm -rf build-arm +mkdir build-arm +PREFIX="$(pwd)/build-arm" + +if [ ! -f "openssl-1.1.1a.tar.gz" ]; then + wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz +fi +rm -rf openssl-1.1.1a +tar zxf openssl-1.1.1a.tar.gz +cd openssl-1.1.1a +CC="${CHOST}-gcc" ./Configure linux-armv4 no-shared no-dso no-hw no-engine no-tests -DOPENSSL_NO_SECURE_MEMORY --prefix="${PREFIX}" +make -j +make install_dev +cd .. + +autoreconf -i +hacks=( + gcc_cv_compiler=true # Detecting at this phase isn't good for cross compilation + --disable-aes-ni # This should be conditionalized on x86 host + --disable-sig-picnic + CFLAGS=-D_ARM_ # Several files aren't using the right define +) + +./configure --disable-shared --enable-static --host="${CHOST}" --build="$CBUILD" CC="${CHOST}-gcc" --with-openssl-dir="${PREFIX}" "${hacks[@]}" +make -j +make -j check LDFLAGS="-L${PREFIX}/lib -static" diff --git a/scripts/arm-run-tests-qemu.sh b/scripts/arm-run-tests-qemu.sh new file mode 100755 index 000000000..e77864d8e --- /dev/null +++ b/scripts/arm-run-tests-qemu.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# sudo apt-get install qemu + +set -e + +CHOST=arm-linux-gnueabi + +qemu-arm -cpu cortex-a8 -L /usr/arm-linux-gnueabi tests/example_kem +qemu-arm -cpu cortex-a8 -L /usr/arm-linux-gnueabi tests/test_kem + +# qemu-arm -cpu cortex-a8 -L /usr/arm-linux-gnueabi tests/example_sig +# qemu-arm -cpu cortex-a8 -L /usr/arm-linux-gnueabi tests/test_sig