summaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
authorRobert Ransom <rransom.8774@gmail.com>2011-04-28 12:13:03 -0700
committerNick Mathewson <nickm@torproject.org>2011-05-16 14:07:34 -0400
commitd2629f78a000486f8f994ba0ab75ceeaee67fc55 (patch)
treee2955351bcc286dee7313b6279bf527a11c773d3 /src/common/crypto.c
parent7571e9f1cb81927c5bd47190409a30c7f23ea4a1 (diff)
downloadtor-d2629f78a000486f8f994ba0ab75ceeaee67fc55.tar.gz
tor-d2629f78a000486f8f994ba0ab75ceeaee67fc55.zip
Add crypto_pk_check_key_public_exponent function
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index f3268fe183..6761fd71f3 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -656,6 +656,18 @@ crypto_pk_key_is_private(const crypto_pk_env_t *key)
return PRIVATE_KEY_OK(key);
}
+/** Return true iff <b>env</b> contains a public key whose public exponent
+ * equals 65537.
+ */
+int
+crypto_pk_check_key_public_exponent(crypto_pk_env_t *env)
+{
+ tor_assert(env);
+ tor_assert(env->key);
+
+ return BN_is_word(env->key->e, 65537);
+}
+
/** Compare the public-key components of a and b. Return -1 if a\<b, 0
* if a==b, and 1 if a\>b.
*/