Set up autotools build to build against vanilla NaCl.

Fixes #363.
This commit is contained in:
iphydf 2017-01-05 19:05:10 +00:00
parent bec03de2ba
commit 8f1dbaa2c5
No known key found for this signature in database
GPG Key ID: 3855DBA2D74403C9
4 changed files with 21 additions and 4 deletions

View File

@ -338,8 +338,8 @@ START_TEST(test_memzero)
} }
END_TEST END_TEST
#define CRYPTO_TEST_MEMCMP_SIZE 1024*32 #define CRYPTO_TEST_MEMCMP_SIZE 1024*256
#define CRYPTO_TEST_MEMCMP_COUNT 500 #define CRYPTO_TEST_MEMCMP_COUNT 1000
#define CRYPTO_TEST_MEMCMP_EPS 10 #define CRYPTO_TEST_MEMCMP_EPS 10
static int cmp(const void *a, const void *b) static int cmp(const void *a, const void *b)
@ -389,8 +389,11 @@ START_TEST(test_memcmp)
uint8_t not_same[sizeof(src)]; uint8_t not_same[sizeof(src)];
rand_bytes(not_same, sizeof(not_same)); rand_bytes(not_same, sizeof(not_same));
printf("timing memcmp (equal arrays)\n");
clock_t same_median = memcmp_median(src, same, sizeof(src)); 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)); clock_t not_same_median = memcmp_median(src, not_same, sizeof(src));
printf("comparing times\n");
clock_t delta; clock_t delta;

View File

@ -1,3 +1,14 @@
#!/bin/sh #!/bin/sh
. other/travis/toxcore-linux-install . 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
}

View File

@ -3,8 +3,9 @@
# Build toxcore and run tests. # Build toxcore and run tests.
./autogen.sh ./autogen.sh
./configure \ ./configure \
--with-libsodium-libs=$CACHE_DIR/lib \ --with-nacl-libs=$CACHE_DIR/lib/amd64 \
--with-libsodium-headers=$CACHE_DIR/include \ --with-nacl-headers=$CACHE_DIR/include/amd64 \
--enable-nacl \
--enable-daemon \ --enable-daemon \
--enable-logging \ --enable-logging \
--enable-ntox \ --enable-ntox \

View File

@ -31,8 +31,10 @@
#define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}} #define SET_ERROR_PARAMETER(param, x) {if(param) {*param = x;}}
#ifdef VANILLA_NACL #ifdef VANILLA_NACL
#include <crypto_box.h>
#include <crypto_hash_sha256.h> #include <crypto_hash_sha256.h>
#include "crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h" #include "crypto_pwhash_scryptsalsa208sha256/crypto_pwhash_scryptsalsa208sha256.h"
#define crypto_box_MACBYTES (crypto_box_ZEROBYTES - crypto_box_BOXZEROBYTES)
#else #else
#include <sodium.h> #include <sodium.h>
#endif #endif