diff --git a/.circleci/config.yml b/.circleci/config.yml index c7be4c01c..a789a7a41 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: # 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 ${CONFIGURE_ARGS} && + 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,21 @@ 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 + 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: @@ -93,6 +132,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 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 ------------- diff --git a/scripts/arm-cross-compile.sh b/scripts/arm-cross-compile.sh index 1e3e7e8cb..d97428205 100755 --- a/scripts/arm-cross-compile.sh +++ b/scripts/arm-cross-compile.sh @@ -25,9 +25,9 @@ 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 + --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;