[tor-commits] [tor/master] changing output of crypto_cipher_crypt_inplace from int to void

nickm at torproject.org nickm at torproject.org
Sat Feb 6 17:33:49 UTC 2016


commit edd93f9de8aedec41afc7f6472ab381bc34d0246
Author: Hassan Alsibyani <sibyani at mit.edu>
Date:   Sat Feb 6 12:14:39 2016 -0500

    changing output of crypto_cipher_crypt_inplace from int to void
---
 src/common/crypto.c | 5 ++---
 src/common/crypto.h | 2 +-
 src/or/relay.c      | 9 ++-------
 3 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/src/common/crypto.c b/src/common/crypto.c
index bc659b1..c59dd52 100644
--- a/src/common/crypto.c
+++ b/src/common/crypto.c
@@ -1531,14 +1531,13 @@ crypto_cipher_decrypt(crypto_cipher_t *env, char *to,
 }
 
 /** Encrypt <b>len</b> bytes on <b>from</b> using the cipher in <b>env</b>;
- * on success, return 0. Does not check for failure.
+ * on success. Does not check for failure.
  */
-int
+void
 crypto_cipher_crypt_inplace(crypto_cipher_t *env, char *buf, size_t len)
 {
   tor_assert(len < SIZE_T_CEILING);
   aes_crypt_inplace(env->cipher, buf, len);
-  return 0;
 }
 
 /** Encrypt <b>fromlen</b> bytes (at least 1) from <b>from</b> with the key in
diff --git a/src/common/crypto.h b/src/common/crypto.h
index fa2ed61..74b88bc 100644
--- a/src/common/crypto.h
+++ b/src/common/crypto.h
@@ -205,7 +205,7 @@ int crypto_cipher_encrypt(crypto_cipher_t *env, char *to,
                           const char *from, size_t fromlen);
 int crypto_cipher_decrypt(crypto_cipher_t *env, char *to,
                           const char *from, size_t fromlen);
-int crypto_cipher_crypt_inplace(crypto_cipher_t *env, char *d, size_t len);
+void crypto_cipher_crypt_inplace(crypto_cipher_t *env, char *d, size_t len);
 
 int crypto_cipher_encrypt_with_iv(const char *key,
                                   char *to, size_t tolen,
diff --git a/src/or/relay.c b/src/or/relay.c
index aea51a1..9d44428 100644
--- a/src/or/relay.c
+++ b/src/or/relay.c
@@ -148,20 +148,15 @@ relay_digest_matches(crypto_digest_t *digest, cell_t *cell)
  *
  * If <b>encrypt_mode</b> is 1 then encrypt, else decrypt.
  *
- * Return -1 if the crypto fails, else return 0.
+ * Returns 0.
  */
 static int
 relay_crypt_one_payload(crypto_cipher_t *cipher, uint8_t *in,
                         int encrypt_mode)
 {
-  int r;
   (void)encrypt_mode;
-  r = crypto_cipher_crypt_inplace(cipher, (char*) in, CELL_PAYLOAD_SIZE);
+  crypto_cipher_crypt_inplace(cipher, (char*) in, CELL_PAYLOAD_SIZE);
 
-  if (r) {
-    log_warn(LD_BUG,"Error during relay encryption");
-    return -1;
-  }
   return 0;
 }
 



More information about the tor-commits mailing list