Commit Graph

637 Commits

Author SHA1 Message Date
Nick Mathewson
5e80944c52 Use token-pasting magic to make nested SMARTLIST_FOREACH work.
svn:r2526
2004-10-15 04:45:47 +00:00
Nick Mathewson
2fb08fe46c add documentation for smartlist_join_strings
svn:r2524
2004-10-15 03:55:02 +00:00
Nick Mathewson
c5964d6738 Basic string-join functionality
svn:r2521
2004-10-14 19:51:47 +00:00
Nick Mathewson
100b10473a fix tab/space in torgzip.h
svn:r2493
2004-10-14 04:31:16 +00:00
Nick Mathewson
a4ef916b8e fix tab/space in torgzip.c
svn:r2492
2004-10-14 04:24:42 +00:00
Nick Mathewson
1c9426d6e0 Build without warnings on mac gcc 3.3
svn:r2487
2004-10-14 03:18:14 +00:00
Roger Dingledine
69830afc16 and another one
svn:r2484
2004-10-14 02:49:48 +00:00
Roger Dingledine
5f4a390b33 oh, and some more in common/
svn:r2483
2004-10-14 02:48:57 +00:00
Roger Dingledine
918ce7a084 a few more ints to size_ts
svn:r2461
2004-10-13 05:54:58 +00:00
Roger Dingledine
fe54bd00b9 ok, vim isn't the greatest editor in the world
svn:r2457
2004-10-12 20:28:53 +00:00
Roger Dingledine
a7d858bd6e start the great migration from int to size_t
and clean some deadweight from util.h


svn:r2455
2004-10-12 20:20:19 +00:00
Nick Mathewson
19da1f36c2 Make a bounds-checking replacement for strtol with slightly easier error-checking in the common case
svn:r2452
2004-10-12 19:32:41 +00:00
Roger Dingledine
1c757b917d fix signed/unsigned comparison, plus typo
svn:r2451
2004-10-12 19:09:40 +00:00
Nick Mathewson
e7241044e8 Better bounds checking on parsed ints
svn:r2450
2004-10-12 19:01:53 +00:00
Nick Mathewson
a91fc48b39 Note byte-order on result for parse_addr_port()
svn:r2444
2004-10-12 16:02:15 +00:00
Nick Mathewson
8b037509f3 Add functions to parse addr[:port] consistently
svn:r2440
2004-10-12 15:48:30 +00:00
Roger Dingledine
2bcd0f34f5 fix compile error: move variable declarations before code
svn:r2430
2004-10-08 05:43:28 +00:00
Nick Mathewson
6c970aec94 Turn tor_strpartion into a swiss-army-knife function, so it can terminate or not-terminate appropriately.
svn:r2429
2004-10-07 21:37:06 +00:00
Nick Mathewson
7b98fb58eb More complete docs for crypto.c; factor out string partitioning code
svn:r2427
2004-10-07 20:58:53 +00:00
Nick Mathewson
ce3162d035 Make base-64-encoded DER work, including workaround for ugly openssl misfeature that makes base64 decoding fail when you strip out the newlines.
svn:r2423
2004-10-07 03:11:42 +00:00
Nick Mathewson
b56bb39ed6 Add a function to remove a set of characters from a string
svn:r2420
2004-10-06 13:26:37 +00:00
Nick Mathewson
8cca36d26a Implement (temporarily) a base64-encoded-DER format for RSA keys; make it easier to generate fingerprints with no space
svn:r2419
2004-10-06 13:26:10 +00:00
Roger Dingledine
1e3b9e7d31 make the warn message better for reading short files
svn:r2385
2004-09-28 08:40:03 +00:00
Nick Mathewson
09586ef712 Make read_all distinguish between error and EOF; read_file_to_string should only check bytes read against st_size when in binary mode.
svn:r2375
2004-09-26 16:51:31 +00:00
Roger Dingledine
8385fdb590 make our tor_assert actually work when it's going to be triggered,
rather than seg fault


svn:r2368
2004-09-23 05:02:51 +00:00
Roger Dingledine
a1979800ab bugfix on the bugfix
actually unlink the log entry.

ok, that wasn't cleverly hidden enough. let's try again.


svn:r2367
2004-09-23 04:59:02 +00:00
Roger Dingledine
f753f6f0e2 bugfix: when we run out of disk space, or other log writing error,
don't crash. just stop logging to that log and continue.

nick, can you find the bug i've cleverly hidden in this commit?


