summaryrefslogtreecommitdiff
path: root/src/common/crypto_ed25519.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-09-30 23:36:47 -0400
committerNick Mathewson <nickm@torproject.org>2015-05-28 10:40:56 -0400
commitfe5d2477aabbf06c940c33a266d6ebb3a7b19fe1 (patch)
tree6b1ac0df25a95b8c29b44a3ccdd9b9a32a8198d7 /src/common/crypto_ed25519.c
parent818e6f939d4bd241e762970da4c6360858993cd5 (diff)
downloadtor-fe5d2477aabbf06c940c33a266d6ebb3a7b19fe1.tar.gz
tor-fe5d2477aabbf06c940c33a266d6ebb3a7b19fe1.zip
Implement ed25519-signed descriptors
Now that we have ed25519 keys, we can sign descriptors with them and check those signatures as documented in proposal 220.
Diffstat (limited to 'src/common/crypto_ed25519.c')
-rw-r--r--src/common/crypto_ed25519.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c
index 7e8b00abef..6b93751dda 100644
--- a/src/common/crypto_ed25519.c
+++ b/src/common/crypto_ed25519.c
@@ -351,6 +351,7 @@ ed25519_pubkey_read_from_file(ed25519_public_key_t *pubkey_out,
return 0;
}
+/** Release all storage held for <b>kp</b>. */
void
ed25519_keypair_free(ed25519_keypair_t *kp)
{
@@ -361,3 +362,13 @@ ed25519_keypair_free(ed25519_keypair_t *kp)
tor_free(kp);
}
+/** Return true iff <b>key1</b> and <b>key2</b> are the same public key. */
+int
+ed25519_pubkey_eq(const ed25519_public_key_t *key1,
+ const ed25519_public_key_t *key2)
+{
+ tor_assert(key1);
+ tor_assert(key2);
+ return tor_memeq(key1->pubkey, key2->pubkey, ED25519_PUBKEY_LEN);
+}
+