diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-06-03 11:34:32 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-06-03 11:34:32 -0400 |
commit | 7aa20b20bffcbc4c9b4e3eb1c874616e1cab119f (patch) | |
tree | df99f8fe91e4503ae70aaa178cbf29182916d87e /src/common | |
parent | de069f5ea73a4fe841df27d85c28c0d79ad2c13e (diff) | |
parent | bbf2fee8ff7bbb8f645b7d973cd84bc97e93ae54 (diff) | |
download | tor-7aa20b20bffcbc4c9b4e3eb1c874616e1cab119f.tar.gz tor-7aa20b20bffcbc4c9b4e3eb1c874616e1cab119f.zip |
Merge branch 'bug3318c' into maint-0.2.2
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto.c | 11 | ||||
-rw-r--r-- | src/common/crypto.h | 1 |
2 files changed, 12 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 1ecc24ce23..d8e6619c9f 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 * diff --git a/src/common/crypto.h b/src/common/crypto.h index 54c7a67a3b..1a8c81f837 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -119,6 +119,7 @@ int crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env, int crypto_pk_check_key(crypto_pk_env_t *env); int crypto_pk_cmp_keys(crypto_pk_env_t *a, crypto_pk_env_t *b); size_t crypto_pk_keysize(crypto_pk_env_t *env); +int crypto_pk_num_bits(crypto_pk_env_t *env); crypto_pk_env_t *crypto_pk_dup_key(crypto_pk_env_t *orig); crypto_pk_env_t *crypto_pk_copy_full(crypto_pk_env_t *orig); int crypto_pk_key_is_private(const crypto_pk_env_t *key); |