From 8f1dbaa2c56112a917c1eb6131d5074684e40f1c Mon Sep 17 00:00:00 2001 From: iphydf Date: Thu, 5 Jan 2017 19:05:10 +0000 Subject: Set up autotools build to build against vanilla NaCl. Fixes #363. --- auto_tests/crypto_test.c | 7 +++++-- other/travis/autotools-linux-install | 11 +++++++++++ other/travis/autotools-script | 5 +++-- toxencryptsave/toxencryptsave.c | 2 ++ 4 files changed, 21 insertions(+), 4 deletions(-) diff --git a/auto_tests/crypto_test.c b/auto_tests/crypto_test.c index 57a2a43b..7c5338e2 100644 --- a/auto_tests/crypto_test.c +++ b/auto_tests/crypto_test.c @@ -338,8 +338,8 @@ START_TEST(test_memzero) } END_TEST -#define CRYPTO_TEST_MEMCMP_SIZE 1024*32 -#define CRYPTO_TEST_MEMCMP_COUNT 500 +#define CRYPTO_TEST_MEMCMP_SIZE 1024*256 +#define CRYPTO_TEST_MEMCMP_COUNT 1000 #define CRYPTO_TEST_MEMCMP_EPS 10 static int cmp(const void *a, const void *b) @@ -389,8 +389,11 @@ START_TEST(test_memcmp) uint8_t not_same[sizeof(src)]; rand_bytes(not_same, sizeof(not_same)); + printf("timing memcmp (equal arrays)\n"); clock_t same_median = memcmp_median(src, same, sizeof(src)); + printf("timing memcmp (non-equal arrays)\n"); clock_t not_same_median = memcmp_median(src, not_same, sizeof(src)); + printf("comparing times\n"); clock_t delta; diff --git a/other/travis/autotools-linux-install b/other/travis/autotools-linux-install index edc6a2dc..8633075f 100644 --- a/other/travis/autotools-linux-install +++ b/other/travis/autotools-linux-install @@ -1,3 +1,14 @@ #!/bin/sh . other/travis/toxcore-linux-install + +# Also install vanilla NaCl +[ -f $CACHE_DIR/lib/amd64/libnacl.a ] || { + curl https://hyperelliptic.org/nacl/nacl-20110221.tar.bz2 | tar -jxf + cd nacl-20110221 # pushd + "./do" + # "make install" + mv build/*/include/* $CACHE_DIR/include + mv build/*/lib/* $CACHE_DIR/lib + cd - # popd +} diff --git a/other/travis/autotools-script b/other/travis/autotools-script index 7d04c968..3ab598c0 100755 --- a/other/travis/autotools-script +++ b/other/travis/autotools-script @@ -3,8 +3,9 @@ # Build toxcore and run tests. ./autogen.sh ./configure \ - --with-libsodium-libs=$CACHE_DIR/lib \ - --with-libsodium-headers=$CACHE_DIR/include \ + --with-nacl-libs=$CACHE_DIR/lib/amd64 \ + --with-nacl-headers=$CACHE_DIR/include/amd64 \ + --enable-nacl \ --enable-daemon \ --enable-logging \ --enable-ntox \ diff --git a/toxencryptsave/toxencryptsave.c b/toxencryptsave/toxencryptsave.c index bd56e780..0c799bfb 100644 --- a/toxencryptsave/toxencryptsave.c +++ b/toxencryptsave/toxencryptsave.c @@ -31,8 +31,10 @@ #define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}} #ifdef VANILLA_NACL +#include #include #include "crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h" +#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES) #else #include #endif -- cgit v1.2.3