diff options
author | Nick Mathewson <nickm@torproject.org> | 2008-02-24 22:11:18 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2008-02-24 22:11:18 +0000 |
commit | 3452486ac65af88cf524cb93041a2a173335da27 (patch) | |
tree | b3b7ec3eceac0e8060fe0da76c2e4bada31be148 /src | |
parent | ee8dce3084261447420f0bb7abeb6807583325ee (diff) | |
download | tor-3452486ac65af88cf524cb93041a2a173335da27.tar.gz tor-3452486ac65af88cf524cb93041a2a173335da27.zip |
r14422@tombo: nickm | 2008-02-24 17:09:56 -0500
Whitespace fixes
svn:r13700
Diffstat (limited to 'src')
-rw-r--r-- | src/common/crypto.c | 8 | ||||
-rw-r--r-- | src/or/connection.c | 5 | ||||
-rw-r--r-- | src/or/dirserv.c | 6 | ||||
-rw-r--r-- | src/or/networkstatus.c | 2 | ||||
-rw-r--r-- | src/or/router.c | 5 |
5 files changed, 16 insertions, 10 deletions
diff --git a/src/common/crypto.c b/src/common/crypto.c index 8a1c3e9bc5..ea70aad4ab 100644 --- a/src/common/crypto.c +++ b/src/common/crypto.c @@ -643,7 +643,8 @@ crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to, tor_assert(to); tor_assert(fromlen<INT_MAX); - r = RSA_public_encrypt((int)fromlen, (unsigned char*)from, (unsigned char*)to, + r = RSA_public_encrypt((int)fromlen, + (unsigned char*)from, (unsigned char*)to, env->key, crypto_get_rsa_padding(padding)); if (r<0) { crypto_log_errors(LOG_WARN, "performing RSA encryption"); @@ -698,7 +699,8 @@ crypto_pk_public_checksig(crypto_pk_env_t *env, char *to, tor_assert(from); tor_assert(to); tor_assert(fromlen < INT_MAX); - r = RSA_public_decrypt((int)fromlen, (unsigned char*)from, (unsigned char*)to, + r = RSA_public_decrypt((int)fromlen, + (unsigned char*)from, (unsigned char*)to, env->key, RSA_PKCS1_PADDING); if (r<0) { @@ -715,7 +717,7 @@ crypto_pk_public_checksig(crypto_pk_env_t *env, char *to, */ int crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const char *data, - size_t datalen, const char *sig, size_t siglen) + size_t datalen, const char *sig, size_t siglen) { char digest[DIGEST_LEN]; char *buf; diff --git a/src/or/connection.c b/src/or/connection.c index 76b943964c..27c15c7b7d 100644 --- a/src/or/connection.c +++ b/src/or/connection.c @@ -2647,12 +2647,13 @@ static void set_constrained_socket_buffers(int sock, int size) { void *sz = (void*)&size; - if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, sz,(socklen_t)sizeof(size)) < 0) { + socklen_t sz_sz = (socklen_t) sizeof(size); + if (setsockopt(sock, SOL_SOCKET, SO_SNDBUF, sz, sz_sz) < 0) { int e = tor_socket_errno(sock); log_warn(LD_NET, "setsockopt() to constrain send " "buffer to %d bytes failed: %s", size, tor_socket_strerror(e)); } - if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, sz,(socklen_t)sizeof(size)) < 0) { + if (setsockopt(sock, SOL_SOCKET, SO_RCVBUF, sz, sz_sz) < 0) { int e = tor_socket_errno(sock); log_warn(LD_NET, "setsockopt() to constrain recv " "buffer to %d bytes failed: %s", size, tor_socket_strerror(e)); diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 29aff2872e..81181f7741 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2673,8 +2673,10 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key, SMARTLIST_FOREACH(digests, const char *, d, { if (router_digest_is_me(d)) { - if (router_get_my_routerinfo()) /* make sure desc_routerinfo exists */ - smartlist_add(descs_out, &(router_get_my_routerinfo()->cache_info)); + /* make sure desc_routerinfo exists */ + routerinfo_t *ri = router_get_my_routerinfo(); + if (ri) + smartlist_add(descs_out, &(ri->cache_info)); } else { routerinfo_t *ri = router_get_by_digest(d); /* Don't actually serve a descriptor that everyone will think is diff --git a/src/or/networkstatus.c b/src/or/networkstatus.c index b04800f2f5..0cc1b210a3 100644 --- a/src/or/networkstatus.c +++ b/src/or/networkstatus.c @@ -1130,7 +1130,7 @@ update_consensus_networkstatus_fetch_time(time_t now) tor_assert(c->fresh_until < start); /* We must download the next one before c is invalid: */ tor_assert(start+dl_interval < c->valid_until); - time_to_download_next_consensus = start + crypto_rand_int((int)dl_interval); + time_to_download_next_consensus = start +crypto_rand_int((int)dl_interval); { char tbuf1[ISO_TIME_LEN+1]; char tbuf2[ISO_TIME_LEN+1]; diff --git a/src/or/router.c b/src/or/router.c index 9b22d86ed1..c6f1195366 100644 --- a/src/or/router.c +++ b/src/or/router.c @@ -1099,11 +1099,12 @@ router_digest_is_me(const char *digest) int router_extrainfo_digest_is_me(const char *digest) { - if (!router_get_my_extrainfo()) + extrainfo_t *ei = router_get_my_extrainfo(); + if (!ei) return 0; return !memcmp(digest, - &(router_get_my_extrainfo()->cache_info).signed_descriptor_digest, + ei->cache_info.signed_descriptor_digest, DIGEST_LEN); } |