diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 000000000..adbaf82a1 --- /dev/null +++ b/.travis.yml @@ -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 \ No newline at end of file diff --git a/Makefile b/Makefile index 80cbb1648..abb7ceca6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/README.md b/README.md index a74f79c8d..f12fa125e 100644 --- a/README.md +++ b/README.md @@ -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 64–67 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 diff --git a/src/kex/test_kex.c b/src/kex/test_kex.c index 93a009ca4..35dbc579a 100644 --- a/src/kex/test_kex.c +++ b/src/kex/test_kex.c @@ -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; } diff --git a/src/rand/test_rand.c b/src/rand/test_rand.c index 6a551249f..2281ee977 100755 --- a/src/rand/test_rand.c +++ b/src/rand/test_rand.c @@ -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; }