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

[tor-commits] [tor/master] Helper function to see if an ed25519 pk is set.



commit 431565e0531eb6cfdaabd2bba8912655898f079b
Author: Nick Mathewson <nickm@xxxxxxxxxxxxxx>
Date:   Wed Sep 14 14:27:44 2016 -0400

    Helper function to see if an ed25519 pk is set.
---
 src/common/crypto_ed25519.c | 8 ++++++++
 src/common/crypto_ed25519.h | 3 +++
 2 files changed, 11 insertions(+)

diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c
index 30ed772..809ad12 100644
--- a/src/common/crypto_ed25519.c
+++ b/src/common/crypto_ed25519.c
@@ -211,6 +211,14 @@ ed25519_keypair_generate(ed25519_keypair_t *keypair_out, int extra_strong)
   return 0;
 }
 
+/** Return true iff 'pubkey' is set to zero (eg to indicate that it is not
+ * set). */
+int
+ed25519_public_key_is_zero(const ed25519_public_key_t *pubkey)
+{
+  return tor_mem_is_zero((char*)pubkey->pubkey, ED25519_PUBKEY_LEN);
+}
+
 /* Return a heap-allocated array that contains <b>msg</b> prefixed by the
  * string <b>prefix_str</b>. Set <b>final_msg_len_out</b> to the size of the
  * final array. If an error occured, return NULL. It's the resonsibility of the
diff --git a/src/common/crypto_ed25519.h b/src/common/crypto_ed25519.h
index 31afc49..5d63d90 100644
--- a/src/common/crypto_ed25519.h
+++ b/src/common/crypto_ed25519.h
@@ -66,6 +66,9 @@ ed25519_checksig_prefixed(const ed25519_signature_t *signature,
                           const char *prefix_str,
                           const ed25519_public_key_t *pubkey);
 
+int ed25519_public_key_is_zero(const ed25519_public_key_t *pubkey);
+
+
 /**
  * A collection of information necessary to check an Ed25519 signature. Used
  * for batch verification.



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