[tor-commits] [tor/master] Fix a couple of clang warnings

nickm at torproject.org nickm at torproject.org
Fri Jul 7 15:32:18 UTC 2017


commit c7d2a67274549e71381f87c2fd3e8adad1c1abc9
Author: Nick Mathewson <nickm at torproject.org>
Date:   Fri Jul 7 11:32:15 2017 -0400

    Fix a couple of clang warnings
---
 src/or/circuitbuild.c     | 5 +++--
 src/test/test_hs_client.c | 2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/or/circuitbuild.c b/src/or/circuitbuild.c
index 3a8da2a..257edab 100644
--- a/src/or/circuitbuild.c
+++ b/src/or/circuitbuild.c
@@ -1426,12 +1426,13 @@ circuit_init_cpath_crypto(crypt_path_t *cpath,
 
   tor_assert(digest_len != 0);
   tor_assert(cipher_key_len != 0);
+  const int cipher_key_bits = (int) cipher_key_len * 8;
 
   crypto_digest_add_bytes(cpath->f_digest, key_data, digest_len);
   crypto_digest_add_bytes(cpath->b_digest, key_data+digest_len, digest_len);
 
   cpath->f_crypto = crypto_cipher_new_with_bits(key_data+(2*digest_len),
-                                                cipher_key_len*8);
+                                                cipher_key_bits);
   if (!cpath->f_crypto) {
     log_warn(LD_BUG,"Forward cipher initialization failed.");
     return -1;
@@ -1439,7 +1440,7 @@ circuit_init_cpath_crypto(crypt_path_t *cpath,
 
   cpath->b_crypto = crypto_cipher_new_with_bits(
                                         key_data+(2*digest_len)+cipher_key_len,
-                                        cipher_key_len*8);
+                                        cipher_key_bits);
   if (!cpath->b_crypto) {
     log_warn(LD_BUG,"Backward cipher initialization failed.");
     return -1;
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 77fee88..6281825 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -130,7 +130,7 @@ helper_get_circ_and_stream_for_test(origin_circuit_t **circ_out,
 static void
 test_e2e_rend_circuit_setup_legacy(void *arg)
 {
-  int retval;
+  ssize_t retval;
   origin_circuit_t *or_circ = NULL;
   connection_t *conn = NULL;
 



More information about the tor-commits mailing list