svn:r2365
2004-09-23 03:51:45 +00:00
Nick Mathewson
93f085c4a2 Stop using openssl functions that rely on stdio; they can apparently lead to linker grief on win32.
svn:r2354
2004-09-21 04:55:43 +00:00
Roger Dingledine
8954cd91ce LOG_ERR is for when we're going to exit
svn:r2348
2004-09-10 21:39:53 +00:00
Nick Mathewson
0ef85f6dba Some platforms have weird translations when you open files in "test" mode; make read/write_str_to_file aware.
svn:r2336
2004-09-08 07:16:34 +00:00
Nick Mathewson
b6798866d0 Idiot-proof uncompress; make sure it always nul-terminates its output. Also, make all compression methods nonzero.
svn:r2334
2004-09-08 06:47:33 +00:00
Nick Mathewson
f311206d1d Make split function smarter; add a strcmpstart function so we can stop bungling strcmp(x, y, strlen(y));
svn:r2325
2004-09-02 18:25:50 +00:00
Nick Mathewson
3590eb535a Add basic wrappers for zlib/gzip
svn:r2324
2004-09-02 18:22:51 +00:00
Nick Mathewson
31b81650b7 Define LONG_MAX and UINT_MAX when they are missing
svn:r2317
2004-08-25 19:16:18 +00:00
Roger Dingledine
f91c552af7 fix a seg fault on solaris
svn:r2313
2004-08-25 17:37:00 +00:00
Roger Dingledine
444a01610c make the compile work (and not complain) on sunos 5.9
svn:r2312
2004-08-25 17:31:47 +00:00
Roger Dingledine
d91cacb839 agree with nick: this legal-chars-in-filename stuff gets us nothing
svn:r2310
2004-08-24 21:57:12 +00:00
Nick Mathewson
015232bd39 As far as I can tell, CONFIG_LEGAL_FILENAME_CHARACTERS is both pointless and broken. #if it out, pending agreement from arma. This fixes a bug on win32 that rejected paths with a : in them.
svn:r2309
2004-08-24 20:48:22 +00:00
Nick Mathewson
7979c0277d Workaround for oddity in cygwin autoconf
svn:r2301
2004-08-19 17:21:17 +00:00
Roger Dingledine
7304ac1d6f tweak the [...truncated] string again
svn:r2289
2004-08-18 11:21:50 +00:00
Roger Dingledine
40f9f94794 don't add a spurious newline before [truncated]
svn:r2282
2004-08-18 08:52:12 +00:00
Nick Mathewson
86980cf6e2 Functions to test nickname validity
svn:r2269
2004-08-18 04:44:24 +00:00
Nick Mathewson
7cb93e5bb6 Move string-splitting into a separate function
svn:r2263
2004-08-17 21:06:36 +00:00
Nick Mathewson
8566bbb489 Add strmap_isempty
svn:r2250
2004-08-17 06:28:34 +00:00
Nick Mathewson
15a903b21c Convenience function to do a strcmp on each member of a smartlist of strings
svn:r2243
2004-08-16 20:46:00 +00:00
Nick Mathewson
ebf2d275bf End truncated log entries with [truncated]
svn:r2235
2004-08-15 20:13:07 +00:00
Nick Mathewson
6453a25567 Add replace_file to util.[ch] to survive stupidity of windows rename call
svn:r2208
2004-08-09 04:28:25 +00:00
Nick Mathewson
f6cc218742 Refactor ISO-style (yyyy-mm-dd hh:mm:ss) time parsing into util.c; rename format/parse_rfc1123_time; make rephist remember used bandwidth; published used bandwidth in descriptors in 15-minute chunks. Breaks unittests.
svn:r2182
2004-08-07 02:46:16 +00:00
Nick Mathewson
2091dab7f4 fencepost
svn:r2178
2004-08-07 01:18:02 +00:00
Nick Mathewson
380f32f07d hex_encode is obsoleted by base16_encode, and never actually worked in the first place. (Thanks to Timo Lindfors for noticing the never-actually-worked part.)
svn:r2175
2004-08-07 01:03:33 +00:00
Nick Mathewson
14d5478f29 Add functions to format and parse RFC1123-style times, for HTTP protocol.
svn:r2129
2004-08-04 01:11:15 +00:00
Nick Mathewson
5b61dd0457 Fix all warnings on win32 build
svn:r2127
2004-08-03 23:57:05 +00:00
Nick Mathewson
849e998ac6 It is possible to have struct timeval but not gettimeofday.
svn:r2125
2004-08-03 23:31:22 +00:00
Roger Dingledine
5525606653 check return value of fclose while writing to disk, since it might
return out-of-space, etc


svn:r2122
2004-07-23 21:25:28 +00:00
Roger Dingledine
3aaba3b16e tell the user what time _they_ are too, when a cert is expired
svn:r2114
2004-07-22 23:06:28 +00:00
Nick Mathewson
7119345fbb Fix base16_decode; trashing the stack is rude.
svn:r2110
2004-07-22 21:41:50 +00:00
Roger Dingledine
7459d067a5 now base16_encode() and base32_encode() can't ever fail
svn:r2103
2004-07-22 08:30:06 +00:00
Nick Mathewson
38d8e36919 Make tor_tls_new variant use alternative (certless) context
svn:r2096
2004-07-22 04:53:34 +00:00
Roger Dingledine
156cfb00fa oh, and it should compile too
svn:r2088
2004-07-21 22:34:32 +00:00
Roger Dingledine
6e571c8c4c make base16_encode() fail more obviously when it fails
svn:r2087
2004-07-21 22:33:26 +00:00
Roger Dingledine
cdb98cf04a fix our tls handshake chain cert bug
svn:r2086
2004-07-21 22:11:11 +00:00
Nick Mathewson
c83f0e948f Log certificate lifetime on failure.
svn:r2083
2004-07-21 17:59:24 +00:00
Nick Mathewson
2d514037b7 Log number of certs in wrong-length chains
svn:r2078
2004-07-21 03:32:56 +00:00
Nick Mathewson
334de84cbe Misc small code cleanups; remove exit_server_mode(); change tor_tls_verify behavior
svn:r2073
2004-07-21 00:44:04 +00:00
Nick Mathewson
06c11a61ce When faking gettimeofday with ftime, do it right.
svn:r2068
2004-07-20 21:23:50 +00:00
Roger Dingledine
19deb93c29 more useful warning messages
(fixed because the old ones confused a user)


svn:r2055
2004-07-19 19:49:03 +00:00
Nick Mathewson
bc36db351f Resolve all DOCDOCs.
svn:r2050
2004-07-16 22:23:18 +00:00
Nick Mathewson
9364c40afd Add generic expand_filename function to handle expanding ~/
svn:r2047
2004-07-15 02:00:43 +00:00
Roger Dingledine
7e344f191a add is_local_IP() function to help distinguish which bandwidth "matters"
svn:r2040
2004-07-13 16:57:37 +00:00
Roger Dingledine
17e5f25214 trivial punctuation tweak
svn:r2027
2004-07-12 16:51:28 +00:00
Nick Mathewson
88451ce25b Yes, I did mean "else if".
svn:r2016
2004-07-06 23:29:34 +00:00
Nick Mathewson
d5e275ddf4 Fix bug reported by peter palfrader: an empty address is unresolvable, but not an occasion for an assertion failure in a dnsworker.
svn:r2015
2004-07-06 23:25:21 +00:00
Nick Mathewson
7d8de8cd10 More digest/nickname fixes
svn:r2000
2004-07-02 23:40:03 +00:00
Nick Mathewson
541add90a1 Track routers by hash of identity key; use hex hash of identity key in place of nickname; accept (and use) hash of identity key in EXTEND cells.
svn:r1994
2004-07-01 01:16:59 +00:00
Nick Mathewson
b1e9adf056 Always use get_data_directory() instead of options.DataDirectory; fix a memory leak in router.c
svn:r1991
2004-06-30 16:37:08 +00:00
Nick Mathewson
653aaeef08 Always log version when starting tor.
svn:r1990
2004-06-30 16:35:11 +00:00
Nick Mathewson
8aec3a7301 Implement several 008pre1 items: needs more testing
svn:r1981
2004-06-21 04:37:27 +00:00
Roger Dingledine
43295ca61f if datadirectory isn't owned by this uid, tell the user he must
fix it before he can proceed.


