aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2018-07-19 09:23:30 -0400
committerNick Mathewson <nickm@torproject.org>2018-08-21 12:24:08 -0400
commit0812f1cbc2f528f0acb785e2fea416b9f2113c7c (patch)
tree45299e72063c84f909ceb86d05b1a6f8205159c6 /src
parent824009cde52d40c937c23670b71e9c5b28d2e1f3 (diff)
downloadtor-0812f1cbc2f528f0acb785e2fea416b9f2113c7c.tar.gz
tor-0812f1cbc2f528f0acb785e2fea416b9f2113c7c.zip
Use a constant for "65537"
Diffstat (limited to 'src')
-rw-r--r--src/lib/crypt_ops/crypto_rsa.h3
-rw-r--r--src/lib/crypt_ops/crypto_rsa_openssl.c6
2 files changed, 6 insertions, 3 deletions
diff --git a/src/lib/crypt_ops/crypto_rsa.h b/src/lib/crypt_ops/crypto_rsa.h
index 88978bf370..4a5d92c6bb 100644
--- a/src/lib/crypt_ops/crypto_rsa.h
+++ b/src/lib/crypt_ops/crypto_rsa.h
@@ -33,6 +33,9 @@
* including terminating NUL. */
#define FINGERPRINT_LEN 49
+/** Value of 'e' to use in our public keys */
+#define TOR_RSA_EXPONENT 65537
+
/** A public key, or a public/private key-pair. */
typedef struct crypto_pk_t crypto_pk_t;
diff --git a/src/lib/crypt_ops/crypto_rsa_openssl.c b/src/lib/crypt_ops/crypto_rsa_openssl.c
index 20be34cbd5..d1b56c3b62 100644
--- a/src/lib/crypt_ops/crypto_rsa_openssl.c
+++ b/src/lib/crypt_ops/crypto_rsa_openssl.c
@@ -158,7 +158,7 @@ crypto_pk_generate_key_with_bits,(crypto_pk_t *env, int bits))
RSA *r = NULL;
if (!e)
goto done;
- if (! BN_set_word(e, 65537))
+ if (! BN_set_word(e, TOR_RSA_EXPONENT))
goto done;
r = RSA_new();
if (!r)
@@ -408,7 +408,7 @@ crypto_pk_check_key(crypto_pk_t *env)
}
/** Return true iff <b>env</b> contains a public key whose public exponent
- * equals 65537.
+ * equals TOR_RSA_EXPONENT.
*/
int
crypto_pk_public_exponent_ok(crypto_pk_t *env)
@@ -424,7 +424,7 @@ crypto_pk_public_exponent_ok(crypto_pk_t *env)
#else
e = env->key->e;
#endif /* defined(OPENSSL_1_1_API) */
- return BN_is_word(e, 65537);
+ return BN_is_word(e, TOR_RSA_EXPONENT);
}
/** Compare the public-key components of a and b. Return less than 0