diff options
author | Nick Mathewson <nickm@torproject.org> | 2011-05-16 14:49:55 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2011-05-16 14:49:55 -0400 |
commit | e908e3a332dd469af2facac0846d0dc8349a30d3 (patch) | |
tree | 45195df03a09bc0fde12760ddccc60eaa59e7f72 /src/common | |
parent | 919bf6ff3cfb1387f3f9ecf9ce97d8e95e330a05 (diff) | |
parent | 4a22046c86bec7165e6977024ff84e2109832417 (diff) | |
download | tor-e908e3a332dd469af2facac0846d0dc8349a30d3.tar.gz tor-e908e3a332dd469af2facac0846d0dc8349a30d3.zip |
Merge remote-tracking branch 'origin/maint-0.2.1' into maint-0.2.2
Fixed trivial conflict due to headers moving into their own .h files
from or.h.
Conflicts:
src/or/or.h
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto.c | 12 | ||||
-rw-r--r-- | src/common/crypto.h | 1 |
2 files changed, 13 insertions, 0 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index ff117e929f..1ecc24ce23 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -733,6 +733,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_public_exponent_ok(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. */ diff --git a/src/common/crypto.h b/src/common/crypto.h index 05185f3f18..54c7a67a3b 100644 --- a/src/common/crypto.h +++ b/src/common/crypto.h @@ -122,6 +122,7 @@ size_t crypto_pk_keysize(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); +int crypto_pk_public_exponent_ok(crypto_pk_env_t *env); int crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to, size_t tolen, const char *from, size_t fromlen, int padding); |