svn:r1968
2004-06-13 11:28:32 +00:00
Nick Mathewson
0d1b4b5024 Unbork windows whitespace
svn:r1949
2004-06-05 01:56:54 +00:00
Nick Mathewson
17b5b3685f Make tor build on win32 again; handle locking for server
svn:r1948
2004-06-05 01:50:35 +00:00
Roger Dingledine
4db9e9aa8a define FD_SETSIZE in all cases, not just win32
svn:r1937
2004-06-02 19:44:23 +00:00
Nick Mathewson
605e10a650 Stop multiplying logs on sighup.
svn:r1936
2004-06-02 19:18:37 +00:00
Roger Dingledine
1ef411fefd use sys/param.h if it's there
svn:r1927
2004-06-01 17:03:01 +00:00
Roger Dingledine
8ca162c472 put a comment reminding us that we do hashes in software only
svn:r1925
2004-06-01 16:36:56 +00:00
Roger Dingledine
1841aa456b rik's patch to not complain about freebsd's bug
svn:r1921
2004-05-26 20:27:54 +00:00
Roger Dingledine
f875db1821 it looks like parse_log_level() was never taught about WARN?
svn:r1917
2004-05-21 12:38:52 +00:00
Roger Dingledine
c278ff3bc2 minor comment patch
svn:r1916
2004-05-21 12:30:07 +00:00
Nick Mathewson
ccb825128e Tinker with log behavior: never send error messages about logs into the bitbucket
svn:r1912
2004-05-20 19:47:28 +00:00
Nick Mathewson
9d2cd7fc6e Allow multiple logfiles at different severity ranges
svn:r1899
2004-05-19 20:07:08 +00:00
Nick Mathewson
7511fbf993 Resolve some XXXs
svn:r1889
2004-05-18 15:35:21 +00:00
Roger Dingledine
6dc576bab7 bugfix: our integrity-checking digest was checking only the most
recent cell, not the previous cells like we'd thought.

this change is backward incompatible.


svn:r1868
2004-05-15 23:49:41 +00:00
Nick Mathewson
9c3fba5c3b Not every RSA decrypt should warn on failure.
svn:r1853
2004-05-12 19:30:28 +00:00
Roger Dingledine
3cdf2d67da it's amazing what a bit of punctuation can do for appearances
svn:r1843
2004-05-10 10:27:54 +00:00
Roger Dingledine
5dd9e60231 doxygen markup for common/*.h
svn:r1840
2004-05-10 07:54:13 +00:00
Nick Mathewson
c0ea93337d Doxygenate common.
svn:r1829
2004-05-10 03:53:24 +00:00
Nick Mathewson
93576d5289 Add doxygen markup for util and buffers
svn:r1820
2004-05-07 17:04:12 +00:00
Nick Mathewson
6cfa2835a1 Fix bug in stream position adjustment
svn:r1801
2004-05-06 19:51:50 +00:00
Nick Mathewson
ebe8fa0d62 Use correct aes-ctr implementation in mainline, too.
svn:r1800
2004-05-06 19:41:33 +00:00
Nick Mathewson
8aebd83a0e Add intptr_t and uintptr_t to torint.h
svn:r1794
2004-05-05 20:26:35 +00:00
Nick Mathewson
d49d3dcc7b Make non-fake tor_poll robust against -1 fds
svn:r1787
2004-05-05 01:01:34 +00:00
Nick Mathewson
08ac3c7190 Fix mac compile
svn:r1782
2004-05-04 18:17:28 +00:00
Nick Mathewson
e6f3bf2a68 tor_assert(), not assert()
svn:r1777
2004-05-02 20:27:48 +00:00
Nick Mathewson
3dd1ef8783 Fix windows compile.
svn:r1776
2004-05-02 20:23:35 +00:00
Nick Mathewson
af08c4f878 Working strerror for windows socket errors, plus some snide comments.
svn:r1775
2004-05-02 20:18:21 +00:00
Nick Mathewson
a187d3e0b6 Assert that we never try to fakepoll on sock -1.
svn:r1774
2004-05-02 20:17:43 +00:00
Roger Dingledine
1558fb7650 some patches on the patches
svn:r1761
2004-05-01 23:29:20 +00:00
Nick Mathewson
4dc30ea3c8 Remove bogus */ so util.c compiles
svn:r1759
2004-05-01 21:50:53 +00:00
Nick Mathewson
9a041591ac Finish documenting the functions in common
svn:r1758
2004-05-01 21:41:23 +00:00
Nick Mathewson
908ccb9dcd Handle windows socket errors correctly; comment most of common.
svn:r1756
2004-05-01 20:46:28 +00:00
Roger Dingledine
4b316b4a7d some cosmetic fixes
svn:r1747
2004-04-29 02:52:49 +00:00
Nick Mathewson
5a9b144092 Oops -- the Windows function is closesocket, not socketclose
svn:r1746
2004-04-28 21:17:42 +00:00
Nick Mathewson
9322641710 Use socketclose on windows as appropriate; end pid files with newline
svn:r1745
2004-04-28 21:14:56 +00:00
Nick Mathewson
ddb15b8f67 Remove IVs from cipher code, since AES-ctr has none.
svn:r1742
2004-04-28 20:31:32 +00:00
Roger Dingledine
5d1510883e use nick's _ARRAYSIZE abstraction
svn:r1741
2004-04-28 20:22:37 +00:00
Roger Dingledine
47dc5cd1c8 nick, is this what you meant?
svn:r1740
2004-04-28 20:18:22 +00:00
Nick Mathewson
7055f837ab Make Tor build on win32 with VC6 without warnings.
svn:r1739
2004-04-28 20:13:21 +00:00
Nick Mathewson
ac622d94dc Workarounds for a couple of pieces of windows strangeness.
svn:r1734
2004-04-28 19:35:12 +00:00
Roger Dingledine
4e0dd5bd33 some compilers don't like an array of length zero
nick: should we remove support for IVs for now, since we don't
use them and don't plan to use them?


svn:r1732
2004-04-27 23:50:35 +00:00
Nick Mathewson
873564ea9c Some versions of openssl have an SSL_pending function that erroneously
returns bytes when there is a non-application record pending.

I have no idea when/why this would even happen, but let's catch it and
make sure tor_tls_get_pending_bytes stays correct.


svn:r1727
2004-04-26 23:19:21 +00:00
Nick Mathewson
d6d4b93863 Remove spurious semi
svn:r1724
2004-04-26 23:01:15 +00:00
Nick Mathewson
ad07c62938 Add a macro to catch unhandled openssl errors.
svn:r1723
2004-04-26 23:00:07 +00:00
Roger Dingledine
719bb5c0f3 log debug so nick can see it too
svn:r1721
2004-04-26 22:22:11 +00:00
Peter Palfrader
750211259b The dots are there so you see test doing something. Therefore we should flush them after printing
svn:r1720
2004-04-26 22:12:13 +00:00
Nick Mathewson
337f7a981f Include strerror(errno) with tls syscall errors
svn:r1718
2004-04-26 18:11:58 +00:00
Nick Mathewson
f6dbe5a0d4 Refactor crypto error handling to be more like TLS error handling:
crypto_perror is a no-no, since an operation can set more than one
error.

Also, fix a bug in the unix crypto_seed_rng: mixing stdio with
/dev/urandom is a bad idea, since fopen can make all kinds of weird
extraneous syscalls (mmap, fcntl, stat64, etc.) and since fread tends
to buffer data in big chunks, thus depleting the entropy pool.


svn:r1717
2004-04-26 18:09:50 +00:00
Nick Mathewson
b410dff6c0 Log pending TLS errors in a couple more places, in case they are possible.
svn:r1716
2004-04-26 16:52:47 +00:00
Nick Mathewson
0355d29e12 Call tls_log_errors at a more appropriate location; we can remove the other calls in tor_tls_verify once we are sure they never happen.
svn:r1709
2004-04-26 03:09:17 +00:00
Nick Mathewson
cb465160da Very blunt debugging code: log pending errors at start and end of tor_tls_verify
svn:r1707
2004-04-26 02:33:12 +00:00
Nick Mathewson
568a4d187a Check for machine/limits.h in addition to sys/limits.h
svn:r1705
2004-04-25 23:47:26 +00:00
Roger Dingledine
37192bd25e use tor_assert and PUBLIC_KEY_OK
but don't use tor_assert inside log.c, to avoid loops


svn:r1696
2004-04-25 19:59:38 +00:00
Nick Mathewson
e062ca046b Add a tor_assert macro that logs failed assertions.
svn:r1695
2004-04-25 19:37:39 +00:00
Nick Mathewson
70bbd0cafa Add assert on crypto_pk_write_private_key,and macros to make sure we have real keys
svn:r1694
2004-04-25 19:21:44 +00:00
Roger Dingledine
6a45028ccb don't warn when private_decrypt_hybrid fails
svn:r1689
2004-04-25 04:32:59 +00:00
Nick Mathewson
c44016e86e Merge flagday into main branch.
svn:r1683
2004-04-24 22:17:50 +00:00
Roger Dingledine
06a60c4fbb use the real socketpair if we've got it
now it's just windows that has to use the kludged one


svn:r1675
2004-04-19 21:31:32 +00:00
Roger Dingledine
a54ded2879 util.c uses LONG_MAX, needs another include on fbsd 5.x
svn:r1653
2004-04-17 06:35:03 +00:00
Roger Dingledine
4d380ea902 quiet a -l info that should be -l debug
svn:r1634
2004-04-15 22:08:37 +00:00
Nick Mathewson
306adfc8bd Fix two dumb leaks in crypto.c
svn:r1592
2004-04-12 05:27:38 +00:00
Nick Mathewson
aa7cfd93e5 Fix base32 implementation; make base32 implementation follow standard; add more tests for base32
svn:r1574
2004-04-08 20:56:33 +00:00
Nick Mathewson
024c059fae Force tor_malloc(0) to always be sane
svn:r1558
2004-04-08 03:05:08 +00:00
Roger Dingledine
47488fa525 allow 90 minutes of clock skew, not 30
svn:r1544
2004-04-08 01:08:56 +00:00
Nick Mathewson
8169da5c30 Don't use Tor version 0.0.5 for intro/rendezvous points. (We don't need
to worry about 0.0.4 or earlier, because nobody is running them any more.)


svn:r1533
2004-04-07 21:36:03 +00:00
Nick Mathewson
3d60cd1d61 Delete trailing whitespace and expand tabs; remove unused aes decrypt code
svn:r1522
2004-04-07 19:57:40 +00:00
Nick Mathewson
75c19716a8 Put ourself in router list; act accordingly.
svn:r1521
2004-04-07 19:46:27 +00:00
Nick Mathewson
f24519e4b9 Set correct address and port mappings on outgoing rendezvous connections
svn:r1513
2004-04-06 22:05:49 +00:00
Nick Mathewson
8b371c2aa5 router_choose_random_node wants a smartlist of routers, not of nicknames.
svn:r1510
2004-04-06 21:19:59 +00:00
Nick Mathewson
2fc106d210 Force hybrid encryption on for key negotiation
svn:r1509
2004-04-06 20:55:46 +00:00
Nick Mathewson
6290d027c9 Continue attack on magic numbers; use new crypto wrappers where possible
svn:r1504
2004-04-06 20:16:12 +00:00
Nick Mathewson
ce51a30adc Remove the last tab in non-contributed code
svn:r1503
2004-04-06 03:46:37 +00:00
Nick Mathewson
257d509b91 Document stuff, reduce magic numbers, add emacs magic
svn:r1502
2004-04-06 03:44:36 +00:00
Nick Mathewson
34633c1122 add more constants
svn:r1488
2004-04-05 20:52:16 +00:00
Nick Mathewson
12ede0a2c4 use the right variable when comparing hashes; maybe fix "Hash of session" bug
svn:r1481
2004-04-05 17:36:30 +00:00
Nick Mathewson
84b9e90d5f i2d_RSAPublicKey advances the pointer it receives past the ASN1-encoded string.
svn:r1478
2004-04-05 17:10:48 +00:00
Nick Mathewson
82cde03ddc Make it build on linux
svn:r1468
2004-04-03 04:08:54 +00:00
Nick Mathewson
b3c2b62a14 Make "common" no longer depend on or.h
svn:r1466
2004-04-03 04:05:12 +00:00
Nick Mathewson
d93ff0b82f Handle rendezvous relay cells
svn:r1464
2004-04-03 03:37:11 +00:00
Nick Mathewson
7451de5d97 Loops work better when they terminate. Non-terminating loops are easier
to diagnose when they don't trash the stack.


svn:r1460
2004-04-03 02:55:42 +00:00
Nick Mathewson
ffc58cd91a Build without warnings against openssl 0.9.6
svn:r1459
2004-04-03 02:43:09 +00:00
Nick Mathewson
137b577bbd Refactor the heck out of crypto interface: admit that we will stick with one ciphersuite at a time, make const things const, and stop putting openssl in the headers.
svn:r1458
2004-04-03 02:40:30 +00:00
Nick Mathewson
fc4d15baf6 Hide smartlist internals
svn:r1451
2004-04-03 00:58:54 +00:00
Nick Mathewson
e8345bfced refactor; start adding debugging logs to midpoint rend stuff
svn:r1445
2004-04-02 23:30:54 +00:00
Nick Mathewson
08d748b6b3 Implement rennd_services_init
svn:r1443
2004-04-02 23:01:00 +00:00
Nick Mathewson
cbbd13f789 Add new functions to wrap digest and sign/checksig.
svn:r1436
2004-04-01 22:10:33 +00:00
Nick Mathewson
56b3d67149 Separate "generate-DH-key" from "get-DH-key" without breaking old interface
svn:r1431
2004-04-01 20:04:54 +00:00
Nick Mathewson
35f531b94f Add helpful hybrid encryption functions
svn:r1423
2004-04-01 03:08:35 +00:00
Roger Dingledine
d7cb4d0ae6 make changes that ben laurie suggested
(ben, was this what you had in mind?)


svn:r1415
2004-03-31 22:41:25 +00:00
Nick Mathewson
b32440a028 Implement hidserv_XX functions; there is still an XXX in directory_handle_command
svn:r1404
2004-03-31 03:42:56 +00:00
Nick Mathewson
6ea61d5e0d Parse and generate service descriptors
svn:r1403
2004-03-31 02:07:38 +00:00
Nick Mathewson
93ab51e9ac Make smartlist Do What Arma Expects.
svn:r1401
2004-03-30 22:59:00 +00:00
Nick Mathewson
919a8f236e Resolve type-punning warnings
svn:r1399
2004-03-30 22:50:49 +00:00
Nick Mathewson
c31f5505da Jump through a hoop, suppress a warning
svn:r1398
2004-03-30 22:42:26 +00:00
Nick Mathewson
96a86ef14d Remove maximum-size field from smartlists
svn:r1397
2004-03-30 20:05:52 +00:00
Nick Mathewson
6ea95488d2 Add more key manipulation functions, and base32 functions, to crypto
svn:r1395
2004-03-30 19:47:32 +00:00
Nick Mathewson
abcf3d9341 Make smartlists start small and grow as needed.
svn:r1394
2004-03-30 19:25:43 +00:00
Roger Dingledine
0864d3f484 add in a 'notice' log level
svn:r1383
2004-03-30 03:15:23 +00:00
Nick Mathewson
b69f5f3e1b Add an autoconf test for whether unaligned int access is permitted.
It works on macos, and works correctly when I twiddle the test code to
generate a spurious segfault.  Will it work anywhere else?


svn:r1329
2004-03-21 04:14:06 +00:00
Nick Mathewson
0d8feba6d8 Add macros and functions to wrap memcpy/alignment logic.
svn:r1326
2004-03-21 02:01:17 +00:00
Roger Dingledine
d10fcc89ec make uname() more likely to work on solaris
(linux says 0 is success, solaris says 1 is success)


svn:r1322
2004-03-20 21:22:16 +00:00
Nick Mathewson
da9d5ccfda Add initial history-tracking backend code for reputation module. Not called or tested yet.
svn:r1310
2004-03-20 01:48:05 +00:00
Nick Mathewson
b0ef4e1143 Use strmap code for client DNS.
svn:r1309
2004-03-20 01:21:19 +00:00
Nick Mathewson
9199696182 Add some wrappers around SPLAY_* for the common map-from-string-to-X case.
It will probably be less blindingly fast than using SPLAY_* directly, but
only slightly so.


svn:r1306
2004-03-19 22:07:24 +00:00
Roger Dingledine
df3f37b84f getpid returns a pid_t. we all know that's an int. but solaris doesn't know.
svn:r1305
2004-03-19 21:34:04 +00:00
Roger Dingledine
c195f69058 isspace and friends take an int. solaris cares.
svn:r1303
2004-03-19 20:50:12 +00:00
Roger Dingledine
6438a5db08 ship strlcat and strlcpy with the tarball, but don't compile them
svn:r1297
2004-03-19 06:39:52 +00:00
Roger Dingledine
7648c6c0ea define INADDR_NONE so we compile on solaris
svn:r1295
2004-03-18 19:59:39 +00:00
Nick Mathewson
971b002d93 Include strlcpy and strlcat where not available, so our string ops can be less error-prone.
svn:r1289
2004-03-17 07:28:09 +00:00
Roger Dingledine
6a2821a7ff fix a byte order bug
svn:r1277
2004-03-15 04:00:11 +00:00
Roger Dingledine
f55ff5b8d2 teach us to recognize internal IPs
svn:r1271
2004-03-14 18:07:46 +00:00
Roger Dingledine
3ccd545c9a crash when our logs go bad
nick, can you think of a better response here?


svn:r1268
2004-03-14 15:50:00 +00:00
Roger Dingledine
45a3f6b97c more pesky tabs
svn:r1265
2004-03-12 13:02:16 +00:00
Nick Mathewson
976bacae94 Make all the other read/writes into recv/sends, except when they shouldn't be.
svn:r1260
2004-03-11 06:35:03 +00:00
Nick Mathewson
9b4203266e Make OP work on windows! (Also misc logging tweaks)
svn:r1258
2004-03-11 06:19:08 +00:00
Nick Mathewson
59e2c77824 Get entropy in windows.
svn:r1257
2004-03-11 05:14:06 +00:00
Nick Mathewson
2f103ccf6f Some stuff *should* be signed
svn:r1251
2004-03-10 06:57:57 +00:00
Nick Mathewson
0e5a134709 Fix DOS line endings; autoconfize checks for strptime and inet_aton
svn:r1248
2004-03-09 22:09:13 +00:00
Nick Mathewson
2da54de968 Make tor build on windows again. More work still needed
svn:r1247
2004-03-09 22:01:17 +00:00
Roger Dingledine
20f11f1800 clarifying comment for crypto_pk_get_fingerprint
svn:r1243
2004-03-08 00:11:37 +00:00
Roger Dingledine
08346f13f0 make parse_line_from_file fail rather than warn for malformed lines
svn:r1193
2004-03-02 04:59:52 +00:00
Nick Mathewson
5072488a95 make 'make test' exit(1) if a test fails.
svn:r1190
2004-03-01 06:45:32 +00:00
Roger Dingledine
5cf0b6224b bugfix: stop trying to write to a stderr that may not be there
also, tell start_daemon our desired cwd


svn:r1170
2004-02-28 23:21:29 +00:00
Nick Mathewson
67a273962a On OSX, decline to use the built-in select-baed poll wrapper, since it seems to sometimes not work.
svn:r1114
2004-02-20 23:41:45 +00:00
Roger Dingledine
f202d38191 patch from vicman to publish less platform information
svn:r1111
2004-02-18 21:23:50 +00:00
Roger Dingledine
c9d9b9b2a7 we define some big constant arrays but don't use them
svn:r1102
2004-02-18 03:17:35 +00:00
Roger Dingledine
c12a6f58b5 fix typo
svn:r1007
2004-01-20 02:14:12 +00:00
Nick Mathewson
793c65e60f Note discrepency between N bytes transmitted over TLS and actual bandwidth use; add 2 functions to help resolve.
svn:r986
2004-01-13 01:19:02 +00:00
Nick Mathewson
cacacfe2b1 Integrate new daemon code, adapted from submission by christian grothoff
svn:r969
2004-01-03 22:40:49 +00:00
Roger Dingledine
bc8c6732cb add crypto_cipher_rewind to reverse crypto_cipher_advance
svn:r957
2003-12-23 07:43:05 +00:00
Roger Dingledine
eb730c41c8 clean tabs, trailing whitespace
svn:r952
2003-12-17 21:14:13 +00:00
Roger Dingledine
389eb48690 document an openssl gotcha
svn:r947
2003-12-17 05:31:52 +00:00
Roger Dingledine
f3b165fdc0 change crypto_digest_new_env to crypto_new_digest_env
(and same with _free_)
to match our conventions
i think our conventions may be getting too ad hoc


svn:r940
2003-12-16 08:13:26 +00:00
Roger Dingledine
e358a362ee rename digest_copy to digest_dup, make it return, make gcc happier
svn:r939
2003-12-16 05:47:21 +00:00
Nick Mathewson
eeae6157ed Add more fine-grained SHA1 functionality.
svn:r937
2003-12-16 05:29:04 +00:00
Nick Mathewson
4885e90490 Make compile warning-free on cygwin
svn:r936
2003-12-15 21:35:52 +00:00
Roger Dingledine
a5aa80cc41 make --debuglogfile (or any second log file) work
svn:r935
2003-12-14 09:58:43 +00:00
Roger Dingledine
3465c4dee4 make it compile
svn:r923
2003-12-14 05:00:09 +00:00
Roger Dingledine
f4cb5d8c93 extend smartlist with _remove() and _subtract()
svn:r922
2003-12-14 04:57:47 +00:00
Roger Dingledine
444798dfb9 remove obsolete code
svn:r914
2003-12-14 00:11:48 +00:00
Roger Dingledine
4d3d99fa0c extend smartlist with a few smarter operations
svn:r910
2003-12-13 23:32:03 +00:00
Roger Dingledine
8222fe8e4f clean up some copyrights
svn:r907
2003-12-13 22:53:17 +00:00
Roger Dingledine
5458ca39e8 minor tweaks to the smartlist operations
svn:r903
2003-12-13 06:56:21 +00:00
Roger Dingledine
1ae84fcbc1 add a 'smartlist' building block that picks random elements from a list
svn:r897
2003-12-13 01:42:44 +00:00
Roger Dingledine
d23c66b041 make the license explicit on fakepoll.[ch]
svn:r895
2003-12-09 21:37:26 +00:00
Nick Mathewson
ac552573dd Make router/directory parsing nondestructive and more const-friendly
svn:r890
2003-12-08 23:45:37 +00:00
Roger Dingledine
05b9c35173 assert that nobody asks for a random number between 0 and -1
svn:r875
2003-12-03 08:08:07 +00:00
Nick Mathewson
5e9ba094bc Fix incorrect error message
svn:r862
2003-11-21 05:55:03 +00:00
Peter Palfrader
9a676b04dd Check that we can write to the logfile and log a warning to stderr if we can't
Move writing of pidfile after daemonizing, and also after setting the [ug]id:
This means that the tor user needs write priviliges to the pidfile location.
It needs it for unlinking the pidfile anyway.


svn:r846
2003-11-19 02:09:43 +00:00
Roger Dingledine
ec02f83f94 add a tor_malloc_zero wrapper: tor_malloc and memset 0
svn:r836
2003-11-18 08:20:09 +00:00
Nick Mathewson
dd16a9abcb Stop leaking X509 certs; those things are _nasty_ on the carpet
svn:r833
2003-11-18 06:52:25 +00:00
Roger Dingledine
cc8ce64cb2 fix trivial typo
svn:r808
2003-11-13 06:45:59 +00:00
Roger Dingledine
9358381d83 break out the string manipulation routines
svn:r804
2003-11-12 19:34:19 +00:00
Nick Mathewson
5e4b9c6b61 Remove minor biasing problem from crypto_pseudo_rand_int
svn:r799
2003-11-12 04:28:30 +00:00
Nick Mathewson
785f5cdac8 Make crypto_pseudo_rand* never fail.
svn:r797
2003-11-12 04:12:35 +00:00
Roger Dingledine
3d19a9b514 fix a bug in handling clock skew
svn:r785
2003-11-11 04:08:30 +00:00
Nick Mathewson
3c4b4c8cac Check in a working cross-platform timegm
svn:r779
2003-11-10 06:28:53 +00:00
Roger Dingledine
a27b570788 bugfix for win32 with lots of users
plus general cleanup on switch_id()


svn:r684
2003-10-27 10:26:44 +00:00
Nick Mathewson
faa0f7ffe7 Use daemon(3) function where available.
svn:r665
2003-10-23 14:28:44 +00:00
Nick Mathewson
71e5ad714b resolve warning
svn:r664
2003-10-23 14:27:53 +00:00
Nick Mathewson
6b79d8a7e9 Two-pronged attack at my overzealous skew fixes.
The problem was that the fixes had us generating TLS certs with a
2-day lifetime on the assumption that we'd rotate fairly often.  In
fact, we never rotate our TLS keys.

