[or-cvs] Make Tor compile with no warnings with gcc4.0 on OSX

Nick Mathewson nickm at seul.org
Sat May 7 05:55:08 UTC 2005


Update of /home/or/cvsroot/tor/src/common
In directory moria.mit.edu:/tmp/cvs-serv25012/src/common

Modified Files:
	aes.c aes.h compat.h crypto.c crypto.h torgzip.c tortls.c 
Log Message:
Make Tor compile with no warnings with gcc4.0 on OSX

Index: aes.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/aes.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -d -r1.17 -r1.18
--- aes.c	1 Apr 2005 20:15:54 -0000	1.17
+++ aes.c	7 May 2005 05:55:05 -0000	1.18
@@ -84,9 +84,10 @@
  * the counter to 0.
  */
 void
-aes_set_key(aes_cnt_cipher_t *cipher, const unsigned char *key, int key_bits)
+aes_set_key(aes_cnt_cipher_t *cipher, const char *key, int key_bits)
 {
-  cipher->nr = rijndaelKeySetupEnc(cipher->rk, key, key_bits);
+  cipher->nr = rijndaelKeySetupEnc(cipher->rk, (const unsigned char*)key,
+                                   key_bits);
   cipher->counter0 = 0;
   cipher->counter1 = 0;
   cipher->pos = 0;
@@ -108,7 +109,7 @@
  * by <b>len</b> bytes as it encrypts.
  */
 void
-aes_crypt(aes_cnt_cipher_t *cipher, const char *input, int 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.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- aes.h	1 Apr 2005 20:15:54 -0000	1.9
+++ aes.h	7 May 2005 05:55:05 -0000	1.10
@@ -21,8 +21,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 unsigned char *key, int key_bits);
-void aes_crypt(aes_cnt_cipher_t *cipher, const char *input, int len, char *output);
+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);
 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.h
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/compat.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- compat.h	1 Apr 2005 20:15:54 -0000	1.27
+++ compat.h	7 May 2005 05:55:05 -0000	1.28
@@ -135,6 +135,10 @@
 #define tor_close_socket(s) close(s)
 #endif
 
+#if (SIZEOF_SOCKLEN_T == 0)
+typedef int socklen_t;
+#endif
+
 /* Now that we use libevent, all real sockets are safe for polling ... or
  * if they aren't, libevent will help us. */
 #define SOCKET_IS_POLLABLE(fd) ((fd)>=0)

Index: crypto.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/crypto.c,v
retrieving revision 1.136
retrieving revision 1.137
diff -u -d -r1.136 -r1.137
--- crypto.c	1 Apr 2005 20:15:54 -0000	1.136
+++ crypto.c	7 May 2005 05:55:05 -0000	1.137
@@ -93,7 +93,7 @@
 
 struct crypto_cipher_env_t
 {
-  unsigned char key[CIPHER_KEY_LEN];
+  char key[CIPHER_KEY_LEN];
   aes_cnt_cipher_t *cipher;
 };
 
@@ -597,12 +597,12 @@
 }
 
 /** Return the size of the public key modulus in <b>env</b>, in bytes. */
-int crypto_pk_keysize(crypto_pk_env_t *env)
+size_t crypto_pk_keysize(crypto_pk_env_t *env)
 {
   tor_assert(env);
   tor_assert(env->key);
 
-  return RSA_size(env->key);
+  return (size_t) RSA_size(env->key);
 }
 
 /** Increase the reference count of <b>env</b>, and return it.
@@ -621,16 +621,16 @@
  * written.  On failure, return -1.
  */
 int
