[tor-commits] [tor/master] Function to get digests of the certs and their keys

nickm at torproject.org nickm at torproject.org
Tue Oct 11 03:22:15 UTC 2011


commit 8c9fdecfe9e6c93e678a5917e302aa18ada8a3b6
Author: Nick Mathewson <nickm at torproject.org>
Date:   Wed Sep 14 14:43:44 2011 -0400

    Function to get digests of the certs and their keys
---
 src/common/tortls.c |   14 ++++++++++++++
 src/common/tortls.h |    2 ++
 2 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/common/tortls.c b/src/common/tortls.c
index 0ba47ba..1435223 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -789,6 +789,20 @@ tor_cert_get_der(const tor_cert_t *cert,
   *size_out = cert->encoded_len;
 }
 
+/** Return a set of digests for the public key in <b>cert</b>. */
+const digests_t *
+tor_cert_get_id_digests(const tor_cert_t *cert)
+{
+  return &cert->pkey_digests;
+}
+
+/** Return a set of digests for the public key in <b>cert</b>. */
+const digests_t *
+tor_cert_get_cert_digests(const tor_cert_t *cert)
+{
+  return &cert->cert_digests;
+}
+
 /** Remove a reference to <b>ctx</b>, and free it if it has no more
  * references. */
 static void
diff --git a/src/common/tortls.h b/src/common/tortls.h
index 36309af..40eb830 100644
--- a/src/common/tortls.h
+++ b/src/common/tortls.h
@@ -112,6 +112,8 @@ void tor_cert_free(tor_cert_t *cert);
 tor_cert_t *tor_cert_decode(const uint8_t *certificate, size_t certificate_len);
 void tor_cert_get_der(const tor_cert_t *cert,
                       const uint8_t **encoded_out, size_t *size_out);
+const digests_t *tor_cert_get_id_digests(const tor_cert_t *cert);
+const digests_t *tor_cert_get_cert_digests(const tor_cert_t *cert);
 int tor_tls_get_my_certs(int server,
                          const tor_cert_t **link_cert_out,
                          const tor_cert_t **id_cert_out);





More information about the tor-commits mailing list