r14422@tombo: nickm | 2008-02-24 17:09:56 -0500

Whitespace fixes


svn:r13700
This commit is contained in:
Nick Mathewson 2008-02-24 22:11:18 +00:00
parent ee8dce3084
commit 3452486ac6
5 changed files with 16 additions and 10 deletions

View File

@ -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;

View File

@ -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));

View File

@ -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

View File

@ -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];

View File

@ -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);
}