This patch fixes the situation in 2 ways:
   1. It bumps the default lifetime back up to one year until we get
      rotation in place.
   2. It changes tor_tls_context_new() so that it doesn't leak memory
      when you call it more than once.


svn:r663
2003-10-23 14:20:51 +00:00
Steven Hazel
4fef6f4566 switch_id() no longer tries to log the user name when it's calld on
Windows, since we don't know whether it's the user or the group that
was set.


svn:r659
2003-10-22 17:25:58 +00:00
Nick Mathewson
7604cfe61b Clock skew fixes.
Allow some slop (currently 3 minutes) when checking certificate validity.

Change certificate lifetime from 1 year to 2 days.  Since we
regenerate regularly (we regenerate regularly, right??), this
shouldn't be a problem.

Have directories reject descriptors published too far in the future
(currently 30 minutes).  If dirservs don't do this:
    0) Today is January 1, 2000.
    1) A very skewed server publishes descriptor X with a declared
       publication time of August 1, 2000.
    2) The directory includes X.
    3) Because of certificate lifetime issues, nobody can use the
       skewed server.
    4) The server fixes its skew, and goes to republish a new descriptor Y
       with publication time of January 1, 2000.
    5) But because the directory already has a "more recent" descriptor X,
       it rejects descriptor "Y" as superseded!

This patch should make step 2 go away.


svn:r658
2003-10-22 16:41:35 +00:00
Steven Hazel
4139c1c86a - fixed a bug in the id switching code -- setgid has to happen before
setuid, because after we setuid we don't have the priviledges we
  need to setgid anymore, duh.  merged switch_user() and
  switch_group() into switch_id(), since that code has to be wound
  together.

- return -1 from switch_id() if it's not defined to do anything else.

- moved daemoinize(), write_pidfile(), and switch_id() from main.c to
  util.c


svn:r656
2003-10-22 11:21:29 +00:00
Roger Dingledine
069227db5b introduce new tor_free() macro
svn:r643
2003-10-21 09:48:58 +00:00
Roger Dingledine
5f1750a288 include our own timegm() impl, since it's not portable
svn:r635
2003-10-20 20:19:59 +00:00
Roger Dingledine
dc85b7af3c warn, not err
svn:r630
2003-10-19 01:15:36 +00:00
Nick Mathewson
0ec2a34a1d Code to get nicknames from peer certs
svn:r627
2003-10-19 00:46:51 +00:00
Roger Dingledine
ec96419109 let tls tolerate reallocing the buf
and also remember the params for ssl_write if it returns wantread.


svn:r626
2003-10-19 00:39:48 +00:00
Roger Dingledine
c627ba2632 first steps toward a WANTWRITE SSL_write tls bug fix
how exactly the same do the arguments need to be? :(


svn:r625
2003-10-18 08:00:19 +00:00
Roger Dingledine
61e180ceb1 start to track down the 'peer has invalid cert' bug
svn:r623
2003-10-18 06:48:46 +00:00
Roger Dingledine
2093f60760 we've been stomping on memory while reading config
doesn't seem to have bitten us yet, but let's fix that :)


svn:r619
2003-10-18 01:28:39 +00:00
Roger Dingledine
82aa621b47 rewrite close_logs so it could possibly work
remove deadbeef memory-clobber testing (for now)


svn:r616
2003-10-18 00:07:58 +00:00
Nick Mathewson
f32c1c3127 Log TLS errors even harder
svn:r604
2003-10-15 23:50:25 +00:00
Nick Mathewson
f81178a312 Add more logging on some ssl errors.
svn:r603
2003-10-15 23:42:44 +00:00
Roger Dingledine
11a23fc280 clean up logging, allow user to specify log files
If DebugLogFile is specified, log to it at -l debug
If LogFile is specified, log to it at the -l from the commandline
  (default info)
If no LogFile *and* not a Daemon, then log to stdout.
Make conn->s = -1 by default (this might break things)
When kill -USR1, prefer to log at INFO, but make sure they always see it.


svn:r596
2003-10-15 18:50:16 +00:00
Nick Mathewson
695920d09f Build without warnings on OS X.
svn:r595
2003-10-15 18:48:48 +00:00
Nick Mathewson
22ef733058 Make add_file_log return 0 on success.
svn:r594
2003-10-15 18:38:38 +00:00
Nick Mathewson
77be56fbdd Add tor_realloc to mirror tor_malloc
svn:r582
2003-10-14 01:11:42 +00:00
Roger Dingledine
8df0eee16a oops, bugfix
svn:r572
2003-10-10 01:50:20 +00:00
Roger Dingledine
36fb8e839d change WARNING to WARN
svn:r570
2003-10-10 01:48:03 +00:00
Nick Mathewson
36939303c9 Update LICENSE and copyright dates.
svn:r560
2003-10-08 02:04:08 +00:00
Nick Mathewson
3d7463d2b3 Clear revents even when no events are received. Also, since everyone gets in exceptions, everyone gets to increment maxfd.
svn:r550
2003-10-07 21:16:04 +00:00
Nick Mathewson
74e6c03cab Hoping to find an fd larger than ((unsigned)-1) is probably a lost cause.
svn:r549
2003-10-07 20:45:16 +00:00
Roger Dingledine
f9f091eb0e do not ask for whom there's an error, it polls for thee
svn:r548
2003-10-07 20:02:45 +00:00
Roger Dingledine
de6cbe53c0 some early bugfixes
our log() conflicts with log(3)
distribute only the correct files from doc/ and src/config/
sometimes laptops go back in time. i guess that's ok for now.
and bump the version number because we're live.


svn:r544
2003-10-07 16:30:05 +00:00
Roger Dingledine
be874358a4 wrap strdup; prefer time() to gettimeofday()
svn:r538
2003-10-04 03:29:09 +00:00
Roger Dingledine
750b238aea clean some includes
svn:r535
2003-10-04 01:36:11 +00:00
Nick Mathewson
6ac42f5ec0 Make testcases run again; more sanity checking to descriptor generation.
svn:r532
2003-10-01 22:31:13 +00:00
Nick Mathewson
f694ab23f5 Flush after fputs
svn:r526
2003-10-01 00:42:24 +00:00
Roger Dingledine
f0e94dab86 make log use a larger buffer, for easier debugging
svn:r515
2003-09-30 19:53:25 +00:00
Roger Dingledine
3ed7aedc11 bugfixes and features: closer to making dirserv work
fix a variety of seg faults
don't try to list OPs in running-routers
write cached-directory to disk when rebuilding the dir
on boot, dirservers load approved-routers file
on boot, dirservers load cached directory file


svn:r508
2003-09-29 23:14:49 +00:00
Roger Dingledine
467d278b8b more cleanup and rearranging
still not finished integrating new dirserv stuff


svn:r507
2003-09-29 07:50:08 +00:00
Roger Dingledine
677707433e shift read_file_to_str() into util.c
svn:r504
2003-09-28 06:47:29 +00:00
Nick Mathewson
798bb6ab3b Add function to wrap SSL_pending
svn:r501
2003-09-27 20:07:40 +00:00
Roger Dingledine
bf10a3c0f1 finish enforcing the log convention
svn:r494
2003-09-26 22:27:24 +00:00
Roger Dingledine
d8f646c44f make writing descs work
svn:r492
2003-09-26 21:26:25 +00:00
Nick Mathewson
febb2251ca Add code to parse fingerprint files and compare routers against fingerprint files.
svn:r490
2003-09-26 20:41:23 +00:00
Nick Mathewson
a3e08a0119 Bugfixes in crypto_pk_write_private_key_to_filename
svn:r489
2003-09-26 18:44:20 +00:00
Nick Mathewson
92acbe12bc Refactor common file code into util.c; add published to descriptors
svn:r487
2003-09-26 18:27:35 +00:00
Roger Dingledine
3b5191d36d various bugfixes and updates
redo all the config files for the new format (we'll redo them again soon)

fix (another! yuck) segfault in log_fn when input is too large
tor_tls_context_new() returns -1 for error, not NULL
fix segfault in check_conn_marked() on conn's that die during tls handshake

make ORs also initialize conn from router when we're the receiving node

make non-dirserver ORs upload descriptor to every dirserver on startup
add our local address to the descriptor
add Content-Length field to POST command
revert the Content-Length search in fetch_from_buf_http() to previous code
fix segfault in memmove in fetch_from_buf_http()
raise maximum allowed headers/body size in directory.c


svn:r484
2003-09-25 10:42:07 +00:00
Nick Mathewson
3d4ccb781a Refactor buffers; implement descriptors.
'buf_t' is now an opaque type defined in buffers.c .

Router descriptors now include all keys; routers generate keys as
needed on startup (in a newly defined "data directory"), and generate
their own descriptors.  Descriptors are now self-signed.

Implementation is not complete: descriptors are never published; and
upon receiving a descriptor, the directory doesn't do anything with
it.

At least "routers.or" and orkeygen are now obsolete, BTW.


svn:r483
2003-09-25 05:17:11 +00:00
Roger Dingledine
e514ac528c fix a segfault on truncated log lines
svn:r473
2003-09-19 09:30:34 +00:00
Nick Mathewson
5f9ac2bdfd More fine-grained logging messages on ZeroReturn/Syscall error cases
svn:r467
2003-09-16 20:53:09 +00:00
Nick Mathewson
7711c2e745 Add backend support for multiple logfiles, including console logs.
Also optimize logging by formatting messages in memory before sending
them through stdio.  (It turns out (according to gprof) that logging
performance matters.)


svn:r463
2003-09-16 17:58:36 +00:00
Nick Mathewson
e4dfc3c8fe Cipher lists need to be colon separated. Also make initialization more bulletproof
svn:r459
2003-09-15 19:38:52 +00:00
Nick Mathewson
633a5ffc0b Fix TLS error logging
svn:r458
2003-09-15 18:37:49 +00:00
Nick Mathewson
408bff4a23 Log protocol errors
svn:r457
2003-09-15 18:18:37 +00:00
Roger Dingledine
e585dad887 fix the cpuworker circ-had-vanished bug (maybe)
still several (many) tls-related bugs outstanding.


svn:r454
2003-09-14 02:58:50 +00:00
Nick Mathewson
001cd08b2e Fix bugs in certificate generation and SSL context creation. Both seem to work now.
svn:r447
2003-09-11 23:26:31 +00:00
Nick Mathewson
5082ee8ae0 Non-debugging messages are nice to log too
svn:r444
2003-09-11 22:13:13 +00:00
Nick Mathewson
529d3bc56f Resolve XXXXs in tortls.c
svn:r443
2003-09-11 21:38:57 +00:00
Nick Mathewson
f5b4ef1fa2 Simplify some code paths in TLS; cut down on memory leaks; use
reasonable ciphers if not everyone has OpenSSL 0.9.7.


svn:r442
2003-09-11 21:12:39 +00:00
Roger Dingledine
0761bc7b83 fix typo that's been bugging me
svn:r440
2003-09-11 20:10:39 +00:00
Nick Mathewson
e22b271895 Add certificate verification functions
svn:r438
2003-09-10 00:47:39 +00:00
Nick Mathewson
9955b265ab Make crypto structures private to crypto.c
svn:r437
2003-09-10 00:47:24 +00:00
Nick Mathewson
67697d5ab1 Add prototypes for functions to check whether the peer certificate is
valid (if it is present); and to get a public key from a peer
certificate (in order to identify the peer).


svn:r436
2003-09-10 00:10:37 +00:00
Roger Dingledine
1a9b5f9de9 another wishlist function for the tls interface
svn:r433
2003-09-08 10:46:19 +00:00
Roger Dingledine
ace475f01c hide the global tls context inside tortls.c
svn:r431
2003-09-08 06:22:19 +00:00
Roger Dingledine
99d1e4931b move variable declarations to top of function
svn:r425
2003-09-05 05:58:21 +00:00
Nick Mathewson
fd20011c26 Add initial interfaces and code for TLS support. Interfaces are right; code needs work and testing.
svn:r424
2003-09-04 16:05:08 +00:00
Roger Dingledine
58c5d5e918 fix formatting in crypto.c for my sanity
svn:r411
2003-08-25 07:06:12 +00:00
Roger Dingledine
2dda97e8fd implemented cpuworkers
please poke at it and report bugs

still needs polishing, and only handles onions now (should handle
OR handshakes too)


svn:r402
2003-08-20 23:05:22 +00:00