From abd5df9ba14cd29f5bc99548f60608dbb10be03c Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Thu, 18 Sep 2014 22:22:51 -0700 Subject: [PATCH] lcov: annotate the actual "can't happen" lines. --- .../scryptsalsa208sha256/crypto_scrypt-common.c | 16 ++++++++-------- .../sse/pwhash_scryptsalsa208sha256_sse.c | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c index 3e315d9b..4f327aea 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c @@ -171,8 +171,8 @@ escrypt_r(escrypt_local_t * local, const uint8_t * passwd, size_t passwdlen, dst = encode64(dst, buflen - (dst - buf), hash, sizeof(hash)); sodium_memzero(hash, sizeof hash); - if (!dst || dst >= buf + buflen) { /* Can't happen LCOV_EXCL_LINE */ - return NULL; + if (!dst || dst >= buf + buflen) { + return NULL; /* Can't happen LCOV_EXCL_LINE */ } *dst = 0; /* NUL termination */ @@ -205,16 +205,16 @@ escrypt_gensalt_r(uint32_t N_log2, uint32_t r, uint32_t p, *dst++ = itoa64[N_log2]; dst = encode64_uint32(dst, buflen - (dst - buf), r, 30); - if (!dst) { /* Can't happen LCOV_EXCL_LINE */ - return NULL; + if (!dst) { + return NULL; /* Can't happen LCOV_EXCL_LINE */ } dst = encode64_uint32(dst, buflen - (dst - buf), p, 30); - if (!dst) { /* Can't happen LCOV_EXCL_LINE */ - return NULL; + if (!dst) { + return NULL; /* Can't happen LCOV_EXCL_LINE */ } dst = encode64(dst, buflen - (dst - buf), src, srclen); - if (!dst || dst >= buf + buflen) { /* Can't happen LCOV_EXCL_LINE */ - return NULL; + if (!dst || dst >= buf + buflen) { + return NULL; /* Can't happen LCOV_EXCL_LINE */ } *dst = 0; /* NUL termination */ diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c index d340dd05..15d4a143 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/sse/pwhash_scryptsalsa208sha256_sse.c @@ -365,9 +365,9 @@ escrypt_kdf_sse(escrypt_local_t * local, } if (local->size < need) { if (free_region(local)) - return -1; + return -1; /* LCOV_EXCL_LINE */ if (!alloc_region(local, need)) - return -1; + return -1; /* LCOV_EXCL_LINE */ } B = (uint8_t *)local->aligned; V = (uint32_t *)((uint8_t *)B + B_size);