[tor-commits] [tor/master] Remove unused check_fingerprint_syntax

nickm at torproject.org nickm at torproject.org
Sat Mar 2 03:01:31 UTC 2013


commit 55ce9bff549c4709ec14486633a4a024a288b59a
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Mar 1 22:01:26 2013 -0500

    Remove unused check_fingerprint_syntax
---
 src/common/crypto.c    |   17 -----------------
 src/common/crypto.h    |    1 -
 src/test/test_crypto.c |   16 ----------------
 3 files changed, 0 insertions(+), 34 deletions(-)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index 8d37400..2f9f3ad 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -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>.
diff --git a/src/common/crypto.h b/src/common/crypto.h
index 1976549..ee356c6 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -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);
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 1f12c87..645fc9f 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -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);



More information about the tor-commits mailing list