aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/crypto.c')
-rw-r--r--src/common/crypto.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c
index 684ede06a..424a6f417 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -777,6 +777,17 @@ crypto_pk_keysize(crypto_pk_env_t *env)
return (size_t) RSA_size(env->key);
}
+/** Return the size of the public key modulus of <b>env</b>, in bits. */
+int
+crypto_pk_num_bits(crypto_pk_env_t *env)
+{
+ tor_assert(env);
+ tor_assert(env->key);
+ tor_assert(env->key->n);
+
+ return BN_num_bits(env->key->n);
+}
+
/** Increase the reference count of <b>env</b>, and return it.
*/
crypto_pk_env_t *