[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] Bite the bullet and limit all our source lines to 80 charac...
Update of /home/or/cvsroot/tor/src/common
In directory moria:/tmp/cvs-serv4887/src/common
Modified Files:
aes.c aes.h compat.c compat.h container.c container.h crypto.c
crypto.h ht.h log.c log.h torgzip.c tortls.c util.c
Log Message:
Bite the bullet and limit all our source lines to 80 characters, the way IBM intended.
Index: aes.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/aes.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- aes.c 1 Dec 2005 18:30:39 -0000 1.30
+++ aes.c 14 Dec 2005 20:40:39 -0000 1.31
@@ -51,11 +51,14 @@
#define MAXKB (256/8)
#define MAXNR 14
-static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/], const u8 cipherKey[], int keyBits);
+static int rijndaelKeySetupEnc(u32 rk[/*4*(Nr + 1)*/],
+ const u8 cipherKey[], int keyBits);
#ifdef USE_RIJNDAEL_COUNTER_OPTIMIZATION
-static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, u32 ctr1, u32 ctr0, u8 ct[16]);
+static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr,
+ u32 ctr1, u32 ctr0, u8 ct[16]);
#else
-static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr, const u8 pt[16], u8 ct[16]);
+static void rijndaelEncrypt(const u32 rk[/*4*(Nr + 1)*/], int Nr,
+ const u8 pt[16], u8 ct[16]);
#endif
#endif
@@ -90,8 +93,10 @@
* 3) changing the counter position was not trivial, last time I looked.
* None of these issues are insurmountable in principle.
*/
-#if !defined(USE_OPENSSL_EVP) && !defined(USE_OPENSSL_AES) && defined(USE_RIJNDAEL_COUNTER_OPTIMIZATION)
- rijndaelEncrypt(cipher->rk, cipher->nr, cipher->counter1, cipher->counter0, cipher->buf);
+#if (!defined(USE_OPENSSL_EVP) && !defined(USE_OPENSSL_AES) && \
+ defined(USE_RIJNDAEL_COUNTER_OPTIMIZATION))
+ rijndaelEncrypt(cipher->rk, cipher->nr,
+ cipher->counter1, cipher->counter0, cipher->buf);
#else
u32 counter0 = cipher->counter0;
u32 counter1 = cipher->counter1;
@@ -176,7 +181,8 @@
* by <b>len</b> bytes as it encrypts.
*/
void
-aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len, char *output)
+aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len,
+ char *output)
{
int c = cipher->pos;
if (!len) return;
Index: aes.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/aes.h,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- aes.h 9 Jun 2005 19:03:31 -0000 1.12
+++ aes.h 14 Dec 2005 20:40:39 -0000 1.13
@@ -22,7 +22,8 @@
aes_cnt_cipher_t* aes_new_cipher(void);
void aes_free_cipher(aes_cnt_cipher_t *cipher);
void aes_set_key(aes_cnt_cipher_t *cipher, const char *key, int key_bits);
-void aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len, char *output);
+void aes_crypt(aes_cnt_cipher_t *cipher, const char *input, size_t len,
+ char *output);
uint64_t aes_get_counter(aes_cnt_cipher_t *cipher);
void aes_set_counter(aes_cnt_cipher_t *cipher, uint64_t counter);
void aes_adjust_counter(aes_cnt_cipher_t *cipher, long delta);
Index: compat.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.c,v
retrieving revision 1.78
retrieving revision 1.79
diff -u -d -r1.78 -r1.79
--- compat.c 10 Dec 2005 08:27:01 -0000 1.78
+++ compat.c 14 Dec 2005 20:40:39 -0000 1.79
@@ -2,7 +2,8 @@
* Copyright 2004-2005 Roger Dingledine, Nick Mathewson */
/* See LICENSE for licensing information */
/* $Id$ */
-const char compat_c_id[] = "$Id$";
+const char compat_c_id[] =
+ "$Id$";
/**
* \file compat.c
@@ -150,13 +151,15 @@
* Requires that nlen be greater than zero.
*/
const void *
-tor_memmem(const void *_haystack, size_t hlen, const void *_needle, size_t nlen)
+tor_memmem(const void *_haystack, size_t hlen,
+ const void *_needle, size_t nlen)
{
#if defined(HAVE_MEMMEM) && (!defined(__GNUC__) || __GNUC__ >= 2)
tor_assert(nlen);
return memmem(_haystack, hlen, _needle, nlen);
#else
- /* This isn't as fast as the GLIBC implementation, but it doesn't need to be. */
+ /* This isn't as fast as the GLIBC implementation, but it doesn't need to
+ * be. */
const char *p, *end;
const char *haystack = (const char*)_haystack;
const char *needle = (const char*)_needle;
@@ -463,7 +466,8 @@
return -1;
}
if (rlim.rlim_max < limit) {
- warn(LD_CONFIG,"We need %lu file descriptors available, and we're limited to %lu. Please change your ulimit -n.",
+ warn(LD_CONFIG,"We need %lu file descriptors available, and we're "
+ "limited to %lu. Please change your ulimit -n.",
limit, (unsigned long)rlim.rlim_max);
return -1;
}
@@ -538,7 +542,8 @@
return 0;
#endif
- err(LD_CONFIG,"User or group specified, but switching users is not supported.");
+ err(LD_CONFIG,
+ "User or group specified, but switching users is not supported.");
return -1;
}
@@ -722,9 +727,11 @@
{ VER_SUITE_ENTERPRISE, " {enterprise}" },
{ VER_SUITE_EMBEDDEDNT, " {embedded}" },
{ VER_SUITE_PERSONAL, " {personal}" },
- { VER_SUITE_SINGLEUSERTS, " {terminal services, single user}" },
+ { VER_SUITE_SINGLEUSERTS,
+ " {terminal services, single user}" },
{ VER_SUITE_SMALLBUSINESS, " {small business}" },
- { VER_SUITE_SMALLBUSINESS_RESTRICTED, " {small business, restricted}" },
+ { VER_SUITE_SMALLBUSINESS_RESTRICTED,
+ " {small business, restricted}" },
{ VER_SUITE_TERMINAL, " {terminal services}" },
{ 0, NULL },
};
@@ -751,14 +758,14 @@
if (info.dwMajorVersion > 6 ||
(info.dwMajorVersion==6 && info.dwMinorVersion>0))
tor_snprintf(uname_result, sizeof(uname_result),
- "Very recent version of Windows [major=%d,minor=%d] %s",
- (int)info.dwMajorVersion,(int)info.dwMinorVersion,
- info.szCSDVersion);
+ "Very recent version of Windows [major=%d,minor=%d] %s",
+ (int)info.dwMajorVersion,(int)info.dwMinorVersion,
+ info.szCSDVersion);
else
tor_snprintf(uname_result, sizeof(uname_result),
- "Unrecognized version of Windows [major=%d,minor=%d] %s",
- (int)info.dwMajorVersion,(int)info.dwMinorVersion,
- info.szCSDVersion);
+ "Unrecognized version of Windows [major=%d,minor=%d] %s",
+ (int)info.dwMajorVersion,(int)info.dwMinorVersion,
+ info.szCSDVersion);
}
if (info.wProductType == VER_NT_DOMAIN_CONTROLLER) {
strlcat(uname_result, " [domain controller]", sizeof(uname_result));
Index: compat.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.h,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- compat.h 7 Dec 2005 19:49:18 -0000 1.39
+++ compat.h 14 Dec 2005 20:40:39 -0000 1.40
@@ -180,7 +180,8 @@
#define ERRNO_IS_EINPROGRESS(e) ((e) == WSAEINPROGRESS)
/** Return true if e is EINPROGRESS or the local equivalent as returned by
* a call to connect(). */
-#define ERRNO_IS_CONN_EINPROGRESS(e) ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
+#define ERRNO_IS_CONN_EINPROGRESS(e) \
+ ((e) == WSAEINPROGRESS || (e)== WSAEINVAL || (e) == WSAEWOULDBLOCK)
/** Return true if e is EAGAIN or another error indicating that a call to
* accept() has no pending connections to return. */
#define ERRNO_IS_ACCEPT_EAGAIN(e) ERRNO_IS_EAGAIN(e)
@@ -232,7 +233,8 @@
#if defined(ENABLE_THREADS) && defined(MS_WINDOWS)
#define USE_WIN32_THREADS
#define TOR_IS_MULTITHREADED 1
-#elif defined(ENABLE_THREADS) && defined(HAVE_PTHREAD_H) && defined(HAVE_PTHREAD_CREATE)
+#elif (defined(ENABLE_THREADS) && defined(HAVE_PTHREAD_H) && \
+ defined(HAVE_PTHREAD_CREATE))
#define USE_PTHREADS
#define TOR_IS_MULTITHREADED 1
#else
Index: container.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.c,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- container.c 3 Dec 2005 02:00:51 -0000 1.53
+++ container.c 14 Dec 2005 20:40:39 -0000 1.54
@@ -2,7 +2,8 @@
Copyright 2004-2005 Roger Dingledine, Nick Mathewson */
/* See LICENSE for licensing information */
/* $Id$ */
-const char container_c_id[] = "$Id$";
+const char container_c_id[] =
+ "$Id$";
/**
* \file container.c
@@ -807,8 +808,9 @@
return iter == NULL;
}
-/** Remove all entries from <b>map</b>, and deallocate storage for those entries.
- * If free_val is provided, it is invoked on every value in <b>map</b>.
+/** Remove all entries from <b>map</b>, and deallocate storage for those
+ * entries. If free_val is provided, it is invoked on every value in
+ * <b>map</b>.
*/
void
strmap_free(strmap_t *map, void (*free_val)(void*))
Index: container.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/container.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- container.h 3 Dec 2005 02:00:51 -0000 1.27
+++ container.h 14 Dec 2005 20:40:39 -0000 1.28
@@ -5,7 +5,8 @@
#ifndef __CONTAINER_H
#define __CONTAINER_H
-#define CONTAINER_H_ID "$Id$"
+#define CONTAINER_H_ID \
+ "$Id$"
#include "compat.h"
#include "util.h"
Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- crypto.c 8 Dec 2005 17:38:31 -0000 1.181
+++ crypto.c 14 Dec 2005 20:40:39 -0000 1.182
@@ -2,7 +2,8 @@
* Copyright 2004-2005 Roger Dingledine, Nick Mathewson */
/* See LICENSE for licensing information */
/* $Id$ */
-const char crypto_c_id[] = "$Id$";
+const char crypto_c_id[] =
+ "$Id$";
/**
* \file crypto.c
@@ -167,7 +168,8 @@
func = (const char*)ERR_func_error_string(err);
if (!msg) msg = "(null)";
if (doing) {
- log(severity, LD_CRYPTO, "crypto error while %s: %s (in %s:%s)", doing, msg, lib, func);
+ log(severity, LD_CRYPTO, "crypto error while %s: %s (in %s:%s)",
+ doing, msg, lib, func);
} else {
log(severity, LD_CRYPTO, "crypto error: %s (in %s:%s)", msg, lib, func);
}
@@ -456,7 +458,8 @@
* <b>keyfile</b> into <b>env</b>. Return 0 on success, -1 on failure.
*/
int
-crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *keyfile)
+crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env,
+ const char *keyfile)
{
char *contents;
int r;
@@ -487,7 +490,8 @@
* failure, return -1.
*/
int
-crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest, size_t *len)
+crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest,
+ size_t *len)
{
BUF_MEM *buf;
BIO *b;
@@ -525,7 +529,8 @@
* failure.
*/
int
-crypto_pk_read_public_key_from_string(crypto_pk_env_t *env, const char *src, size_t len)
+crypto_pk_read_public_key_from_string(crypto_pk_env_t *env, const char *src,
+ size_t len)
{
BIO *b;
@@ -770,7 +775,8 @@
tor_assert(env);
tor_assert(from);
tor_assert(to);
- r = RSA_public_decrypt(fromlen, (unsigned char*)from, (unsigned char*)to, env->key, RSA_PKCS1_PADDING);
+ r = RSA_public_decrypt(fromlen, (unsigned char*)from, (unsigned char*)to,
+ env->key, RSA_PKCS1_PADDING);
if (r<0) {
crypto_log_errors(LOG_WARN, "checking RSA signature");
@@ -830,7 +836,8 @@
/* Not a private key */
return -1;
- r = RSA_private_encrypt(fromlen, (unsigned char*)from, (unsigned char*)to, env->key, RSA_PKCS1_PADDING);
+ r = RSA_private_encrypt(fromlen, (unsigned char*)from, (unsigned char*)to,
+ env->key, RSA_PKCS1_PADDING);
if (r<0) {
crypto_log_errors(LOG_WARN, "generating RSA signature");
return -1;
@@ -950,9 +957,11 @@
pkeylen = crypto_pk_keysize(env);
if (fromlen <= pkeylen) {
- return crypto_pk_private_decrypt(env,to,from,fromlen,padding,warnOnFailure);
+ return crypto_pk_private_decrypt(env,to,from,fromlen,padding,
+ warnOnFailure);
}
- outlen = crypto_pk_private_decrypt(env,buf,from,pkeylen,padding,warnOnFailure);
+ outlen = crypto_pk_private_decrypt(env,buf,from,pkeylen,padding,
+ warnOnFailure);
if (outlen<0) {
log_fn(warnOnFailure?LOG_WARN:LOG_DEBUG, LD_CRYPTO,
"Error decrypting public-key data");
@@ -1397,7 +1406,8 @@
return -1;
}
if (tor_check_dh_key(dh->dh->pub_key)<0) {
- warn(LD_CRYPTO, "Weird! Our own DH key was invalid. I guess once-in-the-universe chances really do happen. Trying again.");
+ warn(LD_CRYPTO, "Weird! Our own DH key was invalid. I guess once-in-"
+ "the-universe chances really do happen. Trying again.");
/* Free and clear the keys, so openssl will actually try again. */
BN_free(dh->dh->pub_key);
BN_free(dh->dh->priv_key);
@@ -1425,7 +1435,8 @@
bytes = BN_num_bytes(dh->dh->pub_key);
tor_assert(bytes >= 0);
if (pubkey_len < (size_t)bytes) {
- warn(LD_CRYPTO, "Weird! pubkey_len (%d) was smaller than DH_BYTES (%d)", (int) pubkey_len, bytes);
+ warn(LD_CRYPTO, "Weird! pubkey_len (%d) was smaller than DH_BYTES (%d)",
+ (int) pubkey_len, bytes);
return -1;
}
@@ -1627,7 +1638,8 @@
#ifdef MS_WINDOWS
if (!provider_set) {
- if (!CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT)) {
+ if (!CryptAcquireContext(&provider, NULL, NULL, PROV_RSA_FULL,
+ CRYPT_VERIFYCONTEXT)) {
if (GetLastError() != NTE_BAD_KEYSET) {
warn(LD_CRYPTO, "Can't get CryptoAPI provider [1]");
return rand_poll_status ? 0 : -1;
@@ -1649,7 +1661,8 @@
n = read_all(fd, buf, sizeof(buf), 0);
close(fd);
if (n != sizeof(buf)) {
- warn(LD_CRYPTO, "Error reading from entropy source (read only %d bytes).", n);
+ warn(LD_CRYPTO,
+ "Error reading from entropy source (read only %d bytes).", n);
return -1;
}
RAND_seed(buf, sizeof(buf));
@@ -1729,7 +1742,8 @@
return -1;
EVP_EncodeInit(&ctx);
- EVP_EncodeUpdate(&ctx, (unsigned char*)dest, &len, (unsigned char*)src, srclen);
+ EVP_EncodeUpdate(&ctx, (unsigned char*)dest, &len,
+ (unsigned char*)src, srclen);
EVP_EncodeFinal(&ctx, (unsigned char*)(dest+len), &ret);
ret += len;
return ret;
@@ -1758,7 +1772,8 @@
return -1;
EVP_DecodeInit(&ctx);
- EVP_DecodeUpdate(&ctx, (unsigned char*)dest, &len, (unsigned char*)src, srclen);
+ EVP_DecodeUpdate(&ctx, (unsigned char*)dest, &len,
+ (unsigned char*)src, srclen);
EVP_DecodeFinal(&ctx, (unsigned char*)dest, &ret);
ret += len;
return ret;
Index: crypto.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.h,v
retrieving revision 1.72
retrieving revision 1.73
diff -u -d -r1.72 -r1.73
--- crypto.h 8 Dec 2005 17:38:31 -0000 1.72
+++ crypto.h 14 Dec 2005 20:40:39 -0000 1.73
@@ -61,7 +61,8 @@
void crypto_free_pk_env(crypto_pk_env_t *env);
/* convenience function: wraps crypto_create_crypto_env, set_key, and init. */
-crypto_cipher_env_t *crypto_create_init_cipher(const char *key, int encrypt_mode);
+crypto_cipher_env_t *crypto_create_init_cipher(const char *key,
+ int encrypt_mode);
crypto_cipher_env_t *crypto_new_cipher_env(void);
void crypto_free_cipher_env(crypto_cipher_env_t *env);
@@ -69,10 +70,14 @@
/* public key crypto */
int crypto_pk_generate_key(crypto_pk_env_t *env);
-int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *keyfile);
-int crypto_pk_write_public_key_to_string(crypto_pk_env_t *env, char **dest, size_t *len);
-int crypto_pk_read_public_key_from_string(crypto_pk_env_t *env, const char *src, size_t len);
-int crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env, const char *fname);
+int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env,
+ const char *keyfile);
+int crypto_pk_write_public_key_to_string(crypto_pk_env_t *env,
+ char **dest, size_t *len);
+int crypto_pk_read_public_key_from_string(crypto_pk_env_t *env,
+ const char *src, size_t len);
+int crypto_pk_write_private_key_to_filename(crypto_pk_env_t *env,
+ const char *fname);
int crypto_pk_DER64_encode_public_key(crypto_pk_env_t *env, char **dest);
crypto_pk_env_t *crypto_pk_DER64_decode_public_key(const char *in);
Index: ht.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/ht.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- ht.h 26 Nov 2005 00:42:25 -0000 1.2
+++ ht.h 14 Dec 2005 20:40:39 -0000 1.3
@@ -333,7 +333,8 @@
}
#endif
-#define HT_GENERATE(name, type, field, hashfn, eqfn, load, mallocfn, reallocfn, freefn) \
+#define HT_GENERATE(name, type, field, hashfn, eqfn, load, mallocfn, \
+ reallocfn, freefn) \
static unsigned name##_PRIMES[] = { \
53, 97, 193, 389, \
769, 1543, 3079, 6151, \
Index: log.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.c,v
retrieving revision 1.109
retrieving revision 1.110
diff -u -d -r1.109 -r1.110
--- log.c 30 Nov 2005 06:45:30 -0000 1.109
+++ log.c 14 Dec 2005 20:40:39 -0000 1.110
@@ -364,7 +364,8 @@
/** Add a log handler to send all messages of severity <b>loglevel</b>
* or higher to <b>stream</b>. */
void
-add_stream_log(int loglevelMin, int loglevelMax, const char *name, FILE *stream)
+add_stream_log(int loglevelMin, int loglevelMax,
+ const char *name, FILE *stream)
{
logfile_t *lf;
lf = tor_malloc_zero(sizeof(logfile_t));
Index: log.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/log.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -d -r1.61 -r1.62
--- log.h 30 Nov 2005 06:27:58 -0000 1.61
+++ log.h 14 Dec 2005 20:40:39 -0000 1.62
@@ -18,7 +18,8 @@
#include <syslog.h>
#define LOG_WARN LOG_WARNING
#if LOG_DEBUG < LOG_ERR
-#error "Your syslog.h thinks high numbers are more important. We aren't prepared to deal with that."
+#error "Your syslog.h thinks high numbers are more important. " \
+ "We aren't prepared to deal with that."
#endif
#else
/* XXXX Note: The code was originally written to refer to severities,
@@ -94,7 +95,8 @@
int parse_log_level(const char *level);
const char *log_level_to_string(int level);
-void add_stream_log(int severityMin, int severityMax, const char *name, FILE *stream);
+void add_stream_log(int severityMin, int severityMax, const char *name,
+ FILE *stream);
int add_file_log(int severityMin, int severityMax, const char *filename);
#ifdef HAVE_SYSLOG_H
int add_syslog_log(int loglevelMin, int loglevelMax);
@@ -112,7 +114,8 @@
log_callback cb);
/* Outputs a message to stdout */
-void _log(int severity, uint32_t domain, const char *format, ...) CHECK_PRINTF(3,4);
+void _log(int severity, uint32_t domain, const char *format, ...)
+ CHECK_PRINTF(3,4);
#define log _log /* hack it so we don't conflict with log() as much */
#ifdef __GNUC__
Index: torgzip.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/torgzip.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- torgzip.c 18 Oct 2005 21:58:19 -0000 1.24
+++ torgzip.c 14 Dec 2005 20:40:39 -0000 1.25
@@ -2,7 +2,8 @@
/* Copyright 2004-2005 Roger Dingledine, Nick Mathewson */
/* See LICENSE for licensing information */
/* $Id$ */
-const char torgzip_c_id[] = "$Id$";
+const char torgzip_c_id[] =
+ "$Id$";
/**
* \file torgzip.c
Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -d -r1.112 -r1.113
--- tortls.c 14 Nov 2005 21:17:38 -0000 1.112
+++ tortls.c 14 Dec 2005 20:40:39 -0000 1.113
@@ -2,7 +2,8 @@
* Copyright 2004-2005 Roger Dingledine, Nick Mathewson */
/* See LICENSE for licensing information */
/* $Id$ */
-const char tortls_c_id[] = "$Id$";
+const char tortls_c_id[] =
+ "$Id$";
/**
* \file tortls.c
@@ -23,7 +24,8 @@
#include <string.h>
/* Copied from or.h */
-#define LEGAL_NICKNAME_CHARACTERS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
+#define LEGAL_NICKNAME_CHARACTERS \
+ "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
#include <assert.h>
#include <openssl/ssl.h>
@@ -53,7 +55,8 @@
} state; /**< The current SSL state, depending on which operations have
* completed successfully. */
int isServer;
- size_t wantwrite_n; /**< 0 normally, >0 if we returned wantwrite last time. */
+ size_t wantwrite_n; /**< 0 normally, >0 if we returned wantwrite last
+ * time. */
};
static X509* tor_tls_create_certificate(crypto_pk_env_t *rsa,
@@ -91,7 +94,8 @@
func = (const char*)ERR_func_error_string(err);
if (!msg) msg = "(null)";
if (doing) {
- log(severity, LD_NET, "TLS error while %s: %s (in %s:%s)", doing, msg, lib,func);
+ log(severity, LD_NET, "TLS error while %s: %s (in %s:%s)",
+ doing, msg, lib,func);
} else {
log(severity, LD_NET, "TLS error: %s (in %s:%s)", msg, lib, func);
}
@@ -130,7 +134,8 @@
log(severity, LD_NET, "TLS error: unexpected close while %s", doing);
else {
int e = tor_socket_errno(tls->socket);
- log(severity, LD_NET, "TLS error: <syscall error while %s> (errno=%d: %s)",
+ log(severity, LD_NET,
+ "TLS error: <syscall error while %s> (errno=%d: %s)",
doing, e, tor_socket_strerror(e));
}
tls_log_errors(severity, doing);
@@ -226,23 +231,29 @@
if (!(name = X509_NAME_new()))
goto error;
- if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
+ if ((nid = OBJ_txt2nid("organizationName")) == NID_undef)
+ goto error;
if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
- (unsigned char*)"TOR", -1, -1, 0))) goto error;
+ (unsigned char*)"TOR", -1, -1, 0)))
+ goto error;
if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
- (unsigned char*)cname, -1, -1, 0))) goto error;
+ (unsigned char*)cname, -1, -1, 0)))
+ goto error;
if (!(X509_set_subject_name(x509, name)))
goto error;
if (!(name_issuer = X509_NAME_new()))
goto error;
- if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
+ if ((nid = OBJ_txt2nid("organizationName")) == NID_undef)
+ goto error;
if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
- (unsigned char*)"TOR", -1, -1, 0))) goto error;
+ (unsigned char*)"TOR", -1, -1, 0)))
+ goto error;
if ((nid = OBJ_txt2nid("commonName")) == NID_undef) goto error;
if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
- (unsigned char*)cname_sign, -1, -1, 0))) goto error;
+ (unsigned char*)cname_sign, -1, -1, 0)))
+ goto error;
if (!(X509_set_issuer_name(x509, name_issuer)))
goto error;
@@ -658,10 +669,11 @@
if (lenout == -1)
goto error;
if (((int)strspn(buf, LEGAL_NICKNAME_CHARACTERS)) < lenout) {
- warn(LD_PROTOCOL, "Peer certificate nickname \"%s\" has illegal characters.",
- buf);
+ warn(LD_PROTOCOL,
+ "Peer certificate nickname \"%s\" has illegal characters.", buf);
if (strchr(buf, '.'))
- warn(LD_PROTOCOL, " (Maybe it is not really running Tor at its advertised OR port.)");
+ warn(LD_PROTOCOL, " (Maybe it is not really running Tor at its "
+ "advertised OR port.)");
goto error;
}
@@ -709,7 +721,9 @@
strftime(mytime, 32, "%b %d %H:%M:%S %Y GMT", tor_gmtime_r(&now, &tm));
- warn(LD_GENERAL, "(certificate lifetime runs from %s through %s. Your time is %s.)",s1,s2,mytime);
+ warn(LD_GENERAL,
+ "(certificate lifetime runs from %s through %s. Your time is %s.)",
+ s1,s2,mytime);
end:
/* Not expected to get invoked */
@@ -749,7 +763,8 @@
* cert and the id_cert.
*/
if (num_in_chain < 1) {
- log_fn(severity,LD_PROTOCOL,"Unexpected number of certificates in chain (%d)",
+ log_fn(severity,LD_PROTOCOL,
+ "Unexpected number of certificates in chain (%d)",
num_in_chain);
goto done;
}
Index: util.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/util.c,v
retrieving revision 1.239
retrieving revision 1.240
diff -u -d -r1.239 -r1.240
--- util.c 9 Dec 2005 02:45:33 -0000 1.239
+++ util.c 14 Dec 2005 20:40:39 -0000 1.240
@@ -101,10 +101,12 @@
#else
#define dmalloc_strdup(file, line, string, xalloc_b) strdup(string)
- #define dmalloc_malloc(file, line, size, func_id, alignment, xalloc_b) malloc(size)
+ #define dmalloc_malloc(file, line, size, func_id, alignment, xalloc_b) \
+ malloc(size)
#define DMALLOC_FUNC_MALLOC 0
- #define dmalloc_realloc(file, line, old_pnt, new_size, func_id, xalloc_b) realloc((old_pnt), (new_size))
+ #define dmalloc_realloc(file, line, old_pnt, new_size, func_id, xalloc_b) \
+ realloc((old_pnt), (new_size))
#define DMALLOC_FUNC_REALLOC 0
#define DMALLOC_FN_ARGS
#endif
@@ -921,7 +923,8 @@
pw = getpwuid(st.st_uid);
- log(LOG_WARN, LD_FS, "%s is not owned by this user (%s, %d) but by %s (%d). Perhaps you are running Tor as the wrong user?",
+ log(LOG_WARN, LD_FS, "%s is not owned by this user (%s, %d) but by "
+ "%s (%d). Perhaps you are running Tor as the wrong user?",
dirname, process_ownername, (int)getuid(),
pw ? pw->pw_name : "<unknown>", (int)st.st_uid);
@@ -942,8 +945,8 @@
return 0;
}
-/** Create a file named <b>fname</b> with the contents <b>str</b>. Overwrite the
- * previous <b>fname</b> if possible. Return 0 on success, -1 on failure.
+/** Create a file named <b>fname</b> with the contents <b>str</b>. Overwrite
+ * the previous <b>fname</b> if possible. Return 0 on success, -1 on failure.
*
* This function replaces the old file atomically, if possible.
*/
@@ -989,18 +992,21 @@
{
result = write_all(fd, chunk->bytes, chunk->len, 0);
if (result < 0 || (size_t)result != chunk->len) {
- log(LOG_WARN, LD_FS, "Error writing to \"%s\": %s", tempname, strerror(errno));
+ log(LOG_WARN, LD_FS, "Error writing to \"%s\": %s", tempname,
+ strerror(errno));
close(fd);
goto err;
}
});
if (close(fd)) {
- log(LOG_WARN, LD_FS, "Error flushing to \"%s\": %s", tempname, strerror(errno));
+ log(LOG_WARN, LD_FS, "Error flushing to \"%s\": %s", tempname,
+ strerror(errno));
goto err;
}
if (!(open_flags & O_APPEND)) {
if (replace_file(tempname, fname)) {
- log(LOG_WARN, LD_FS, "Error replacing \"%s\": %s", fname, strerror(errno));
+ log(LOG_WARN, LD_FS, "Error replacing \"%s\": %s", fname,
+ strerror(errno));
goto err;
}
}
@@ -1108,8 +1114,9 @@
}
#ifdef MS_WINDOWS
if (!bin && strchr(string, '\r')) {
- debug(LD_FS, "We didn't convert CRLF to LF as well as we hoped when reading %s. Coping.",
- filename);
+ debug(LD_FS, "We didn't convert CRLF to LF as well as we hoped "
+ "when reading %s. Coping.",
+ filename);
tor_strstrip(string, "\r");
}
#endif
@@ -1203,7 +1210,8 @@
if (filename[1] == '/' || filename[1] == '\0') {
home = getenv("HOME");
if (!home) {
- warn(LD_CONFIG, "Couldn't find $HOME environment variable while expanding %s", filename);
+ warn(LD_CONFIG, "Couldn't find $HOME environment variable while "
+ "expanding %s", filename);
return NULL;
}
home = tor_strdup(home);
@@ -1430,7 +1438,8 @@
} else if (tor_inet_aton(address, &in) != 0) {
*addr_out = ntohl(in.s_addr);
} else {
- warn(LD_GENERAL, "Malformed IP \"%s\" in address pattern; rejecting.",address);
+ warn(LD_GENERAL, "Malformed IP \"%s\" in address pattern; rejecting.",
+ address);
goto err;
}
@@ -1445,7 +1454,8 @@
if (!*endptr) {
/* strtol handled the whole mask. */
if (bits < 0 || bits > 32) {
- warn(LD_GENERAL, "Bad number of mask bits on address range; rejecting.");
+ warn(LD_GENERAL,
+ "Bad number of mask bits on address range; rejecting.");
goto err;
}
*mask_out = ~((1<<(32-bits))-1);