mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
r14422@tombo: nickm | 2008-02-24 17:09:56 -0500
Whitespace fixes svn:r13700
This commit is contained in:
parent
ee8dce3084
commit
3452486ac6
@ -643,7 +643,8 @@ crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to,
|
|||||||
tor_assert(to);
|
tor_assert(to);
|
||||||
tor_assert(fromlen<INT_MAX);
|
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));
|
env->key, crypto_get_rsa_padding(padding));
|
||||||
if (r<0) {
|
if (r<0) {
|
||||||
crypto_log_errors(LOG_WARN, "performing RSA encryption");
|
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(from);
|
||||||
tor_assert(to);
|
tor_assert(to);
|
||||||
tor_assert(fromlen < INT_MAX);
|
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);
|
env->key, RSA_PKCS1_PADDING);
|
||||||
|
|
||||||
if (r<0) {
|
if (r<0) {
|
||||||
|
@ -2647,12 +2647,13 @@ static void
|
|||||||
set_constrained_socket_buffers(int sock, int size)
|
set_constrained_socket_buffers(int sock, int size)
|
||||||
{
|
{
|
||||||
void *sz = (void*)&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);
|
int e = tor_socket_errno(sock);
|
||||||
log_warn(LD_NET, "setsockopt() to constrain send "
|
log_warn(LD_NET, "setsockopt() to constrain send "
|
||||||
"buffer to %d bytes failed: %s", size, tor_socket_strerror(e));
|
"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);
|
int e = tor_socket_errno(sock);
|
||||||
log_warn(LD_NET, "setsockopt() to constrain recv "
|
log_warn(LD_NET, "setsockopt() to constrain recv "
|
||||||
"buffer to %d bytes failed: %s", size, tor_socket_strerror(e));
|
"buffer to %d bytes failed: %s", size, tor_socket_strerror(e));
|
||||||
|
@ -2673,8 +2673,10 @@ dirserv_get_routerdescs(smartlist_t *descs_out, const char *key,
|
|||||||
SMARTLIST_FOREACH(digests, const char *, d,
|
SMARTLIST_FOREACH(digests, const char *, d,
|
||||||
{
|
{
|
||||||
if (router_digest_is_me(d)) {
|
if (router_digest_is_me(d)) {
|
||||||
if (router_get_my_routerinfo()) /* make sure desc_routerinfo exists */
|
/* make sure desc_routerinfo exists */
|
||||||
smartlist_add(descs_out, &(router_get_my_routerinfo()->cache_info));
|
routerinfo_t *ri = router_get_my_routerinfo();
|
||||||
|
if (ri)
|
||||||
|
smartlist_add(descs_out, &(ri->cache_info));
|
||||||
} else {
|
} else {
|
||||||
routerinfo_t *ri = router_get_by_digest(d);
|
routerinfo_t *ri = router_get_by_digest(d);
|
||||||
/* Don't actually serve a descriptor that everyone will think is
|
/* Don't actually serve a descriptor that everyone will think is
|
||||||
|
@ -1130,7 +1130,7 @@ update_consensus_networkstatus_fetch_time(time_t now)
|
|||||||
tor_assert(c->fresh_until < start);
|
tor_assert(c->fresh_until < start);
|
||||||
/* We must download the next one before c is invalid: */
|
/* We must download the next one before c is invalid: */
|
||||||
tor_assert(start+dl_interval < c->valid_until);
|
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 tbuf1[ISO_TIME_LEN+1];
|
||||||
char tbuf2[ISO_TIME_LEN+1];
|
char tbuf2[ISO_TIME_LEN+1];
|
||||||
|
@ -1099,11 +1099,12 @@ router_digest_is_me(const char *digest)
|
|||||||
int
|
int
|
||||||
router_extrainfo_digest_is_me(const char *digest)
|
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 0;
|
||||||
|
|
||||||
return !memcmp(digest,
|
return !memcmp(digest,
|
||||||
&(router_get_my_extrainfo()->cache_info).signed_descriptor_digest,
|
ei->cache_info.signed_descriptor_digest,
|
||||||
DIGEST_LEN);
|
DIGEST_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user