summaryrefslogtreecommitdiff
path: root/src/common/crypto_ed25519.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-09-14 14:27:44 -0400
committerNick Mathewson <nickm@torproject.org>2016-11-10 09:43:27 -0500
commit431565e0531eb6cfdaabd2bba8912655898f079b (patch)
tree7bf28c19c98ddc2b67e972a879cc930901c9e0b8 /src/common/crypto_ed25519.c
parent0980787f91cfc420f02dead3fea99882ab8c2ada (diff)
downloadtor-431565e0531eb6cfdaabd2bba8912655898f079b.tar.gz
tor-431565e0531eb6cfdaabd2bba8912655898f079b.zip
Helper function to see if an ed25519 pk is set.
Diffstat (limited to 'src/common/crypto_ed25519.c')
-rw-r--r--src/common/crypto_ed25519.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c
index 30ed772274..809ad12478 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