From ce9bbcaef38744d5e5986701f48f0ed1d1c01962 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Tue, 6 Aug 2019 22:18:31 -0400 Subject: [PATCH 1/6] Add CircleCI builds for emaulated ARM jobs (aarch64, armhf, armel) --- .circleci/config.yml | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index c7be4c01c..8cc810765 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,6 +17,30 @@ version: 2 - store_test_results: # Note that this command will fail when running CircleCI locally, that is expected behaviour path: test-results +.emulatedjob: &emulatedjob + machine: + image: ubuntu-1604:201903-01 + steps: + - checkout + - run: + name: Install the emulation handlers + command: docker run --rm --privileged multiarch/qemu-user-static:register --reset + - run: + name: Run the tests in a container + command: | + docker run -e SKIP_TESTS=style --rm -v `pwd`:`pwd` -w `pwd` dstebila/liboqs:debian-buster-${ARCH}-0.1.0 /bin/bash -c " + uname -a && + file /bin/ls && + autoreconf -i && + ./configure --enable-silent-rules --disable-sig-sphincs && + make -j && + make check && + mkdir -p test-results/pytest && + python3 -m pytest --verbose --junitxml=test-results/pytest/results.xml --numprocesses=auto + " + - store_test_results: + path: test-results + jobs: debian-buster-amd64: <<: *oqsjob @@ -24,6 +48,18 @@ jobs: IMAGE: dstebila/liboqs:debian-buster-amd64-0.1.0 CONFIGURE_ARGS: --disable-kem-bike # FIXME: BIKE doesn't work on CircleCI due to symbol _CMP_LT_OS not being defined SKIP_TESTS: style + debian-buster-aarch64: + <<: *emulatedjob + environment: + ARCH: aarch64 + debian-buster-armhf: + <<: *emulatedjob + environment: + ARCH: armhf + debian-buster-armel: + <<: *emulatedjob + environment: + ARCH: armel ubuntu-xenial-x86_64-gcc49: <<: *oqsjob environment: @@ -93,6 +129,9 @@ workflows: - master jobs: - debian-buster-amd64 + - debian-buster-aarch64 + - debian-buster-armhf + - debian-buster-armel - ubuntu-xenial-x86_64-gcc49 - ubuntu-xenial-x86_64-gcc5 - ubuntu-xenial-x86_64-gcc6 From 52adc6c9dfe3859987ac864e35d663cd8b445f5c Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Tue, 6 Aug 2019 22:18:46 -0400 Subject: [PATCH 2/6] Try removing some hacks for Travis ARM build --- scripts/arm-cross-compile.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/scripts/arm-cross-compile.sh b/scripts/arm-cross-compile.sh index 1e3e7e8cb..487c1f38b 100755 --- a/scripts/arm-cross-compile.sh +++ b/scripts/arm-cross-compile.sh @@ -25,8 +25,6 @@ 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 ) From c9760031698c30da43b0a4568e28f100b055826e Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Tue, 6 Aug 2019 22:20:11 -0400 Subject: [PATCH 3/6] Update ARM testing notes in README --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 993390747..e9a1e96f6 100644 --- a/README.md +++ b/README.md @@ -183,14 +183,13 @@ The supported schemes are defined in the projects' `winconfig.h` file. Building and running on ARM --------------------------- -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. +Our continuous integration system includes builds on various ARM architectures, see the Testing section below. -In order to cross compile, you need to have an appropriate toolchain installed, and to test you need QEMU installed. On Ubuntu: +Binaries for ARM can also be cross-compiled on Linux. In order to cross compile, you need to have an appropriate toolchain installed, and to test you need QEMU installed. + +For example, to cross compile for ARMv7 (armel) on Ubuntu Linux, first install the required toolchain, then use the scripts below to build and test on an emulated ARM Cortex-A8: 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 @@ -207,7 +206,8 @@ Builds are tested using continuous integration systems as follows: - Ubuntu 14.04.5 (Trusty), with gcc, on ARM Cortex-A8 (via QEMU) using Travis CI - Ubuntu 16.04.6 (Xenial), with gcc-4.9, gcc-5, gcc-6, gcc-7, and gcc-8, on x86_64 using CircleCI - Ubuntu 18.04.2 (Bionic), with gcc-7, on x86_64 using CircleCI -- Debian 10 (Buster), with gcc-8.3.0, on amd64 using CircleCI +- Debian 10 (Buster), with gcc-8.3.0, on amd64 using CircleCI +- Debian 10 (Buster), with gcc-8.3.0, on ARMv8 (aarch64), ARMv7 (armhf, armel) (via QEMU) using CircleCI - Windows Server 2016, with Visual Studio 2017, on x86_64 using AppVeyor Build status: @@ -216,7 +216,7 @@ Build status: - [CircleCI](https://circleci.com/gh/open-quantum-safe/liboqs/tree/master): ![Build status image](https://circleci.com/gh/open-quantum-safe/liboqs/tree/master.svg?style=svg) - [Travis CI](https://travis-ci.org/open-quantum-safe/liboqs): ![Build status image](https://travis-ci.org/open-quantum-safe/liboqs.svg?branch=master) -You can locally run any of the integration tests that CircleCI runs. First, you need to install CircleCI's local command line interface as indicated in the [installation instructions](https://circleci.com/docs/2.0/local-cli/). Then: +You can locally run most of the integration tests that CircleCI runs. First, you need to install CircleCI's local command line interface as indicated in the [installation instructions](https://circleci.com/docs/2.0/local-cli/). Then: circleci local execute --job @@ -234,6 +234,8 @@ where `` is one of the following: You may receive an error "Failed uploading test results directory" when running CircleCI locally, that is expected behaviour. +Note that you cannot run "machine" CircleCI builds locally, which are what we use for testing builds on emulated platforms, specifically the ARM `debian-buster-aarch64`, `-armhf`, and `-armel` jobs. + Documentation ------------- From 4f9f811a3d7395c3f703faaed473fa67a2093bd5 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 7 Aug 2019 08:47:40 -0400 Subject: [PATCH 4/6] Fix compilation problems on ARM --- .circleci/config.yml | 7 +++++-- scripts/arm-cross-compile.sh | 2 ++ src/common/rand_nist.c | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8cc810765..a789a7a41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,14 +25,14 @@ version: 2 - run: name: Install the emulation handlers command: docker run --rm --privileged multiarch/qemu-user-static:register --reset - - run: + - run: # Skipping sig-sphincs because it exhausts memory on CircleCI name: Run the tests in a container command: | docker run -e SKIP_TESTS=style --rm -v `pwd`:`pwd` -w `pwd` dstebila/liboqs:debian-buster-${ARCH}-0.1.0 /bin/bash -c " uname -a && file /bin/ls && autoreconf -i && - ./configure --enable-silent-rules --disable-sig-sphincs && + ./configure --enable-silent-rules ${CONFIGURE_ARGS} && make -j && make check && mkdir -p test-results/pytest && @@ -52,14 +52,17 @@ jobs: <<: *emulatedjob environment: ARCH: aarch64 + CONFIGURE_ARGS: --disable-sig-sphincs # sig-sphincs exhausts memory on CircleCI servers debian-buster-armhf: <<: *emulatedjob environment: ARCH: armhf + CONFIGURE_ARGS: --disable-sig-sphincs --disable-sig-qtesla # sig-sphincs exhausts memory on CircleCI servers; qTesla fails on armhf debian-buster-armel: <<: *emulatedjob environment: ARCH: armel + CONFIGURE_ARGS: --disable-sig-sphincs --disable-sig-qtesla # sig-sphincs exhausts memory on CircleCI servers; qTesla fails on armel ubuntu-xenial-x86_64-gcc49: <<: *oqsjob environment: diff --git a/scripts/arm-cross-compile.sh b/scripts/arm-cross-compile.sh index 487c1f38b..d97428205 100755 --- a/scripts/arm-cross-compile.sh +++ b/scripts/arm-cross-compile.sh @@ -26,6 +26,8 @@ autoreconf -i hacks=( gcc_cv_compiler=true # Detecting at this phase isn't good for cross compilation CFLAGS=-D_ARM_ # Several files aren't using the right define + --disable-sig-picnic # Problems building Picnic using cross compilation + --disable-sig-qtesla # qTesla fails on armhf and armel ) ./configure --disable-shared --enable-static --host="${CHOST}" --build="$CBUILD" CC="${CHOST}-gcc" --with-openssl="${PREFIX}" "${hacks[@]}" diff --git a/src/common/rand_nist.c b/src/common/rand_nist.c index 3a5d2de27..6d5a85bac 100644 --- a/src/common/rand_nist.c +++ b/src/common/rand_nist.c @@ -79,7 +79,7 @@ OQS_API void OQS_randombytes_nist_kat_init(unsigned char *entropy_input, unsigne DRBG_ctx.reseed_counter = 1; } -void OQS_randombytes_nist_kat(unsigned char *x, unsigned long long xlen) { +void OQS_randombytes_nist_kat(unsigned char *x, size_t xlen) { unsigned char block[16]; int i = 0; From 887622edf04b51716bd294ab9c3d38163c8b0a41 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 7 Aug 2019 09:35:44 -0400 Subject: [PATCH 5/6] Temporarily enable ARM tests on CircleCI --- .circleci/config.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index a789a7a41..bd32d4b4d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -118,6 +118,9 @@ workflows: build: jobs: - debian-buster-amd64 + - debian-buster-aarch64 + - debian-buster-armhf + - debian-buster-armel - ubuntu-xenial-x86_64-gcc8 - ubuntu-xenial-x86_64-gcc8-noopenssl - ubuntu-xenial-x86_64-gcc8-noshared From a61aa2c8e30709e126affcc2de13bbd52bef9c42 Mon Sep 17 00:00:00 2001 From: Douglas Stebila Date: Wed, 7 Aug 2019 15:55:52 -0400 Subject: [PATCH 6/6] Only run ARM CircleCI tests in nightly builds [skip ci] --- .circleci/config.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index bd32d4b4d..a789a7a41 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -118,9 +118,6 @@ workflows: build: jobs: - debian-buster-amd64 - - debian-buster-aarch64 - - debian-buster-armhf - - debian-buster-armel - ubuntu-xenial-x86_64-gcc8 - ubuntu-xenial-x86_64-gcc8-noopenssl - ubuntu-xenial-x86_64-gcc8-noshared