Travis CI (#11)

* Add Travis for gcc 4.8/4.9/5/6 on Ubuntu and clang on macOS

* Add make check in README

* Using EXIT_SUCCESS and EXIT_FAILURE
This commit is contained in:
Tancrède Lepoint 2016-10-01 16:10:13 -04:00 committed by Douglas Stebila
parent 8b7139a20b
commit 1d3e06d04b
5 changed files with 79 additions and 15 deletions

49
.travis.yml Normal file
View File

@ -0,0 +1,49 @@
language: c
sudo: false
matrix:
include:
- os: linux
compiler: gcc
env: CC_OQS=gcc-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.8
- os: linux
compiler: gcc
env: CC_OQS=gcc-4.9
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-4.9
- os: linux
compiler: gcc
env: CC_OQS=gcc-5
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-5
- os: linux
compiler: gcc
env: CC_OQS=gcc-6
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- gcc-6
- os: osx
compiler: clang
env: CC_OQS=clang
script:
- make
- make check

View File

@ -1,4 +1,9 @@
CC=cc
ifdef CC_OQS
CC=$(CC_OQS)
else
CC=cc
endif
AR=ar rcs
CURL=curl
RANLIB=ranlib
@ -9,6 +14,8 @@ CFLAGS=$(DEFAULTS) -DCONSTANT_TIME
LDFLAGS=-lm
INCLUDES=-Iinclude
.PHONY: all check clean prettyprint
all: links lib tests
objs/%.o: src/%.c
@ -59,6 +66,10 @@ tests: lib src/rand/test_rand.c src/kex/test_kex.c
docs: links
doxygen
check: links tests
./test_kex
./test_rand
clean:
rm -rf docs objs include
rm -f test_rand test_kex liboqs.a

View File

@ -10,7 +10,7 @@ The **Open Quantum Safe (OQS) project** has the goal of developing and prototypi
OQS will also include integrations into application-level protocols to provide easy prototyping of quantum-resistant cryptography. Our first integration is in OpenSSL:
- **open-quantum-safe/openssl** is an integration of liboqs into OpenSSL 1.0.2. The goal of this integration is to provide easy prototyping of quantum-resistant cryptography. The integration should not be considered "production quality". See more about this integration in its Github repository [open-quantum-safe/openssl/](https://github.com/open-quantum-safe/openssl/).
- **open-quantum-safe/openssl** is an integration of liboqs into OpenSSL 1.0.2. The goal of this integration is to provide easy prototyping of quantum-resistant cryptography. The integration should not be considered "production quality". See more about this integration in its GitHub repository [open-quantum-safe/openssl/](https://github.com/open-quantum-safe/openssl/).
More information on OQS can be found in slides 6467 of [this presentation](https://www.douglas.stebila.ca/files/research/presentations/20160812-SAC.pdf) by Douglas Stebila.
@ -25,7 +25,7 @@ liboqs currently contains:
Builds have been tested on Mac OS X 10.11.6, Ubuntu 16.04.1, and Windows 10.
To build, clone or download the source from Github, then simply type:
To build, clone or download the source from GitHub, then simply type:
make
@ -35,6 +35,10 @@ This will generate:
- `test_rand`: A simple test harness for the random number generator. This will test the distance of PRNG output from uniform using statistical distance.
- `test_kex`: A simple test harness for the default key exchange algorithm. This will output key exchange messages; indicate whether the parties agree on the session key or not over a large number of trials; and measure the distance of the sessions keys from uniform using statistical distance.
To run the tests, simply type:
make check
Windows binaries can be generated using the Visual Studio solution in the VisualStudio folder.
## Documentation

View File

@ -158,7 +158,7 @@ cleanup:
int main() {
int ret;
int success;
/* setup RAND */
OQS_RAND *rand = NULL;
@ -167,21 +167,21 @@ int main() {
goto err;
}
ret = kex_test_correctness_wrapper(rand, &OQS_KEX_new, NULL, 0, NULL, KEX_TEST_ITERATIONS);
if (ret != 1) {
success = kex_test_correctness_wrapper(rand, &OQS_KEX_new, NULL, 0, NULL, KEX_TEST_ITERATIONS);
if (success != 1) {
goto err;
}
ret = 1;
success = 1;
goto cleanup;
err:
ret = 0;
success = 0;
fprintf(stderr, "ERROR!\n");
cleanup:
OQS_RAND_free(rand);
return ret;
return (success == 1) ? EXIT_SUCCESS : EXIT_FAILURE;
}

View File

@ -137,20 +137,20 @@ static int rand_test_distribution_wrapper(OQS_RAND * (*new_method)(), int iterat
int main() {
int ret;
int success;
ret = rand_test_distribution_wrapper(&OQS_RAND_new, RAND_TEST_ITERATIONS);
if (ret != 1) goto err;
success = rand_test_distribution_wrapper(&OQS_RAND_new, RAND_TEST_ITERATIONS);
if (success != 1) goto err;
ret = 1;
success = 1;
goto cleanup;
err:
ret = 0;
success = 0;
fprintf(stderr, "ERROR!\n");
cleanup:
return ret;
return (success == 1) ? EXIT_SUCCESS : EXIT_FAILURE;
}