diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c index 837ce3fc..3e315d9b 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/crypto_scrypt-common.c @@ -171,7 +171,7 @@ 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 */ + if (!dst || dst >= buf + buflen) { /* Can't happen LCOV_EXCL_LINE */ return NULL; } *dst = 0; /* NUL termination */ @@ -205,15 +205,15 @@ 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 */ + if (!dst) { /* Can't happen LCOV_EXCL_LINE */ return NULL; } dst = encode64_uint32(dst, buflen - (dst - buf), p, 30); - if (!dst) { /* Can't happen */ + if (!dst) { /* Can't happen LCOV_EXCL_LINE */ return NULL; } dst = encode64(dst, buflen - (dst - buf), src, srclen); - if (!dst || dst >= buf + buflen) { /* Can't happen */ + if (!dst || dst >= buf + buflen) { /* Can't happen LCOV_EXCL_LINE */ return NULL; } *dst = 0; /* NUL termination */ diff --git a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c index 50b0b0ff..aacc3b3d 100644 --- a/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c +++ b/src/libsodium/crypto_pwhash/scryptsalsa208sha256/pwhash_scryptsalsa208sha256.c @@ -106,8 +106,8 @@ crypto_pwhash_scryptsalsa208sha256(unsigned char * const out, memset(out, 0, outlen); if (passwdlen > SIZE_MAX || outlen > SIZE_MAX) { - errno = EFBIG; - return -1; + errno = EFBIG; /* LCOV_EXCL_LINE */ + return -1; /* LCOV_EXCL_LINE */ } if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) { errno = EINVAL; @@ -137,8 +137,8 @@ crypto_pwhash_scryptsalsa208sha256_str(char out[crypto_pwhash_scryptsalsa208sha2 memset(out, 0, crypto_pwhash_scryptsalsa208sha256_STRBYTES); if (passwdlen > SIZE_MAX) { - errno = EFBIG; - return -1; + errno = EFBIG; /* LCOV_EXCL_LINE */ + return -1; /* LCOV_EXCL_LINE */ } if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) { errno = EINVAL; diff --git a/test/default/pwhash.c b/test/default/pwhash.c index 29357f09..a29cb01e 100644 --- a/test/default/pwhash.c +++ b/test/default/pwhash.c @@ -212,5 +212,14 @@ int main(void) } printf("OK\n"); + assert(crypto_pwhash_scryptsalsa208sha256_saltbytes() > 0U); + assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > 1U); + assert(crypto_pwhash_scryptsalsa208sha256_strbytes() > + strlen(crypto_pwhash_scryptsalsa208sha256_strprefix())); + assert(crypto_pwhash_scryptsalsa208sha256_opslimit_interactive() > 0U); + assert(crypto_pwhash_scryptsalsa208sha256_memlimit_interactive() > 0U); + assert(crypto_pwhash_scryptsalsa208sha256_opslimit_sensitive() > 0U); + assert(crypto_pwhash_scryptsalsa208sha256_memlimit_sensitive() > 0U); + return 0; }