[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor/master] Add a function to check whether a given ed id key is ours



commit af3af494083f041c3ce9f722e4989ecd4b4e6304
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Sat Sep 24 11:25:10 2016 -0700

    Add a function to check whether a given ed id key is ours
---
 src/or/routerkeys.c | 8 ++++++++
 src/or/routerkeys.h | 2 ++
 2 files changed, 10 insertions(+)

diff --git a/src/or/routerkeys.c b/src/or/routerkeys.c
index 8d9a132..ab78dbe 100644
--- a/src/or/routerkeys.c
+++ b/src/or/routerkeys.c
@@ -1091,6 +1091,14 @@ get_master_identity_key(void)
   return &master_identity_key->pubkey;
 }
 
+/** Return true iff <b>id</b> is our Ed25519 master identity key. */
+int
+router_ed25519_id_is_me(const ed25519_public_key_t *id)
+{
+  return id && master_identity_key &&
+    ed25519_pubkey_eq(id, &master_identity_key->pubkey);
+}
+
 #ifdef TOR_UNIT_TESTS
 /* only exists for the unit tests, since otherwise the identity key
  * should be used to sign nothing but the signing key. */
diff --git a/src/or/routerkeys.h b/src/or/routerkeys.h
index 307a1cd..98894cd 100644
--- a/src/or/routerkeys.h
+++ b/src/or/routerkeys.h
@@ -45,6 +45,8 @@ const struct tor_cert_st *get_current_auth_key_cert(void);
 void get_master_rsa_crosscert(const uint8_t **cert_out,
                               size_t *size_out);
 
+int router_ed25519_id_is_me(const ed25519_public_key_t *id);
+
 struct tor_cert_st *make_ntor_onion_key_crosscert(
                                   const curve25519_keypair_t *onion_key,
                                   const ed25519_public_key_t *master_id_key,



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits