aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto_s2k.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-04-12 21:13:33 -0400
committerNick Mathewson <nickm@torproject.org>2016-04-12 21:13:33 -0400
commit0630f1982d18aeaf2a497b32ef73c5e1390688ad (patch)
tree9dbcc3f55014be466a46423025e21593356f057a /src/common/crypto_s2k.c
parent4043f2c95f4a47e69edc4d451673b7ffda066768 (diff)
downloadtor-0630f1982d18aeaf2a497b32ef73c5e1390688ad.tar.gz
tor-0630f1982d18aeaf2a497b32ef73c5e1390688ad.zip
Add LCOV_EXCL* markers to crypto.c and crypto_s2k.c
This marks some lines as unreachable by the unit tests, and as therefore excluded from test coverage. (Note: This convention is only for lines that are absolutely unreachable. Don't use it anywhere you wouldn't add a tor_fragile_assert().)
Diffstat (limited to 'src/common/crypto_s2k.c')
-rw-r--r--src/common/crypto_s2k.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/common/crypto_s2k.c b/src/common/crypto_s2k.c
index a9140c7553..149c39344c 100644
--- a/src/common/crypto_s2k.c
+++ b/src/common/crypto_s2k.c
@@ -57,7 +57,8 @@
#define SCRYPT_KEY_LEN 32
/** Given an algorithm ID (one of S2K_TYPE_*), return the length of the
- * specifier part of it, without the prefix type byte. */
+ * specifier part of it, without the prefix type byte. Return -1 if it is not
+ * a valid algorithm ID. */
static int
secret_to_key_spec_len(uint8_t type)
{
@@ -86,7 +87,8 @@ secret_to_key_key_len(uint8_t type)
case S2K_TYPE_SCRYPT:
return DIGEST256_LEN;
default:
- return -1;
+ tor_fragile_assert(); // LCOV_EXCL_LINE
+ return -1; // LCOV_EXCL_LINE
}
}