From d839d74c89719c3f249a677fc23a297bd4ca1c4a Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Fri, 25 Dec 2015 02:09:12 +0100 Subject: [PATCH] lcov exclusion --- .../randombytes/salsa20/randombytes_salsa20_random.c | 6 +++--- test/default/box2.c | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c index 6da6b21b..7bfaa722 100644 --- a/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c +++ b/src/libsodium/randombytes/salsa20/randombytes_salsa20_random.c @@ -89,7 +89,7 @@ sodium_hrtime(void) struct timeval tv; if (gettimeofday(&tv, NULL) != 0) { - abort(); + abort(); /* LCOV_EXCL_LINE */ } ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec; } @@ -108,7 +108,7 @@ safe_read(const int fd, void * const buf_, size_t size) assert(size <= SSIZE_MAX); do { while ((readnb = read(fd, buf, size)) < (ssize_t) 0 && - (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */ + (errno == EINTR || errno == EAGAIN)); /* LCOV_EXCL_LINE */ if (readnb < (ssize_t) 0) { return readnb; /* LCOV_EXCL_LINE */ } @@ -308,7 +308,7 @@ randombytes_salsa20_random_stir(void) #endif if (crypto_generichash(stream.key, sizeof stream.key, k0, sizeof_k0, hsigma, sizeof hsigma) != 0) { - abort(); + abort(); /* LCOV_EXCL_LINE */ } COMPILER_ASSERT(sizeof stream.key <= sizeof m0); randombytes_salsa20_random_rekey(m0); diff --git a/test/default/box2.c b/test/default/box2.c index 2500da25..765d26c3 100644 --- a/test/default/box2.c +++ b/test/default/box2.c @@ -12,6 +12,11 @@ static unsigned char alicepk[32] 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a }; +static const unsigned char small_order_p[crypto_box_PUBLICKEYBYTES] + = { 0xe0, 0xeb, 0x7a, 0x7c, 0x3b, 0x41, 0xb8, 0xae, 0x16, 0x56, 0xe3, + 0xfa, 0xf1, 0x9f, 0xc4, 0x6a, 0xda, 0x09, 0x8d, 0xeb, 0x9c, 0x32, + 0xb1, 0xfd, 0x86, 0x62, 0x05, 0x16, 0x5f, 0x49, 0xb8, 0x00 }; + static unsigned char nonce[24] = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73, 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6, @@ -50,6 +55,8 @@ int main(void) } printf("\n"); } + ret = crypto_box_open(m, c, 163, nonce, small_order_p, bobsk); + assert(ret == -1); memset(m, 0, sizeof m); ret = crypto_box_beforenm(k, alicepk, bobsk);