[tor-commits] [tor/master] Make some additional RSA functions const

nickm at torproject.org nickm at torproject.org
Wed Sep 5 00:47:14 UTC 2018


commit edbb5ef5b258db15459407f8964b83b6dd4c3d22
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Sep 4 09:51:03 2018 -0400

    Make some additional RSA functions const
---
 src/lib/crypt_ops/crypto_rsa.h         | 4 ++--
 src/lib/crypt_ops/crypto_rsa_nss.c     | 4 ++--
 src/lib/crypt_ops/crypto_rsa_openssl.c | 4 ++--
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/lib/crypt_ops/crypto_rsa.h b/src/lib/crypt_ops/crypto_rsa.h
index dd25bc31b..007964b26 100644
--- a/src/lib/crypt_ops/crypto_rsa.h
+++ b/src/lib/crypt_ops/crypto_rsa.h
@@ -64,7 +64,7 @@ int crypto_pk_read_private_key_from_string(crypto_pk_t *env,
 int crypto_pk_write_private_key_to_filename(crypto_pk_t *env,
                                             const char *fname);
 
-int crypto_pk_is_valid_private_key(crypto_pk_t *env);
+int crypto_pk_is_valid_private_key(const crypto_pk_t *env);
 int crypto_pk_cmp_keys(const crypto_pk_t *a, const crypto_pk_t *b);
 int crypto_pk_eq_keys(const crypto_pk_t *a, const crypto_pk_t *b);
 size_t crypto_pk_keysize(const crypto_pk_t *env);
@@ -72,7 +72,7 @@ int crypto_pk_num_bits(crypto_pk_t *env);
 crypto_pk_t *crypto_pk_dup_key(crypto_pk_t *orig);
 crypto_pk_t *crypto_pk_copy_full(crypto_pk_t *orig);
 int crypto_pk_key_is_private(const crypto_pk_t *key);
-int crypto_pk_public_exponent_ok(crypto_pk_t *env);
+int crypto_pk_public_exponent_ok(const crypto_pk_t *env);
 int crypto_pk_obsolete_public_hybrid_encrypt(crypto_pk_t *env, char *to,
                                     size_t tolen,
                                     const char *from, size_t fromlen,
diff --git a/src/lib/crypt_ops/crypto_rsa_nss.c b/src/lib/crypt_ops/crypto_rsa_nss.c
index 90e9c34d3..dc282d7c9 100644
--- a/src/lib/crypt_ops/crypto_rsa_nss.c
+++ b/src/lib/crypt_ops/crypto_rsa_nss.c
@@ -247,7 +247,7 @@ crypto_pk_generate_key_with_bits,(crypto_pk_t *key, int bits))
 /** Return true iff <b>env</b> is a valid private key.
  */
 int
-crypto_pk_is_valid_private_key(crypto_pk_t *key)
+crypto_pk_is_valid_private_key(const crypto_pk_t *key)
 {
   /* We don't need to do validation here, since unlike OpenSSL, NSS won't let
    * us load private keys without validating them. */
@@ -258,7 +258,7 @@ crypto_pk_is_valid_private_key(crypto_pk_t *key)
  * equals 65537.
  */
 int
-crypto_pk_public_exponent_ok(crypto_pk_t *key)
+crypto_pk_public_exponent_ok(const crypto_pk_t *key)
 {
   return key &&
     key->pubkey &&
diff --git a/src/lib/crypt_ops/crypto_rsa_openssl.c b/src/lib/crypt_ops/crypto_rsa_openssl.c
index f203a0683..df81c963e 100644
--- a/src/lib/crypt_ops/crypto_rsa_openssl.c
+++ b/src/lib/crypt_ops/crypto_rsa_openssl.c
@@ -186,7 +186,7 @@ crypto_pk_generate_key_with_bits,(crypto_pk_t *env, int bits))
 /** Return true if <b>env</b> has a valid key; false otherwise.
  */
 int
-crypto_pk_is_valid_private_key(crypto_pk_t *env)
+crypto_pk_is_valid_private_key(const crypto_pk_t *env)
 {
   int r;
   tor_assert(env);
@@ -204,7 +204,7 @@ crypto_pk_is_valid_private_key(crypto_pk_t *env)
  * equals TOR_RSA_EXPONENT.
  */
 int
-crypto_pk_public_exponent_ok(crypto_pk_t *env)
+crypto_pk_public_exponent_ok(const crypto_pk_t *env)
 {
   tor_assert(env);
   tor_assert(env->key);





More information about the tor-commits mailing list