mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Add LCOV markers
This commit is contained in:
@@ -115,7 +115,7 @@ crypto_aead_aegis128l_encrypt_detached(unsigned char *c, unsigned char *mac,
|
||||
}
|
||||
if (mlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX ||
|
||||
adlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->encrypt_detached(c, mac, maclen, m, (size_t) mlen, ad, (size_t) adlen,
|
||||
npub, k);
|
||||
@@ -133,7 +133,7 @@ crypto_aead_aegis128l_decrypt_detached(unsigned char *m, unsigned char *nsec,
|
||||
(void) nsec;
|
||||
if (clen > crypto_aead_aegis128l_MESSAGEBYTES_MAX ||
|
||||
adlen > crypto_aead_aegis128l_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->decrypt_detached(m, c, (size_t) clen, mac, maclen, ad, (size_t) adlen,
|
||||
npub, k);
|
||||
|
||||
@@ -58,8 +58,8 @@ aegis128l_mac(uint8_t *mac, size_t maclen, uint64_t adlen, uint64_t mlen, aes_bl
|
||||
tmp = AES_BLOCK_XOR(tmp, AES_BLOCK_XOR(state[5], state[4]));
|
||||
AES_BLOCK_STORE(mac + 16, tmp);
|
||||
} else {
|
||||
memset(mac, 0, maclen);
|
||||
return -1;
|
||||
memset(mac, 0, maclen); /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@ crypto_aead_aegis256_encrypt_detached(unsigned char *c, unsigned char *mac,
|
||||
}
|
||||
if (mlen > crypto_aead_aegis256_MESSAGEBYTES_MAX ||
|
||||
adlen > crypto_aead_aegis256_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->encrypt_detached(c, mac, maclen, m, (size_t) mlen, ad, (size_t) adlen,
|
||||
npub, k);
|
||||
@@ -132,7 +132,7 @@ crypto_aead_aegis256_decrypt_detached(unsigned char *m, unsigned char *nsec, con
|
||||
(void) nsec;
|
||||
if (clen > crypto_aead_aegis256_MESSAGEBYTES_MAX ||
|
||||
adlen > crypto_aead_aegis256_MESSAGEBYTES_MAX) {
|
||||
return -1;
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->decrypt_detached(m, c, (size_t) clen, mac, maclen, ad, (size_t) adlen,
|
||||
npub, k);
|
||||
|
||||
@@ -58,8 +58,8 @@ aegis256_mac(uint8_t *mac, size_t maclen, uint64_t adlen, uint64_t mlen, aes_blo
|
||||
tmp = AES_BLOCK_XOR(AES_BLOCK_XOR(state[5], state[4]), state[3]);
|
||||
AES_BLOCK_STORE(mac + 16, tmp);
|
||||
} else {
|
||||
memset(mac, 0, maclen);
|
||||
return -1;
|
||||
memset(mac, 0, maclen); /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ crypto_aead_chacha20poly1305_encrypt(unsigned char *c,
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_aead_chacha20poly1305_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
ret = crypto_aead_chacha20poly1305_encrypt_detached(c,
|
||||
c + mlen, NULL,
|
||||
@@ -147,7 +147,7 @@ crypto_aead_chacha20poly1305_ietf_encrypt(unsigned char *c,
|
||||
int ret;
|
||||
|
||||
if (mlen > crypto_aead_chacha20poly1305_ietf_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
ret = crypto_aead_chacha20poly1305_ietf_encrypt_detached(c,
|
||||
c + mlen, NULL,
|
||||
|
||||
@@ -42,7 +42,7 @@ crypto_box_easy_afternm(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_box_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_box_detached_afternm(c + crypto_box_MACBYTES, c, m, mlen, n,
|
||||
k);
|
||||
@@ -54,7 +54,7 @@ crypto_box_easy(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *pk, const unsigned char *sk)
|
||||
{
|
||||
if (mlen > crypto_box_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_box_detached(c + crypto_box_MACBYTES, c, m, mlen, n,
|
||||
pk, sk);
|
||||
|
||||
@@ -87,6 +87,7 @@ _string_to_points(unsigned char * const px, const size_t n,
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
int
|
||||
crypto_core_ed25519_from_string_nu(unsigned char p[crypto_core_ed25519_BYTES],
|
||||
const unsigned char *ctx, size_t ctx_len,
|
||||
@@ -109,6 +110,7 @@ crypto_core_ed25519_from_string(unsigned char p[crypto_core_ed25519_BYTES],
|
||||
}
|
||||
return crypto_core_ed25519_add(p, &px[0], &px[crypto_core_ed25519_BYTES]);
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
void
|
||||
crypto_core_ed25519_random(unsigned char *p)
|
||||
|
||||
@@ -2732,6 +2732,7 @@ fe25519_reduce64(fe25519 fe_f, const unsigned char h[64])
|
||||
fe25519_reduce(fe_f, fe_f);
|
||||
}
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
void
|
||||
ge25519_from_hash(unsigned char s[32], const unsigned char h[64])
|
||||
{
|
||||
@@ -2755,6 +2756,7 @@ ge25519_from_hash(unsigned char s[32], const unsigned char h[64])
|
||||
ge25519_clear_cofactor(&p3);
|
||||
ge25519_p3_tobytes(s, &p3);
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
/* Ristretto group */
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ blake2b_init(blake2b_state *S, const uint8_t outlen)
|
||||
blake2b_param P[1];
|
||||
|
||||
if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = 0;
|
||||
@@ -151,7 +151,7 @@ blake2b_init_salt_personal(blake2b_state *S, const uint8_t outlen,
|
||||
blake2b_param P[1];
|
||||
|
||||
if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = 0;
|
||||
@@ -182,10 +182,10 @@ blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
|
||||
blake2b_param P[1];
|
||||
|
||||
if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse(); /* does not return */
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
@@ -200,7 +200,7 @@ blake2b_init_key(blake2b_state *S, const uint8_t outlen, const void *key,
|
||||
memset(P->personal, 0, sizeof(P->personal));
|
||||
|
||||
if (blake2b_init_param(S, P) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
{
|
||||
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||
@@ -220,10 +220,10 @@ blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
|
||||
blake2b_param P[1];
|
||||
|
||||
if ((!outlen) || (outlen > BLAKE2B_OUTBYTES)) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (!key || !keylen || keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse(); /* does not return */
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
P->digest_length = outlen;
|
||||
P->key_length = keylen;
|
||||
@@ -246,7 +246,7 @@ blake2b_init_key_salt_personal(blake2b_state *S, const uint8_t outlen,
|
||||
}
|
||||
|
||||
if (blake2b_init_param(S, P) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
{
|
||||
uint8_t block[BLAKE2B_BLOCKBYTES];
|
||||
@@ -294,7 +294,7 @@ blake2b_final(blake2b_state *S, uint8_t *out, uint8_t outlen)
|
||||
unsigned char buffer[BLAKE2B_OUTBYTES];
|
||||
|
||||
if (!outlen || outlen > BLAKE2B_OUTBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (blake2b_is_lastblock(S)) {
|
||||
return -1;
|
||||
@@ -339,27 +339,27 @@ blake2b(uint8_t *out, const void *in, const void *key, const uint8_t outlen,
|
||||
|
||||
/* Verify parameters */
|
||||
if (NULL == in && inlen > 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (NULL == out) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (!outlen || outlen > BLAKE2B_OUTBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (NULL == key && keylen > 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (keylen > 0) {
|
||||
if (blake2b_init_key(S, outlen, key, keylen) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
} else {
|
||||
if (blake2b_init(S, outlen) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -377,28 +377,28 @@ blake2b_salt_personal(uint8_t *out, const void *in, const void *key,
|
||||
|
||||
/* Verify parameters */
|
||||
if (NULL == in && inlen > 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (NULL == out) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (!outlen || outlen > BLAKE2B_OUTBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (NULL == key && keylen > 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (keylen > BLAKE2B_KEYBYTES) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (keylen > 0) {
|
||||
if (blake2b_init_key_salt_personal(S, outlen, key, keylen, salt,
|
||||
personal) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
} else {
|
||||
if (blake2b_init_salt_personal(S, outlen, salt, personal) < 0) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,16 +51,16 @@ decode_decimal(const char *str, unsigned long *v)
|
||||
}
|
||||
c -= '0';
|
||||
if (acc > (ULONG_MAX / 10)) {
|
||||
return NULL;
|
||||
return NULL; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
acc *= 10;
|
||||
if ((unsigned long) c > (ULONG_MAX - acc)) {
|
||||
return NULL;
|
||||
return NULL; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
acc += (unsigned long) c;
|
||||
}
|
||||
if (str == orig || (*orig == '0' && str != (orig + 1))) {
|
||||
return NULL;
|
||||
return NULL; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
*v = acc;
|
||||
return str;
|
||||
@@ -279,11 +279,11 @@ argon2_encode_string(char *dst, size_t dst_len, argon2_context *ctx,
|
||||
case Argon2_i:
|
||||
SS("$argon2i$v="); break;
|
||||
default:
|
||||
return ARGON2_ENCODING_FAIL;
|
||||
return ARGON2_ENCODING_FAIL; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
validation_result = argon2_validate_inputs(ctx);
|
||||
if (validation_result != ARGON2_OK) {
|
||||
return validation_result;
|
||||
return validation_result; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
SX(ARGON2_VERSION_NUMBER);
|
||||
SS("$m=");
|
||||
|
||||
@@ -34,11 +34,11 @@ argon2_ctx(argon2_context *context, argon2_type type)
|
||||
argon2_instance_t instance;
|
||||
|
||||
if (ARGON2_OK != result) {
|
||||
return result;
|
||||
return result; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
if (type != Argon2_id && type != Argon2_i) {
|
||||
return ARGON2_INCORRECT_TYPE;
|
||||
return ARGON2_INCORRECT_TYPE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
/* 2. Align memory size */
|
||||
@@ -69,7 +69,7 @@ argon2_ctx(argon2_context *context, argon2_type type)
|
||||
result = argon2_initialize(&instance, context);
|
||||
|
||||
if (ARGON2_OK != result) {
|
||||
return result;
|
||||
return result; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
/* 4. Filling memory */
|
||||
@@ -99,20 +99,20 @@ argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
|
||||
}
|
||||
|
||||
if (pwdlen > ARGON2_MAX_PWD_LENGTH) {
|
||||
return ARGON2_PWD_TOO_LONG;
|
||||
return ARGON2_PWD_TOO_LONG; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
if (hashlen > ARGON2_MAX_OUTLEN) {
|
||||
return ARGON2_OUTPUT_TOO_LONG;
|
||||
return ARGON2_OUTPUT_TOO_LONG; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
if (saltlen > ARGON2_MAX_SALT_LENGTH) {
|
||||
return ARGON2_SALT_TOO_LONG;
|
||||
return ARGON2_SALT_TOO_LONG; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
out = (uint8_t *) malloc(hashlen);
|
||||
if (!out) {
|
||||
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
||||
return ARGON2_MEMORY_ALLOCATION_ERROR; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
context.out = (uint8_t *) out;
|
||||
@@ -133,20 +133,24 @@ argon2_hash(const uint32_t t_cost, const uint32_t m_cost,
|
||||
|
||||
result = argon2_ctx(&context, type);
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
if (result != ARGON2_OK) {
|
||||
sodium_memzero(out, hashlen);
|
||||
free(out);
|
||||
return result;
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
/* if encoding requested, write it */
|
||||
if (encoded && encodedlen) {
|
||||
if (argon2_encode_string(encoded, encodedlen,
|
||||
&context, type) != ARGON2_OK) {
|
||||
/* LCOV_EXCL_START */
|
||||
sodium_memzero(out, hashlen);
|
||||
sodium_memzero(encoded, encodedlen);
|
||||
free(out);
|
||||
return ARGON2_ENCODING_FAIL;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
}
|
||||
|
||||
@@ -223,7 +227,7 @@ argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen,
|
||||
/* max values, to be updated in argon2_decode_string */
|
||||
encoded_len = strlen(encoded);
|
||||
if (encoded_len > UINT32_MAX) {
|
||||
return ARGON2_DECODING_LENGTH_FAIL;
|
||||
return ARGON2_DECODING_LENGTH_FAIL; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
ctx.adlen = (uint32_t) encoded_len;
|
||||
ctx.saltlen = (uint32_t) encoded_len;
|
||||
@@ -232,18 +236,22 @@ argon2_verify(const char *encoded, const void *pwd, const size_t pwdlen,
|
||||
ctx.ad = (uint8_t *) malloc(ctx.adlen);
|
||||
ctx.salt = (uint8_t *) malloc(ctx.saltlen);
|
||||
ctx.out = (uint8_t *) malloc(ctx.outlen);
|
||||
/* LCOV_EXCL_START */
|
||||
if (!ctx.out || !ctx.salt || !ctx.ad) {
|
||||
free(ctx.ad);
|
||||
free(ctx.salt);
|
||||
free(ctx.out);
|
||||
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
out = (uint8_t *) malloc(ctx.outlen);
|
||||
if (!out) {
|
||||
/* LCOV_EXCL_START */
|
||||
free(ctx.ad);
|
||||
free(ctx.salt);
|
||||
free(ctx.out);
|
||||
return ARGON2_MEMORY_ALLOCATION_ERROR;
|
||||
/* LCOV_EXCL_STOP */
|
||||
}
|
||||
|
||||
decode_result = argon2_decode_string(&ctx, encoded, type);
|
||||
|
||||
@@ -144,8 +144,8 @@ crypto_pwhash_argon2i(unsigned char *const out, unsigned long long outlen,
|
||||
{
|
||||
memset(out, 0, outlen);
|
||||
if (outlen > crypto_pwhash_argon2i_BYTES_MAX) {
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
errno = EFBIG; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (outlen < crypto_pwhash_argon2i_BYTES_MIN) {
|
||||
errno = EINVAL;
|
||||
@@ -164,8 +164,8 @@ crypto_pwhash_argon2i(unsigned char *const out, unsigned long long outlen,
|
||||
return -1;
|
||||
}
|
||||
if ((const void *) out == (const void *) passwd) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
switch (alg) {
|
||||
case crypto_pwhash_argon2i_ALG_ARGON2I13:
|
||||
|
||||
@@ -140,8 +140,8 @@ crypto_pwhash_argon2id(unsigned char *const out, unsigned long long outlen,
|
||||
{
|
||||
memset(out, 0, outlen);
|
||||
if (outlen > crypto_pwhash_argon2id_BYTES_MAX) {
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
errno = EFBIG; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (outlen < crypto_pwhash_argon2id_BYTES_MIN) {
|
||||
errno = EINVAL;
|
||||
@@ -160,8 +160,8 @@ crypto_pwhash_argon2id(unsigned char *const out, unsigned long long outlen,
|
||||
return -1;
|
||||
}
|
||||
if ((const void *) out == (const void *) passwd) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
switch (alg) {
|
||||
case crypto_pwhash_argon2id_ALG_ARGON2ID13:
|
||||
@@ -217,8 +217,8 @@ crypto_pwhash_argon2id_str_verify(const char * str,
|
||||
int verify_ret;
|
||||
|
||||
if (passwdlen > crypto_pwhash_argon2id_PASSWD_MAX) {
|
||||
errno = EFBIG;
|
||||
return -1;
|
||||
errno = EFBIG; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
/* LCOV_EXCL_START */
|
||||
if (passwdlen < crypto_pwhash_argon2id_PASSWD_MIN) {
|
||||
|
||||
@@ -178,8 +178,8 @@ crypto_pwhash_scryptsalsa208sha256(unsigned char *const out,
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if ((const void *) out == (const void *) passwd) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_pwhash_scryptsalsa208sha256_ll(
|
||||
(const uint8_t *) passwd, (size_t) passwdlen, (const uint8_t *) salt,
|
||||
@@ -281,8 +281,8 @@ crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(
|
||||
uint32_t r, r_;
|
||||
|
||||
if (pickparams(opslimit, memlimit, &N_log2, &p, &r) != 0) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (sodium_strnlen(str, crypto_pwhash_scryptsalsa208sha256_STRBYTES) !=
|
||||
crypto_pwhash_scryptsalsa208sha256_STRBYTES - 1U) {
|
||||
@@ -291,8 +291,8 @@ crypto_pwhash_scryptsalsa208sha256_str_needs_rehash(
|
||||
}
|
||||
if (escrypt_parse_setting((const uint8_t *) str,
|
||||
&N_log2_, &r_, &p_) == NULL) {
|
||||
errno = EINVAL;
|
||||
return -1;
|
||||
errno = EINVAL; /* LCOV_EXCL_LINE */
|
||||
return -1; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
if (N_log2 != N_log2_ || r != r_ || p != p_) {
|
||||
return 1;
|
||||
|
||||
@@ -56,7 +56,7 @@ crypto_stream_chacha20(unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *n, const unsigned char *k)
|
||||
{
|
||||
if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream(c, clen, n, k);
|
||||
}
|
||||
@@ -68,7 +68,7 @@ crypto_stream_chacha20_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream_xor_ic(c, m, mlen, n, ic, k);
|
||||
}
|
||||
@@ -79,7 +79,7 @@ crypto_stream_chacha20_xor(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream_xor_ic(c, m, mlen, n, 0U, k);
|
||||
}
|
||||
@@ -89,7 +89,7 @@ crypto_stream_chacha20_ietf_ext(unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *n, const unsigned char *k)
|
||||
{
|
||||
if (clen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream_ietf_ext(c, clen, n, k);
|
||||
}
|
||||
@@ -101,7 +101,7 @@ crypto_stream_chacha20_ietf_ext_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
|
||||
}
|
||||
@@ -112,7 +112,7 @@ crypto_stream_chacha20_ietf_ext_xor(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_stream_chacha20_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return implementation->stream_ietf_ext_xor_ic(c, m, mlen, n, 0U, k);
|
||||
}
|
||||
@@ -122,7 +122,7 @@ crypto_stream_chacha20_ietf(unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *n, const unsigned char *k)
|
||||
{
|
||||
if (clen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_stream_chacha20_ietf_ext(c, clen, n, k);
|
||||
}
|
||||
@@ -135,7 +135,7 @@ crypto_stream_chacha20_ietf_xor_ic(unsigned char *c, const unsigned char *m,
|
||||
{
|
||||
if ((unsigned long long) ic >
|
||||
(64ULL * (1ULL << 32)) / 64ULL - (mlen + 63ULL) / 64ULL) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_stream_chacha20_ietf_ext_xor_ic(c, m, mlen, n, ic, k);
|
||||
}
|
||||
@@ -146,7 +146,7 @@ crypto_stream_chacha20_ietf_xor(unsigned char *c, const unsigned char *m,
|
||||
const unsigned char *k)
|
||||
{
|
||||
if (mlen > crypto_stream_chacha20_ietf_MESSAGEBYTES_MAX) {
|
||||
sodium_misuse();
|
||||
sodium_misuse(); /* LCOV_EXCL_LINE */
|
||||
}
|
||||
return crypto_stream_chacha20_ietf_ext_xor(c, m, mlen, n, k);
|
||||
}
|
||||
|
||||
@@ -10,6 +10,8 @@ Public domain.
|
||||
#include "crypto_stream_salsa208.h"
|
||||
#include "utils.h"
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
|
||||
int
|
||||
crypto_stream_salsa208(unsigned char *c, unsigned long long clen,
|
||||
const unsigned char *n, const unsigned char *k)
|
||||
@@ -104,3 +106,5 @@ crypto_stream_salsa208_xor(unsigned char *c, const unsigned char *m,
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#include "crypto_stream_salsa208.h"
|
||||
#include "randombytes.h"
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
|
||||
size_t
|
||||
crypto_stream_salsa208_keybytes(void)
|
||||
{
|
||||
@@ -24,3 +26,5 @@ crypto_stream_salsa208_keygen(unsigned char k[crypto_stream_salsa208_KEYBYTES])
|
||||
{
|
||||
randombytes_buf(k, crypto_stream_salsa208_KEYBYTES);
|
||||
}
|
||||
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
@@ -506,6 +506,7 @@ _mprotect_readwrite(void *ptr, size_t size)
|
||||
|
||||
#ifdef HAVE_ALIGNED_MALLOC
|
||||
|
||||
/* LCOV_EXCL_START */
|
||||
__attribute__((noreturn)) static void
|
||||
_out_of_bounds(void)
|
||||
{
|
||||
@@ -519,7 +520,8 @@ _out_of_bounds(void)
|
||||
# endif
|
||||
# endif
|
||||
abort(); /* not something we want any higher-level API to catch */
|
||||
} /* LCOV_EXCL_LINE */
|
||||
}
|
||||
/* LCOV_EXCL_STOP */
|
||||
|
||||
static inline size_t
|
||||
_page_round(const size_t size)
|
||||
|
||||
Reference in New Issue
Block a user