lcov exclusion

This commit is contained in:
Frank Denis 2015-12-25 02:09:12 +01:00
parent 2f4603ff7e
commit d839d74c89
2 changed files with 10 additions and 3 deletions

View File

@ -89,7 +89,7 @@ sodium_hrtime(void)
struct timeval tv; struct timeval tv;
if (gettimeofday(&tv, NULL) != 0) { if (gettimeofday(&tv, NULL) != 0) {
abort(); abort(); /* LCOV_EXCL_LINE */
} }
ts = ((uint64_t) tv.tv_sec) * 1000000U + (uint64_t) tv.tv_usec; 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); assert(size <= SSIZE_MAX);
do { do {
while ((readnb = read(fd, buf, size)) < (ssize_t) 0 && 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) { if (readnb < (ssize_t) 0) {
return readnb; /* LCOV_EXCL_LINE */ return readnb; /* LCOV_EXCL_LINE */
} }
@ -308,7 +308,7 @@ randombytes_salsa20_random_stir(void)
#endif #endif
if (crypto_generichash(stream.key, sizeof stream.key, k0, sizeof_k0, if (crypto_generichash(stream.key, sizeof stream.key, k0, sizeof_k0,
hsigma, sizeof hsigma) != 0) { hsigma, sizeof hsigma) != 0) {
abort(); abort(); /* LCOV_EXCL_LINE */
} }
COMPILER_ASSERT(sizeof stream.key <= sizeof m0); COMPILER_ASSERT(sizeof stream.key <= sizeof m0);
randombytes_salsa20_random_rekey(m0); randombytes_salsa20_random_rekey(m0);

View File

@ -12,6 +12,11 @@ static unsigned char alicepk[32]
0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38, 0xdc, 0xb4, 0x3e, 0xf7, 0x5a, 0x0d, 0xbf, 0x3a, 0x0d, 0x26, 0x38,
0x1a, 0xf4, 0xeb, 0xa4, 0xa9, 0x8e, 0xaa, 0x9b, 0x4e, 0x6a }; 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] static unsigned char nonce[24]
= { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73, = { 0x69, 0x69, 0x6e, 0xe9, 0x55, 0xb6, 0x2b, 0x73,
0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6, 0xcd, 0x62, 0xbd, 0xa8, 0x75, 0xfc, 0x73, 0xd6,
@ -50,6 +55,8 @@ int main(void)
} }
printf("\n"); printf("\n");
} }
ret = crypto_box_open(m, c, 163, nonce, small_order_p, bobsk);
assert(ret == -1);
memset(m, 0, sizeof m); memset(m, 0, sizeof m);
ret = crypto_box_beforenm(k, alicepk, bobsk); ret = crypto_box_beforenm(k, alicepk, bobsk);