Remove unused check_fingerprint_syntax

This commit is contained in:
Nick Mathewson 2013-03-01 22:01:26 -05:00
parent a05dc378e3
commit 55ce9bff54
3 changed files with 0 additions and 34 deletions

View File

@ -1294,23 +1294,6 @@ crypto_pk_get_fingerprint(crypto_pk_t *pk, char *fp_out, int add_space)
return 0;
}
/** Return true iff <b>s</b> is in the correct format for a fingerprint.
*/
int
crypto_pk_check_fingerprint_syntax(const char *s)
{
int i;
for (i = 0; i < FINGERPRINT_LEN; ++i) {
if ((i%5) == 4) {
if (!TOR_ISSPACE(s[i])) return 0;
} else {
if (!TOR_ISXDIGIT(s[i])) return 0;
}
}
if (s[FINGERPRINT_LEN]) return 0;
return 1;
}
/* symmetric crypto */
/** Return a pointer to the key set for the cipher in <b>env</b>.

View File

@ -183,7 +183,6 @@ crypto_pk_t *crypto_pk_asn1_decode(const char *str, size_t len);
int crypto_pk_get_digest(crypto_pk_t *pk, char *digest_out);
int crypto_pk_get_all_digests(crypto_pk_t *pk, digests_t *digests_out);
int crypto_pk_get_fingerprint(crypto_pk_t *pk, char *fp_out,int add_space);
int crypto_pk_check_fingerprint_syntax(const char *s);
/* symmetric crypto */
const char *crypto_cipher_get_key(crypto_cipher_t *env);

View File

@ -608,22 +608,6 @@ test_crypto_formats(void)
tor_free(data2);
}
/* Check fingerprint */
{
test_assert(crypto_pk_check_fingerprint_syntax(
"ABCD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 0000"));
test_assert(!crypto_pk_check_fingerprint_syntax(
"ABCD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 000"));
test_assert(!crypto_pk_check_fingerprint_syntax(
"ABCD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 00000"));
test_assert(!crypto_pk_check_fingerprint_syntax(
"ABCD 1234 ABCD 5678 0000 ABCD1234 ABCD 5678 0000"));
test_assert(!crypto_pk_check_fingerprint_syntax(
"ABCD 1234 ABCD 5678 0000 ABCD1234 ABCD 5678 00000"));
test_assert(!crypto_pk_check_fingerprint_syntax(
"ACD 1234 ABCD 5678 0000 ABCD 1234 ABCD 5678 00000"));
}
done:
tor_free(data1);
tor_free(data2);