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