Coverage exclusions

This commit is contained in:
Frank Denis 2017-07-29 22:07:36 +02:00
parent ff8bb6705a
commit 3dd56fa91b

View File

@ -318,10 +318,12 @@ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
/* Sanity-check parameters. */ /* Sanity-check parameters. */
# if SIZE_MAX > UINT32_MAX # if SIZE_MAX > UINT32_MAX
/* LCOV_EXCL_START */
if (buflen > (((uint64_t)(1) << 32) - 1) * 32) { if (buflen > (((uint64_t)(1) << 32) - 1) * 32) {
errno = EFBIG; errno = EFBIG;
return -1; return -1;
} }
/* LCOV_EXCL_END */
# endif # endif
if ((uint64_t)(r) * (uint64_t)(p) >= ((uint64_t) 1 << 30)) { if ((uint64_t)(r) * (uint64_t)(p) >= ((uint64_t) 1 << 30)) {
errno = EFBIG; errno = EFBIG;
@ -339,6 +341,7 @@ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
errno = EINVAL; errno = EINVAL;
return -1; return -1;
} }
/* LCOV_EXCL_START */
if ((r > SIZE_MAX / 128 / p) || if ((r > SIZE_MAX / 128 / p) ||
# if SIZE_MAX / 256 <= UINT32_MAX # if SIZE_MAX / 256 <= UINT32_MAX
(r > SIZE_MAX / 256) || (r > SIZE_MAX / 256) ||
@ -347,21 +350,26 @@ escrypt_kdf_sse(escrypt_local_t *local, const uint8_t *passwd, size_t passwdlen,
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
/* LCOV_EXCL_END */
/* Allocate memory. */ /* Allocate memory. */
B_size = (size_t) 128 * r * p; B_size = (size_t) 128 * r * p;
V_size = (size_t) 128 * r * N; V_size = (size_t) 128 * r * N;
need = B_size + V_size; need = B_size + V_size;
/* LCOV_EXCL_START */
if (need < V_size) { if (need < V_size) {
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
/* LCOV_EXCL_END */
XY_size = (size_t) 256 * r + 64; XY_size = (size_t) 256 * r + 64;
need += XY_size; need += XY_size;
/* LCOV_EXCL_START */
if (need < XY_size) { if (need < XY_size) {
errno = ENOMEM; errno = ENOMEM;
return -1; return -1;
} }
/* LCOV_EXCL_END */
if (local->size < need) { if (local->size < need) {
if (free_region(local)) { if (free_region(local)) {
return -1; /* LCOV_EXCL_LINE */ return -1; /* LCOV_EXCL_LINE */