-crypto_pk_public_encrypt(crypto_pk_env_t *env, unsigned char *to,
-                         const unsigned char *from, int fromlen, int padding)
+crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to,
+                         const char *from, size_t fromlen, int padding)
 {
   int r;
   tor_assert(env);
   tor_assert(from);
   tor_assert(to);
 
-  r = RSA_public_encrypt(fromlen, (unsigned char*)from, to, env->key,
-                            crypto_get_rsa_padding(padding));
+  r = RSA_public_encrypt(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");
     return -1;
@@ -644,8 +644,8 @@
  * written.  On failure, return -1.
  */
 int
-crypto_pk_private_decrypt(crypto_pk_env_t *env, unsigned char *to,
-                          const unsigned char *from, int fromlen,
+crypto_pk_private_decrypt(crypto_pk_env_t *env, char *to,
+                          const char *from, size_t fromlen,
                           int padding, int warnOnFailure)
 {
   int r;
@@ -657,8 +657,9 @@
     /* Not a private key */
     return -1;
 
-  r = RSA_private_decrypt(fromlen, (unsigned char*)from, to, env->key,
-                             crypto_get_rsa_padding(padding));
+  r = RSA_private_decrypt(fromlen, (unsigned char*)from, (unsigned char*)to,
+                          env->key, crypto_get_rsa_padding(padding));
+
   if (r<0) {
     crypto_log_errors(warnOnFailure?LOG_WARN:LOG_INFO,
                       "performing RSA decryption");
@@ -673,14 +674,14 @@
  * On failure, return -1.
  */
 int
-crypto_pk_public_checksig(crypto_pk_env_t *env, unsigned char *to,
-                          const unsigned char *from, int fromlen)
+crypto_pk_public_checksig(crypto_pk_env_t *env, char *to,
+                          const char *from, size_t fromlen)
 {
   int r;
   tor_assert(env);
   tor_assert(from);
   tor_assert(to);
-  r = RSA_public_decrypt(fromlen, (unsigned char*)from, 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");
@@ -695,8 +696,8 @@
  * SHA1(data).  Else return -1.
  */
 int
-crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const unsigned char *data,
-                                 int datalen, const unsigned char *sig, int siglen)
+crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const char *data,
+                                 int datalen, const char *sig, int siglen)
 {
   char digest[DIGEST_LEN];
   char buf[PK_BYTES+1];
@@ -729,8 +730,8 @@
  * -1.
  */
 int
-crypto_pk_private_sign(crypto_pk_env_t *env, unsigned char *to,
-                       const unsigned char *from, int fromlen)
+crypto_pk_private_sign(crypto_pk_env_t *env, char *to,
+                       const char *from, size_t fromlen)
 {
   int r;
   tor_assert(env);
@@ -740,7 +741,7 @@
     /* Not a private key */
     return -1;
 
-  r = RSA_private_encrypt(fromlen, (unsigned char*)from, 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;
@@ -754,8 +755,8 @@
  * success, and -1 on failure.
  */
 int
-crypto_pk_private_sign_digest(crypto_pk_env_t *env, unsigned char *to,
-                              const unsigned char *from, int fromlen)
+crypto_pk_private_sign_digest(crypto_pk_env_t *env, char *to,
+                              const char *from, size_t fromlen)
 {
   char digest[DIGEST_LEN];
   if (crypto_digest(digest,from,fromlen)<0)
@@ -781,12 +782,13 @@
  *     the source data encrypted in AES-CTR mode with the symmetric key.
  */
 int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env,
-                                    unsigned char *to,
-                                    const unsigned char *from,
-                                    int fromlen,
+                                    char *to,
+                                    const char *from,
+                                    size_t fromlen,
                                     int padding, int force)
 {
-  int overhead, pkeylen, outlen, r, symlen;
+  int overhead, outlen, r, symlen;
+  size_t pkeylen;
   crypto_cipher_env_t *cipher = NULL;
   char buf[PK_BYTES+1];
 
@@ -825,7 +827,7 @@
   symlen = fromlen-(pkeylen-overhead-CIPHER_KEY_LEN);
 
   outlen = crypto_pk_public_encrypt(env,to,buf,pkeylen-overhead,padding);
-  if (outlen!=pkeylen) {
+  if (outlen!=(int)pkeylen) {
     goto err;
   }
   r = crypto_cipher_encrypt(cipher, to+outlen,
@@ -843,12 +845,13 @@
 
 /** Invert crypto_pk_public_hybrid_encrypt. */
 int crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env,
-                                     unsigned char *to,
-                                     const unsigned char *from,
-                                     int fromlen,
+                                     char *to,
+                                     const char *from,
+                                     size_t fromlen,
                                      int padding, int warnOnFailure)
 {
-  int overhead, pkeylen, outlen, r;
+  int overhead, outlen, r;
+  size_t pkeylen;
   crypto_cipher_env_t *cipher = NULL;
   char buf[PK_BYTES+1];
 
@@ -913,7 +916,7 @@
 /** Decode an ASN.1-encoded public key from <b>str</b>; return the result on
  * success and NULL on failure.
  */
-crypto_pk_env_t *crypto_pk_asn1_decode(const char *str, int len)
+crypto_pk_env_t *crypto_pk_asn1_decode(const char *str, size_t len)
 {
   RSA *rsa;
   unsigned char *buf;
@@ -955,7 +958,7 @@
     free(buf);
     return -1;
   }
-  if (crypto_digest(digest_out, buf, len) < 0) {
+  if (crypto_digest(digest_out, (char*)buf, len) < 0) {
     free(buf);
     return -1;
   }
@@ -976,8 +979,8 @@
 int
 crypto_pk_get_fingerprint(crypto_pk_env_t *pk, char *fp_out, int add_space)
 {
-  unsigned char digest[DIGEST_LEN];
-  unsigned char hexdigest[HEX_DIGEST_LEN+1];
+  char digest[DIGEST_LEN];
+  char hexdigest[HEX_DIGEST_LEN+1];
   if (crypto_pk_get_digest(pk, digest)) {
     return -1;
   }
@@ -1025,7 +1028,7 @@
  * CIPHER_KEY_LEN bytes of <b>key</b>. Does not initialize the cipher.
  * Return 0 on success, -1 on failure.
  */
-int crypto_cipher_set_key(crypto_cipher_env_t *env, const unsigned char *key)
+int crypto_cipher_set_key(crypto_cipher_env_t *env, const char *key)
 {
   tor_assert(env);
   tor_assert(key);
@@ -1040,7 +1043,7 @@
 
 /** Return a pointer to the key set for the cipher in <b>env</b>.
  */
-const unsigned char *crypto_cipher_get_key(crypto_cipher_env_t *env)
+const char *crypto_cipher_get_key(crypto_cipher_env_t *env)
 {
   return env->key;
 }
@@ -1072,8 +1075,8 @@
  * On failure, return -1.
  */
 int
-crypto_cipher_encrypt(crypto_cipher_env_t *env, unsigned char *to,
-                      const unsigned char *from, unsigned int fromlen)
+crypto_cipher_encrypt(crypto_cipher_env_t *env, char *to,
+                      const char *from, size_t fromlen)
 {
   tor_assert(env);
   tor_assert(env->cipher);
@@ -1090,8 +1093,8 @@
  * On failure, return -1.
  */
 int
-crypto_cipher_decrypt(crypto_cipher_env_t *env, unsigned char *to,
-                      const unsigned char *from, unsigned int fromlen)
+crypto_cipher_decrypt(crypto_cipher_env_t *env, char *to,
+                      const char *from, size_t fromlen)
 {
   tor_assert(env);
   tor_assert(from);
@@ -1126,11 +1129,11 @@
  * <b>m</b>.  Write the DIGEST_LEN byte result into <b>digest</b>.
  * Return 0 on success, -1 on failure.
  */
-int crypto_digest(unsigned char *digest, const unsigned char *m, int len)
+int crypto_digest(char *digest, const char *m, size_t len)
 {
   tor_assert(m);
   tor_assert(digest);
-  return (SHA1(m,len,digest) == NULL);
+  return (SHA1((const unsigned char*)m,len,(unsigned char*)digest) == NULL);
 }
 
 struct crypto_digest_env_t {
@@ -1178,7 +1181,7 @@
 void crypto_digest_get_digest(crypto_digest_env_t *digest,
                               char *out, size_t out_len)
 {
-  static char r[DIGEST_LEN];
+  static unsigned char r[DIGEST_LEN];
   SHA_CTX tmpctx;
   tor_assert(digest);
   tor_assert(out);
@@ -1337,7 +1340,7 @@
     return -1;
 
   memset(pubkey, 0, pubkey_len);
-  BN_bn2bin(dh->dh->pub_key, pubkey+(pubkey_len-bytes));
+  BN_bn2bin(dh->dh->pub_key, (unsigned char*)(pubkey+(pubkey_len-bytes)));
 
   return 0;
 }
@@ -1358,8 +1361,8 @@
                              const char *pubkey, size_t pubkey_len,
                              char *secret_out, size_t secret_bytes_out)
 {
-  unsigned char hash[DIGEST_LEN];
-  unsigned char *secret_tmp = NULL;
+  char hash[DIGEST_LEN];
+  char *secret_tmp = NULL;
   BIGNUM *pubkey_bn = NULL;
   size_t secret_len=0;
   unsigned int i;
@@ -1367,10 +1370,10 @@
   tor_assert(dh);
   tor_assert(secret_bytes_out/DIGEST_LEN <= 255);
 
-  if (!(pubkey_bn = BN_bin2bn(pubkey, pubkey_len, NULL)))
+  if (!(pubkey_bn = BN_bin2bn((const unsigned char*)pubkey, pubkey_len, NULL)))
     goto error;
   secret_tmp = tor_malloc(crypto_dh_get_bytes(dh)+1);
-  result = DH_compute_key(secret_tmp, pubkey_bn, dh->dh);
+  result = DH_compute_key((unsigned char*)secret_tmp, pubkey_bn, dh->dh);
   if (result < 0) {
     log_fn(LOG_WARN,"DH_compute_key() failed.");
     goto error;
@@ -1475,11 +1478,11 @@
 /** Write n bytes of strong random data to <b>to</b>. Return 0 on
  * success, -1 on failure.
  */
-int crypto_rand(unsigned char *to, unsigned int n)
+int crypto_rand(char *to, size_t n)
 {
   int r;
   tor_assert(to);
-  r = RAND_bytes(to, n);
+  r = RAND_bytes((unsigned char*)to, n);
   if (r == 0)
     crypto_log_errors(LOG_WARN, "generating random data");
   return (r == 1) ? 0 : -1;
@@ -1488,10 +1491,10 @@
 /** Write n bytes of pseudorandom data to <b>to</b>. Return 0 on
  * success, -1 on failure.
  */
-void crypto_pseudo_rand(unsigned char *to, unsigned int n)
+void crypto_pseudo_rand(char *to, size_t n)
 {
   tor_assert(to);
-  if (RAND_pseudo_bytes(to, n) == -1) {
+  if (RAND_pseudo_bytes((unsigned char*)to, n) == -1) {
     log_fn(LOG_ERR, "RAND_pseudo_bytes failed unexpectedly.");
     crypto_log_errors(LOG_WARN, "generating random data");
     exit(1);
@@ -1512,7 +1515,7 @@
    */
   cutoff = UINT_MAX - (UINT_MAX%max);
   while (1) {
-    crypto_pseudo_rand((unsigned char*) &val, sizeof(val));
+    crypto_pseudo_rand((char*)&val, sizeof(val));
     if (val < cutoff)
       return val % max;
   }
@@ -1548,8 +1551,8 @@
     return -1;
 
   EVP_EncodeInit(&ctx);
-  EVP_EncodeUpdate(&ctx, dest, &len, (char*) src, srclen);
-  EVP_EncodeFinal(&ctx, dest+len, &ret);
+  EVP_EncodeUpdate(&ctx, (unsigned char*)dest, &len, (unsigned char*)src, srclen);
+  EVP_EncodeFinal(&ctx, (unsigned char*)(dest+len), &ret);
   ret += len;
   return ret;
 }
@@ -1577,8 +1580,8 @@
     return -1;
 
   EVP_DecodeInit(&ctx);
-  EVP_DecodeUpdate(&ctx, dest, &len, (char*) src, srclen);
-  EVP_DecodeFinal(&ctx, dest, &ret);
+  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.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- crypto.h	1 Apr 2005 20:15:54 -0000	1.60
+++ crypto.h	7 May 2005 05:55:05 -0000	1.61
@@ -73,53 +73,53 @@
 
 int crypto_pk_check_key(crypto_pk_env_t *env);
 int crypto_pk_cmp_keys(crypto_pk_env_t *a, crypto_pk_env_t *b);
-int crypto_pk_keysize(crypto_pk_env_t *env);
+size_t crypto_pk_keysize(crypto_pk_env_t *env);
 crypto_pk_env_t *crypto_pk_dup_key(crypto_pk_env_t *orig);
 
-int crypto_pk_public_encrypt(crypto_pk_env_t *env, unsigned char *to,
-                             const unsigned char *from, int fromlen, int padding);
-int crypto_pk_private_decrypt(crypto_pk_env_t *env, unsigned char *to,
-                              const unsigned char *from, int fromlen,
+int crypto_pk_public_encrypt(crypto_pk_env_t *env, char *to,
+                             const char *from, size_t fromlen, int padding);
+int crypto_pk_private_decrypt(crypto_pk_env_t *env, char *to,
+                              const char *from, size_t fromlen,
                               int padding, int warnOnFailure);
-int crypto_pk_public_checksig(crypto_pk_env_t *env, unsigned char *to,
-                              const unsigned char *from, int fromlen);
-int crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const unsigned char *data,
-                                     int datalen, const unsigned char *sig, int siglen);
-int crypto_pk_private_sign(crypto_pk_env_t *env, unsigned char *to,
-                           const unsigned char *from, int fromlen);
-int crypto_pk_private_sign_digest(crypto_pk_env_t *env, unsigned char *to,
-                                  const unsigned char *from, int fromlen);
-int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env, unsigned char *to,
-                                    const unsigned char *from, int fromlen,
+int crypto_pk_public_checksig(crypto_pk_env_t *env, char *to,
+                              const char *from, size_t fromlen);
+int crypto_pk_public_checksig_digest(crypto_pk_env_t *env, const char *data,
+                                     int datalen, const char *sig, int siglen);
+int crypto_pk_private_sign(crypto_pk_env_t *env, char *to,
+                           const char *from, size_t fromlen);
+int crypto_pk_private_sign_digest(crypto_pk_env_t *env, char *to,
+                                  const char *from, size_t fromlen);
+int crypto_pk_public_hybrid_encrypt(crypto_pk_env_t *env, char *to,
+                                    const char *from, size_t fromlen,
                                     int padding, int force);
-int crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env, unsigned char *to,
-                                     const unsigned char *from, int fromlen,
+int crypto_pk_private_hybrid_decrypt(crypto_pk_env_t *env, char *to,
+                                     const char *from, size_t fromlen,
                                      int padding, int warnOnFailure);
 
 int crypto_pk_asn1_encode(crypto_pk_env_t *pk, char *dest, int dest_len);
-crypto_pk_env_t *crypto_pk_asn1_decode(const char *str, int len);
+crypto_pk_env_t *crypto_pk_asn1_decode(const char *str, size_t len);
 int crypto_pk_get_digest(crypto_pk_env_t *pk, char *digest_out);
 int crypto_pk_get_fingerprint(crypto_pk_env_t *pk, char *fp_out,int add_space);
 int crypto_pk_check_fingerprint_syntax(const char *s);
 
 /* symmetric crypto */
 int crypto_cipher_generate_key(crypto_cipher_env_t *env);
-int crypto_cipher_set_key(crypto_cipher_env_t *env, const unsigned char *key);
-const unsigned char *crypto_cipher_get_key(crypto_cipher_env_t *env);
+int crypto_cipher_set_key(crypto_cipher_env_t *env, const char *key);
+const char *crypto_cipher_get_key(crypto_cipher_env_t *env);
 int crypto_cipher_encrypt_init_cipher(crypto_cipher_env_t *env);
 int crypto_cipher_decrypt_init_cipher(crypto_cipher_env_t *env);
 
-int crypto_cipher_encrypt(crypto_cipher_env_t *env, unsigned char *to,
-                          const unsigned char *from, unsigned int fromlen);
-int crypto_cipher_decrypt(crypto_cipher_env_t *env, unsigned char *to,
-                          const unsigned char *from, unsigned int fromlen);
+int crypto_cipher_encrypt(crypto_cipher_env_t *env, char *to,
+                          const char *from, size_t fromlen);
+int crypto_cipher_decrypt(crypto_cipher_env_t *env, char *to,
+                          const char *from, size_t fromlen);
 
 /* only implemented for CRYPTO_CIPHER_AES_CTR */
 int crypto_cipher_rewind(crypto_cipher_env_t *env, long delta);
 int crypto_cipher_advance(crypto_cipher_env_t *env, long delta);
 
 /* SHA-1 */
-int crypto_digest(unsigned char *digest, const unsigned char *m, int len);
+int crypto_digest(char *digest, const char *m, size_t len);
 crypto_digest_env_t *crypto_new_digest_env(void);
 void crypto_free_digest_env(crypto_digest_env_t *digest);
 void crypto_digest_add_bytes(crypto_digest_env_t *digest, const char *data,
@@ -143,8 +143,8 @@
 
 /* random numbers */
 int crypto_seed_rng(void);
-int crypto_rand(unsigned char *to, unsigned int n);
-void crypto_pseudo_rand(unsigned char *to, unsigned int n);
+int crypto_rand(char *to, size_t n);
+void crypto_pseudo_rand(char *to, size_t n);
 int crypto_pseudo_rand_int(unsigned int max);
 
 struct smartlist_t;

Index: torgzip.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/torgzip.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- torgzip.c	1 Apr 2005 20:15:54 -0000	1.15
+++ torgzip.c	7 May 2005 05:55:05 -0000	1.16
@@ -94,7 +94,7 @@
   out_size = in_len / 2;
   if (out_size < 1024) out_size = 1024;
   *out = tor_malloc(out_size);
-  stream->next_out = *out;
+  stream->next_out = (unsigned char*)*out;
   stream->avail_out = out_size;
 
   while (1) {
@@ -110,7 +110,7 @@
         offset = stream->next_out - ((unsigned char*)*out);
         out_size *= 2;
         *out = tor_realloc(*out, out_size);
-        stream->next_out = *out + offset;
+        stream->next_out = (unsigned char*)(*out + offset);
         stream->avail_out = out_size - offset;
         break;
       default:
@@ -179,7 +179,7 @@
   if (out_size < 1024) out_size = 1024;
 
   *out = tor_malloc(out_size);
-  stream->next_out = *out;
+  stream->next_out = (unsigned char*)*out;
   stream->avail_out = out_size;
 
   while (1) {
@@ -195,7 +195,7 @@
         offset = stream->next_out - ((unsigned char*)*out);
         out_size *= 2;
         *out = tor_realloc(*out, out_size);
-        stream->next_out = *out + offset;
+        stream->next_out = (unsigned char*)(*out + offset);
         stream->avail_out = out_size - offset;
         break;
       default:

Index: tortls.c
===================================================================
RCS file: /home/or/cvsroot/tor/src/common/tortls.c,v
retrieving revision 1.93
retrieving revision 1.94
diff -u -d -r1.93 -r1.94
--- tortls.c	23 Apr 2005 20:35:38 -0000	1.93
+++ tortls.c	7 May 2005 05:55:05 -0000	1.94
@@ -221,10 +221,10 @@
     goto error;
   if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name, nid, MBSTRING_ASC,
-                                   (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,
-                                   (char*)cname, -1, -1, 0))) goto error;
+                                   (unsigned char*)cname, -1, -1, 0))) goto error;
   if (!(X509_set_subject_name(x509, name)))
     goto error;
 
@@ -232,10 +232,10 @@
     goto error;
   if ((nid = OBJ_txt2nid("organizationName")) == NID_undef) goto error;
   if (!(X509_NAME_add_entry_by_NID(name_issuer, nid, MBSTRING_ASC,
-                                   (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,
-                                (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;
 



More information about the tor-commits mailing list